I am trying to code a strategy that exits based on time since entry so there is no initial stop loss created when the entry takes place. However, I am now trying to test adding a breakeven stop loss once the trade gets to a certain number of points in profit. I am having an issue with my SetStopLoss for this breakeven SL on some trades because it causes for the trade to immediately exit after entry is taken. It seems that on some of the trades the SetStopLoss order is being placed immediately rather than waiting for the trade to hit a certain number of points in profit. I've tried adding conditions such as BarsSinceEntry to prevent this immediate SetStopLoss order but the if statement is completely ignored and the SetStopLoss order gets submitted anyways. Does anyone know what the issue is and how I can fix it?
Thank you!

Comment