That would likely be correct. The check requires that there be at least one trade. (There must be at least one trade if you are trying to check the position of the entry of the previous trade)
You may want to change your if statement and use parenthesis.
if ( Performance.AllTrades.Count < 1 || (Performance.AllTrades.Count > 0 && Performance.AllTrades[Performance.AllTrades.Count - 1].Entry.MarketPosition != MarketPosition.Long) )
This states if the count is less than 1 or if both the count is greater than 0 and the previous trades entry is not into a long position.
Comment