Please see my basic entry and exit code:
if sellSig and ( require_rising_falling==false or falling )
strategy.entry("Sell",strategy.short)
strategy.exit("ES",from_entry="Sell",stop=sell_sl,limit=sell_tp)
This works well when pyramiding is set to 1.
However, if I want to use pyramiding >1, I run into a big issue; namely, the same exit applies to all open trades.
Please see example of current behaviour:
You can see that both positions close on the same bar.
Desired behaviour would look something more like this:
Where each position would have its own exit relative to its entry.
What's the best way to facilitate this (ideally using my existing code as a starting point)? Thank you.

