Controlled Open Time

 

55839 - in this post, I learned how to open an order at the start of a bar. Am using this with great success.

What I need to know now, is how to delay opening the order for X no. of minutes after the opening of the bar.

Example: On the 4 hour chart, open an order at the opening of the 4 hour bar + 5 minutes ( or 10 minutes, etc.,)

Any help is greatly appreciated.

MrChuckW

 
mrchuckw:

55839 - in this post, I learned how to open an order at the start of a bar. Am using this with great success.

What I need to know now, is how to delay opening the order for X no. of minutes after the opening of the bar.

Example: On the 4 hour chart, open an order at the opening of the 4 hour bar + 5 minutes ( or 10 minutes, etc.,)

Any help is greatly appreciated.

MrChuckW

Datetime is an integer representing number of seconds elapse since January 1, 1970 00:00:00.

So for example, 3 minutes after January 1, 1970 00:00:00 is equal with integer value of 180 (3 minutes * 60 second).

So, the solution will be,,,

int one_minute = 60;

if (TimeCurrent() >= iTime (Symbol(), PERIOD_H4, 0) + 5*one_minute)
   {
   //--- open now
   }


Reason: