i would like to stop (not terminate) my automated strategy for today if the last trade was a loosing one, but when i add this code from the help section i get an INDEX OUT OF RANGE error
other parts of my strategy require this to be set:
if (CurrentBar < 6)
return;
here is the code i am using from the help section:
Trade lastTrade = Performance.AllTrades[Performance.AllTrades.Count - 1];
if (lastTrade != null && lastTrade.ProfitPercent <= 0)
allowtrading == false;
on firstbarofsession is set "allowtrading" to true
on every entry i check if allowtrading == true then enterlong
Comment