Hello guys,
I am trying to avoid multiple buy/sell signals triggered on a single bar. I tried logic, but it is overwritten with initialized value again and again.
onBuy = onShort = false;
if(LastValue(Buy,true) == True AND NOT onBuy){
_TRACE("Placing order in long position");
onBuy = True;
}else if(LastValue(Short,true) == True AND NOT onShort){
_TRACE("Placing order in short position");
onShort = True;
}
What happens is, the onBuy or onShort variable remains false throughout the execution. And I am unable to execute that particular snippet only once.