I have looked thru these forums extensively to no avail.
I would like to have two separate entries, each with separate profit targets and stoploss. so in Intialize i declare
SetStopLoss("Long1", CalculationMode.Ticks, _longStoplossTicks, false);
SetStopLoss("Long2", CalculationMode.Ticks, _longStoplossTicks, false);
SetProfitTarget("Long1", CalculationMode.Ticks, _myLProfitTarget);
SetProfitTarget("Long2", CalculationMode.Ticks, _myLProfitTarget2);
Then in OnBarUpdate I enter the positions with
EnterLong(_contracts, "Long1");
EnterLong(_contracts, "Long2");
Here is where I am stuck
I need to move the stoploss "Long2", after the Long1 target is hit, to the price that the "Long1" was placed at.
In other words, I would like to enter both Long1 and Long2 at the same price. When Long1 target is hit, move the stop on Long2 to Breakeven.
I can do this in OnExecution to get the price for the Long1 entry
if (execution.Order != null && execution.Order.Name == "Long1")
MyStopLossLong = execution.Price;
but may I do this as well in OnExecution?
SetStopLoss("Long2", CalculationMode.Price, execution.Price, false);
or does this need to be resubmitted for every tick In OnBarUpdate?

Comment