protected override void OnBarUpdate()
{
if(Position.MarketPosition != MarketPosition.Flat)
return;
if(CrossAbove(EMA(eMAF), EMA(eMAS), 1))
EnterLong();
else if (CrossBelow(EMA(eMAF), EMA(eMAS), 1))
EnterShort();
}
I expected it to enter one trade on the first cross of the EMAs and enter no further trades as it would return due to:-
if(Position.MarketPosition != MarketPosition.Flat)
return;
but it continues to enter and exit trades. What am I missing?
Also I notice that at the end of the contract the open position is closed. Is it possible to get the same behaviour when using the WFA, testing on multiple contracts?
Comment