//+------------------------------------------------------------------+ //| Ranger.mq4 | //| doshur | //| http://www.doshur.com | //+------------------------------------------------------------------+ #property copyright "doshur" #property link "http://www.doshur.com" #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 SkyBlue #property indicator_color2 Red #property indicator_color3 RoyalBlue #property indicator_color4 LimeGreen extern int MA = 13; extern int Mode = 1; // 0 - SMA, 1 - EMA, 2 - SMMA, 3 - LWMA extern int Band = 20; extern int BandMode = 1; //---- buffers double ExtMapBuffer1[]; double UpperBuffer[]; double LowerBuffer[]; double ZeroBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,UpperBuffer); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,LowerBuffer); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,ZeroBuffer); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i; int counted_bars = IndicatorCounted(); double MA_UP, MA_DN, Result; double BB, Zero; limit = Bars - counted_bars; //---- for(i = 0; i <= limit; i++) { MA_UP = Close[i] - iMA(NULL, 0, MA, 0, Mode, PRICE_HIGH, i); MA_DN = Close[i] - iMA(NULL, 0, MA, 0, Mode, PRICE_LOW, i); Result = MA_UP + MA_DN; ExtMapBuffer1[i] = Result; } for(i = 0; i <= limit; i++) { BB = iStdDevOnArray(ExtMapBuffer1,0,Band,0,BandMode,i); Zero = iMAOnArray(ExtMapBuffer1,0,Band,0,BandMode,i); UpperBuffer[i] = Zero + BB; LowerBuffer[i] = Zero - BB; ZeroBuffer[i] = Zero; } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Moving average indicator
Standard Deviation indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: