Recording data

 

Hi!

I am placing two stop orders after the 00:00 candle is formed.(buy stop, sell stop)

But I am placing SLs and TPs only after they are hit..which means it can happen on candle after 00:00 candle or 5 candles after that..

For my strategy,I need to know the High and the Low of candle 00:00...Please advice on a way to record those values, because I dont know on which candle orders will be triggered and so I can not know which number candle 00:00 will be.

Thanks.

 
t0mbfunk:

Hi!

I am placing two stop orders after the 00:00 candle is formed.(buy stop, sell stop)

But I am placing SLs and TPs only after they are hit..which means it can happen on candle after 00:00 candle or 5 candles after that..

For my strategy,I need to know the High and the Low of candle 00:00...Please advice on a way to record those values, because I dont know on which candle orders will be triggered and so I can not know which number candle 00:00 will be.

OrderSelect() the order, use OrderOpenTime() to get the time that the order was opened, this will be some tile after 0:00 but not too long after . . . then use this datetime instead of TimeCurrent() with my Midnight calculation to get the correct midnight datetime . . .

Midnight

 

Thank you for the reply, maybe you know of a simpler way, because I am stuck.

 
t0mbfunk:

Thank you for the reply, maybe you know of a simpler way, because I am stuck.

Stuck where ?
 
t0mbfunk: I need to know the High and the Low of candle 00:00...Please advice on a way to record those values, because I dont know on which candle orders will be triggered and so I can not know which number candle 00:00 will be.
Don't try to record them. Once a order is open, find the midnight candle number.
string   PriceToStr(double p){   return( DoubleToStr(p, Digits) );            }

#define HR2400 86400       // 24 * 3600
int      TimeOfDay(datetime when){  return( when % HR2400          );         }
datetime DateOfDay(datetime when){  return( when - TimeOfDay(when) );         }
datetime Today(){                   return(DateOfDay( TimeCurrent() ));       }
//datetime Tomorrow(){                return(Today() + HR2400);                 }
//datetime Yesterday(){               return( iTime(NULL, PERIOD_D1, 1) );      }
///////////////////////////////////////////////////////////////////////////////

datetime midnight  = Today();
int      iMidnight = iBarShift(NULL,0, midnight);
Print("Midnight candle high was " + PriceToStr(High[iMidnight]) );
 

Thank you guys for your help, but I've found a simpler solution although in the end I got the logic RaptorUK.

So thank you.)