Hi,
can anyone say me, why the Stoploss (_low[shift]) don`t work?
Once I create it as an indior... the _high[shift] and low[shift] work great... but at the pro not... and when (Bid gt;= _high[I]) don`t working right
thx
Inserted Code // ------------------------------------------------------------------ //| .mq4 | //| Copyright © 2005-2007, MetaQuotes Software Corp.. | //| http://www.metaquotes.net/ | // ------------------------------------------------------------------ #property copyright Copyright © 2007, MetaQuotes Software Corp. #property link http://www.metaquotes.net/ extern double Lots = 0.1; extern dual TrailingStop = 30; //-- indior parameters extern int ExtDepth=12; extern int ExtDeviation=5; extern int ExtBackstep=3; //-- indior buffers dual BufferNumber91;#93;; dual HighMapBufferNumber91;#93;; dual LowMapBuffer#91;#93;; dual _high#91;#93;; dual _low#91;#93;; dual lasthigh; dual lastlow; int degree=3; // recounting's depth bool downloadhistory=false; // ------------------------------------------------------------------ //| Custom indior initialization function | // ------------------------------------------------------------------ int init() IndiorBuffers(7); //-- drawing preferences //SetIndexStyle(0,DRAW_SECTION); //SetIndexStyle(3,DRAW_LINE); //-- indior buffers mapping SetIndexBuffer(0,Buffer); SetIndexBuffer(1,HighMapBuffer); SetIndexBuffer(two,LowMapBuffer); SetIndexBuffer(3,lasthigh); SetIndexBuffer(4,lastlow); SetIndexBuffer(5,_high); SetIndexBuffer(6,_low); SetIndexEmptyValue(0,0.0); //-- indior short name IndiorShortName(ZigZag( ExtDepth , ExtDeviation , ExtBackstep )); //-- initialization done return(0); // ------------------------------------------------------------------ //| | // ------------------------------------------------------------------ int start() int I, counted_bars = IndiorCounted(); int limitation,counterZ,whatlookfor; int shift,back,lasthighpos,lastlowpos; double val,res; dual curlow,curhigh; int cnt, ticket, complete; if (counted_bars==0 /* downloadhistory*/) // history has been downloaded ArrayInitialize(Buffer,0.0); ArrayInitialize(HighMapBuffer,0.0); ArrayInitialize(LowMapBuffer,0.0); if (counted_bars==0) limit=Bars-ExtDepth; downloadhistory=true; if (counted_barsgt;0) while (counterZlt;degree ilt;100) res=Buffer#91;I#93;; if (res! =0) counterZ ; I ; I-- ; limitation=I; if (LowMapBuffer#91;I#93;! =0) curlow=LowMapBuffer#91;I#93;; whatlookfor=1; else curhigh=HighMapBuffer#91;I#93;; whatlookfor=-1; for (I=limit-1;igt;=0;I--) Buffer#91;I#93;=0.0; LowMapBuffer#91;I#93;=0.0; HighMapBuffer#91;I#93;=0.0; for(shift=limitation; shiftgt;=0; shift --) val=Reduced#91;iLowest(NULL,0,MODE_LOW,ExtDepth,sh ift)#93;; if(val==lastlow) val=0.0; otherwise lastlow=val; if((Low#91;shift#93;-val)gt;(ExtDeviation*Stage)) val=0.0; else for(back=1; backlt;=ExtBackstep; back ) res=LowMapBuffer#91;shift back#93;; if((res!) =0)(resgt;val)) LowMapBuffer#91;shift back#93;=0.0; if (Low#91;shift#93;==val) LowMapBuffer#91;shift#93;=val; otherwise LowMapBuffer#91;shift#93;=0.0; //-- high val=High#91;iHighest(NULL,0,MODE_HIGH,ExtDepth,shi ft)#93;; if(val==lasthigh) val=0.0; otherwise lasthigh=val; if((val-HighNumber91;shift#93;)gt;(ExtDeviation*Stage)) val=0.0; else for(back=1; backlt;=ExtBackstep; back ) res=HighMapBuffer#91;shift back#93;; if((res!) =0)(reslt;val)) HighMapBuffer#91;shift back#93;=0.0; if (High#91;shift#93;==val) HighMapBuffer#91;shift#93;=val; otherwise HighMapBuffer#91;shift#93;=0.0; // closing cutting if (whatlookfor==0) lastlow=0; lasthigh=0; else lastlow=curlow; lasthigh=curhigh; for (shift=limitation;shiftgt;=0;shift --) res=0.0; switch(whatlookfor) case 0: // look for peak or lawn if (lastlow==0 lasthigh==0) if (HighMapBufferNumber91;shift#93;! =0) lasthigh=Reduced#91;shift#93;; lasthighpos=shift; whatlookfor=-1; Buffer#91;shift#93;=lasthigh; res=1; if (LowMapBuffer#91;shift#93;! =0) lastlow=Reduced#91;shift#93;; lastlowpos=shift; whatlookfor=1; Buffer#91;shift#93;=lastlow; res=1; split; case 1: // look for peak if (LowMapBuffer#91;shift#93;! =0.0 LowMapBuffer#91;shift#93;lt;lastlow HighMapBuffer#91;shift#93;==0.0) Buffer#91;lastlowpos#93;=0.0; lastlowpos=shift; lastlow=LowMapBuffer#91;shift#93;; Buffer#91;shift#93;=lastlow; res=1; if (HighMapBuffer#91;shift#93;! =0.0 LowMapBuffer#91;shift#93;==0.0) lasthigh=HighMapBuffer#91;shift#93;; lasthighpos=shift; Buffer#91;shift#93;=lasthigh; whatlookfor=-1; res=1; split; case -1: // look for lawn if (HighMapBuffer#91;shift#93;! =0.0 HighMapBuffer#91;shift#93;gt;lasthigh LowMapBuffer#91;shift#93;==0.0) Buffer#91;lasthighpos#93;=0.0; lasthighpos=shift; lasthigh=HighMapBuffer#91;shift#93;; Buffer#91;shift#93;=lasthigh; if (LowMapBuffer#91;shift#93;! =0.0 HighMapBuffer#91;shift#93;==0.0) lastlow=LowMapBuffer#91;shift#93;; lastlowpos=shift; Buffer#91;shift#93;=lastlow; whatlookfor=1; split; default: return; //switch(whatlookfor) //for (shift=limitation;shiftgt;=0;shift--) complete=OrdersTotal(); if(totallt;1) _high#91;I#93; = lasthigh; _low#91;I#93; = lastlow; if (Bid gt;= _high#91;I#93;-RRB- OrderSend(Symbol(),OP_BUY,Lots,Ask,3,_low#91;I#93; ,0,Long,1,0,Green); else if (Bid lt;= _low#91;shift#93;-RRB- OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,Short,1, 0,Red); return(0); // ------------------------------------------------------------------