if (OpenTrades > 0) SendLong = false;//5
and
if (OpenTrades > 0) SendShort = false;//5
Assuming we got the mainentry already we had an open trade - so opentrades would be at least 1 ...
Or do I overlook something?
Hm, I think the MaxTradesAllowed variable could be useful to limit the opentrades count also in general (or more sophisticated, e.g. maxopenmaintrades=xyz, maxreentrytrades=abc, maxstacktrades=ghi)?
For the re-entry-trades (+ stacktrades) it imho could make sense to check if the previous trades are in profit (may be to be choosen by user if to activate, AddToProfitTradesOnly=true ..).