I'm opening a position of 3 contracts. I'm sending 3 orders because I want to scale out. All 3 contracts have the same Stop Loss with 3 different targets:
if (LONG_CONDITION) {
SetStopLoss("Long1", CalculationMode.Ticks , stop1Ticks, false);
SetProfitTarget("Long1", CalculationMode.Ticks, target1Ticks);
SetStopLoss("Long2", CalculationMode.Ticks, stop1Ticks, false);
SetProfitTarget("Long2", CalculationMode.Ticks, target2Ticks);
SetStopLoss("Long3", CalculationMode.Ticks, stop1Ticks, false);
SetProfitTarget("Long3", CalculationMode.Ticks, target3Ticks);
entryOrder = EnterLong(DefaultQuantity, "Long1");
entryOrder = EnterLong(DefaultQuantity, "Long2");
entryOrder = EnterLong(DefaultQuantity, "Long3");
}
Now, I'm struggling to update the stops when the first target is hit.
When the first target is hit, I want to move the stops for Long2 and Long3 to Breakeven.
Can anybody give me a quick code for the OnExecution function to do that?
How do I identify which order was filled??
Thanks for any help!
Comment