#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Red extern int LookbackPeriod = 12; extern double Multiplicator =2; double buffer1[]; double buffer2[]; int init() { SetIndexBuffer(0, buffer1); SetIndexBuffer(1, buffer2); SetIndexStyle(0, DRAW_LINE, STYLE_DOT, 1, Red); SetIndexStyle(1, DRAW_LINE, STYLE_DOT, 1, Red); return(0); } int start() { int limit; int counted_bars = IndicatorCounted(); if (counted_bars < 0) return(-1); if (counted_bars > 0) counted_bars--; limit = Bars - counted_bars - 1; for(int i = limit; i >= 0; i--) { double h = 0; int hc = 0; double l = 0; int lc = 0; for (int j = 1; j <= LookbackPeriod; j++) { double dh = High[i + j] - High[i + j + 1]; if (dh > 0) { h += dh; hc++; } double dl = Low[i + j + 1] - Low[i + j]; if (dl > 0) { l += dl; lc++; } } if (hc > 0) h = h / hc; if (lc > 0) l = l / lc; h = High[i + 1] + h * Multiplicator; l = Low[i + 1] - l * Multiplicator; if (buffer1[i + 1] > High[i + 1]) { buffer1[i] = MathMin(h, buffer1[i + 1]); } else { buffer1[i] = h; } if (buffer2[i + 1] < Low[i + 1]) { buffer2[i] = MathMax(l, buffer2[i + 1]); } else { buffer2[i] = l; } } return(0); }
Sample
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: