I have a function that opena a trade on signal idicators, but after it closes out of the trade it opens another one up again.
I'm wondering how to write a function that would would wait a half hour before it can open another one.
What can I add to this function to make it work that way?
First, you put this guy before OnInit() (make it general statement)
int TimeHold = 0;
then change your current code to the following. Vuala! Now your trade will open once per hour. Goodluck.
if ((Buy1=Buy2) && TimeHold != Hour())
TimeHold = Hour();
Thanks. So, you mean after the first trade closes out, then it will wait an hour even if a buy order is sent to it before the hour is up?