I am using managed approach and trying to adjust stop loss to breakeven after 20 ticks profit.
**Method**
Adjust SetStopLoss to Position.Average price after 20 ticks of profit
**Problem**
Because of the OnBarUpdate (every 5 min), sometimes the SetStopLoss is not adjusted to Position.Average becauce 20 ticks of profit occurs on current bar, but the logic to adjust the setstoploss does not excecute until the bar close. By this time price is above (considering the long case) Position.Average which leads to a lost when ideally it should be break even trade. This does not happen all the time, but it does happen.
See pictures for example. This happen like 8 times out of 600 trades.
**Solution**
I am not sure there is a solution because the logic is working, its just the breakeven logic does not execute until after bar close, but its a bit too late cause price is above the Position.Average. See picture Screenshot_67.png to see print out of logic working.
Do you know if anyway I can fixed this?
Comment