Use a static var to lock the entry and exit condition.
static bool tradelock = false;
...
Margin = Capital+(WinTotal-LossTotal) //Total money in account
...
if(!NumOpenLong && indicator==1 && !tradelock)
enterLong();
tradelock = true;
else
if (NumOpenLong && indicator==2 && tradelock)
exitLong();
tradelock = false;
}
Last edited by brax; 05/08/18 11:22.