On the "Backtest" menu, I set "Time in force" = Day (instead of GTC) and I set the Session from 12:00:00AM to 11:59:00PM.
The following is my program that will execute the BuyStop order when the condition met. It would also cancell the order if the triggered buy stop order is not filled for the day. However, I find that the ProfitTarget & StopLoss order is not cancelled automatically when the buy stop order is cancelled due to the "Time in force" triggered.
Shall I use OnOrderUpdate(IOrder order) to cancel it manually(I don't know how to do so) or there is a parameter to set. Pls advise!
protected override void Initialize()
{
SetProfitTarget("Ent", CalculationMode.Ticks, 400);
SetStopLoss("Ent", CalculationMode.Ticks, 400, false);
CalculateOnBarClose = false;
}
protected override void OnBarUpdate()
{
if ("My specific condition here")
{
EnterLongStop(100000, High[0], "Ent");
}
}
Regards,
Toyogo
Comment