[i]BollTrade_Ron_MT4_v04b_v1
Download scriptThis tool is designed as a visual technical indicator for trading charts, specifically aimed at identifying price extremes based on volatility and historical averages. It functions by monitoring the relationship between current market prices and established statistical boundaries.
Core Logic Overview
The script utilizes two primary mathematical concepts: a Simple Moving Average (which identifies the "normal" average price over a set period) and Standard Deviation (which measures how much the price typically fluctuates from that average). By combining these two, the tool calculates what are known as Bollinger Bands—upper and lower boundaries that represent the expected range of price movement.
How It Works
The logic follows a specific three-step process to identify potential signals:
- Boundary Calculation: The script looks at the opening prices of candles over a user-defined period (default is 15). It calculates the upper and lower "edges" of the market's normal behavior based on the standard deviation of those prices.
- The "Breakout" Filter: Rather than simply flagging every time the price touches a boundary, the script looks for an aggressive breach. It requires the price to move beyond these boundaries by a specific additional distance (a "buffer" or "margin").
- Signal Generation:
- Over-Extension (Upper): If the high of a candle exceeds the upper boundary plus the specified extra distance, the tool places a magenta arrow on the chart. This indicates that the price has pushed significantly higher than the statistical norm.
- Over-Extension (Lower): If the low of a candle drops below the lower boundary minus the specified extra distance, the tool places a blue arrow on the chart. This indicates that the price has dropped significantly further than the statistical norm.
Summary for Traders
In practical terms, this script acts as an "extreme alert" system. It filters out minor fluctuations and only highlights moments where the market is moving with enough strength to break outside of standard volatility zones. By visualizing these points, it helps traders identify areas where the price might be over-extended, potentially signaling a point of exhaustion or a significant trend breakout.
//+-----------+
//| 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