Hello,
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.
Code is
if (!ExistPositions()){
if ((Buy1=Buy2)){
OpenBuy();
return;
}
What can I add to this function to make it work that way?
Thanks
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(!ExistPositions()) { if ((Buy1=Buy2) && TimeHold != Hour()) { OpenBuy(); TimeHold = Hour(); return; } }
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.
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?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
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.
Code is
if (!ExistPositions()){
if ((Buy1=Buy2)){
OpenBuy();
return;
}
What can I add to this function to make it work that way?
Thanks