This is in the area of handling stop loss in a strategy. The stop loss code is as below:
**stop_level_long =iff (barcountLongEntry>1,max( strategy.position_avg_price * (1 - sl_long),longStopTrail),0) take_level_long = strategy.position_avg_price * (1 + tp_long) strategy.exit("Stop/Target Long", "Long", stop=stop_level_long, limit=take_level_long,when=window)//
Sometimes the move for triggering the stop loss is also triggering the short entry in the same bar. This results in maximum contracts exceeding 1 even when the pyramiding is set to 1. Thanking all in advance for the help.