// Range stop & reverse.mq4 // Èíäèêàòîð "Äèàïàçîí ñòîï è ðàçâîðîò" //Èíäèêàòîð òðåíäîâûé. Ïåðèîä îò Ì1 äî Í1. Äëÿ EURUSD ëó÷øåå çíà÷åíèå Range=35, //äëÿ GBPUSD ëó÷øåå çíà÷åíèå Range=65. Ñâÿçàíî ñ îïòèìàëüíûì óðîâíåì ñòîïà äëÿ //ñèìâîëà (èíñòðóìåíòà). Ìîæíî èñïîëüçîâàòü äëÿ óñòàíîâêè ñòîï ëîññ è äëÿ îòêðûòèÿ ïîçèöèé. #property copyright "mandorr@gmail.com" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Violet #property indicator_color2 SkyBlue #property indicator_color3 Silver extern int Range=35; // Äèàïàçîí â ïèïñàõ extern int CountBars=10000; // Êîëè÷åñòâî îòîáðàæàåìûõ áàðîâ double buffer0[]; double buffer1[]; double buffer2[]; void init() { SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(0,buffer0); SetIndexLabel(0,"Âåðõíÿÿ ãðàíèöà"); SetIndexDrawBegin(0,0); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(1,buffer1); SetIndexLabel(1,"Íèæíÿÿ ãðàíèöà"); SetIndexDrawBegin(1,0); SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1); SetIndexBuffer(2,buffer2); SetIndexLabel(2,"Ìåäèàíà"); SetIndexDrawBegin(2,0); IndicatorShortName("Äèàïàçîí ñòîï è ðàçâîðîò ("+Range+" ïèïñîâ)"); } void deinit() { Comment(""); } void start() { int dir, dir1, i; double h, l, h1, l1; h=(High[CountBars]+Low[CountBars]+Range*Point)/2; l=(High[CountBars]+Low[CountBars]-Range*Point)/2; dir=0; for (i=CountBars-1; i>=0; i--) { h1=h; l1=l; dir1=dir; if (High[i]>h) {h=High[i]; l=h-Range*Point;} if (Low [i]<l) {l=Low [i]; h=l+Range*Point;} if (h>h1) dir =1; if (l<l1) dir=-1; if (h>h1 && l<l1) dir=0; buffer0[i]=EMPTY_VALUE; buffer1[i]=EMPTY_VALUE; if (dir<0) buffer0[i]=h; if (dir>0) buffer1[i]=l; if (dir1<0 && dir>0) buffer0[i]=h1; if (dir1>0 && dir<0) buffer1[i]=l1; buffer2[i]=(h+l)/2; } if (buffer0[0]!=EMPTY_VALUE) Comment("SELL, ñòîï è ðàçâîðîò "+DoubleToStr(buffer0[0],Digits)); if (buffer1[0]!=EMPTY_VALUE) Comment("BUY, ñòîï è ðàçâîðîò "+DoubleToStr(buffer1[0],Digits)); }
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: