I'm trying to use a time-delay in my strategy. I want to simply do some actions "on bar close", then wait 2 minutes, and perform some more actions. I'm using the following code to attempt to "wait 2 minutes":
if(Time[0].Subtract(Time[0]).Minutes > 2){Print( "2 Minutes... ");}
This compiles fine but doesn't seem functional, the message never prints to the Output Window. I have changed the "calculateonbarclose" to "false" to enable tick-by-tick processing (I'm using "Firsttickofbar" for the "CalculateonBarclose" stuff) .
I also thought about manipulating this code from the Help:
// Checks if current time is greater than the bar time stamp
if (DateTime.Now.Ticks > Time[0].Ticks)
Print("Do something");
I'm not sure how to go about correcting this code to have it perform as I wish...any suggestions appreciated.
Comment