I need an exit strategy that takes profit after the close of the entry bar > entryprice. The strategy needs to take into consideration multiple positions and take profit independently of each order generated. The below code works but not if there are multiple orders. The third image shows a trailing stop taking into consideration each individual order.
if Barssinceentry > 1 and Close > Entryprice then sell next bar at market;