[i]BollTrade_Ron_MT4_v04b
Download scriptThis technical indicator is designed to identify specific price extremes on a trading chart by combining volatility analysis with a customizable "buffer" zone. It helps traders visualize moments when the market moves significantly beyond its normal range, signaling potential overextended conditions.
Core Logic Overview
The script works by calculating a dynamic volatility envelope around the current price. To do this, it relies on two primary mathematical components:
- Moving Average: A baseline that tracks the "average" price over a specific set number of bars.
- Standard Deviation: A measure of how much the price is currently fluctuating or "spreading out" from that average.
By combining these, the script establishes an upper and lower boundary (known as Bollinger Bands). These boundaries act as the "normal" operating zone for the asset.
Signal Generation
The indicator does not simply trigger a signal when the price touches these boundaries. Instead, it looks for "breakout" behavior by adding a secondary layer of logic:
- Upper Bound Breach: If the highest price reached during a period exceeds the upper boundary by a specific additional distance (defined by the user), the script identifies this as an extreme upward move and places a visual marker.
- Lower Bound Breach: Conversely, if the lowest price reached during a period drops below the lower boundary by that same additional distance, the script identifies an extreme downward move and places a visual marker.
Key Customization Factors
The tool allows for three main points of adjustment to fine-tune the sensitivity:
- Bollinger Period: Determines how much historical data is used to calculate the average (longer periods result in smoother lines; shorter periods are more reactive).
- Deviation: Controls the width of the standard volatility envelope.
- Distance: Defines the "extra" room required beyond the standard envelope before a signal is officially recognized.
In summary, this script acts as a filter to ignore minor price fluctuations, highlighting only those significant moves that push deep into overbought or oversold territory relative to recent market history.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+-----------+
//| TwoPerBar |
//+-----------+
#property copyright "Ron Thompson"
#property link "http://www.lightpatch.com/forex/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Magenta
extern double BDistance = 14; // plus how much
extern int BPeriod = 15; // Bollinger period
extern int Deviation = 2; // Bollinger deviation
//---- buffers
double val1[];
double val2[];
//+----------------+
//| Custom init |
//+----------------+
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexBuffer(0,val1);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
SetIndexBuffer(1,val2);
}
//+----------------+
//| Custom DE-init |
//+----------------+
int deinit()
{
Print("DE-Init happened ",CurTime());
Comment(" ");
}
//+-----+
//| TPB |
//+-----+
int start()
{
int i;
int mybars=Bars;
double ma = iMA(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,0);
double stddev = iStdDev(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,0);
double bup0 = ma+(Deviation*stddev);
double bdn0 = ma-(Deviation*stddev);
for (i=mybars; i>=0; i--)
{
ma = iMA(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,i);
stddev = iStdDev(Symbol(),0,BPeriod,0,MODE_SMA,PRICE_OPEN,i);
bup0 = ma+(Deviation*stddev);
bdn0 = ma-(Deviation*stddev);
if( High[i]>=bup0+(BDistance*Point) )
{
val2[i]=bup0+(BDistance*Point);
}
if( Low[i]<=bdn0-(BDistance*Point) )
{
val1[i]=bdn0-(BDistance*Point);
}
}//for
}//start
Comments