Wednesday 26 December 2012

supertrend value


i made something approaching what i want but i cant understand the behaviour of this EA : its following supertrend switches sometimes, but it also reacts when the market reaches supertrend value...
here are the interresting lines of this code :
//green supertrend and previous value
double super0 = iCustom(NULL,0,"SuperTrend",0,1);
double prevsuper0 = iCustom(NULL,0,"SuperTrend",0,2);
//red supertrend and previous value
double super1 = iCustom(NULL,0,"SuperTrend",1,1);
double prevsuper1 = iCustom(NULL,0,"SuperTrend",1,2);
// turns to red
if ((super1!=2147483647) && (prevsuper1==2147483647)) Order=SIGNAL_CLOSEBUY;
if ((super1!=2147483647) && (prevsuper1==2147483647)) Order=SIGNAL_SELL;
//turns to green
if ((super0!=2147483647) && (prevsuper0==2147483647)) Order=SIGNAL_CLOSESELL;
if ((super0!=2147483647) && (prevsuper0==2147483647)) Order=SIGNAL_BUY;
i also wonder why this weird value of 2147483647 when the line isnt of the same color as the buffer, instead of a clean EMPTY_VALUE...
thanks again!!!

No comments:

Post a Comment