delay not working

To add comments, please log in or register
mattehalen
98
mattehalen  

I'm looking for a code thats will wait to buy after crossing.

Insted of buying exatly wail crossing i want it to buy to or 3 candels later.

I have this code now:

   trendB      =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",1,0);
   trendB.old  =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",1,1);
   trendA      =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",0,0);
   trendA.old  =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",0,1);

 if(trendB>trendA && trendB.old<=trendA.old){

This should Delay it one candle Right? but it wont :(

zzuegg
1500
zzuegg  

hi, no, your code does not delay the trade. try this one:

   trendB      =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",1,1);
   trendB.old  =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",1,2);
   trendA      =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",0,1);
   trendA.old  =iCustom(NULL, Timeperiod[TimeperiodSelector], "_InsTrend",0,2);
Viffer
614
Viffer  

Or how about taking a time stamp and using iBarshift? That way you can delay by as many bars as you like...

hth

V

To add comments, please log in or register