I have a basic strategy and for some reason my order remains when I disable the strategy. I'm sure this is not normal? Here is my code. I should also add I have tried changing liveuntilcancelled = false also which has the same outcome. When I eable to strategy aagin it's at this point whe the pre-existing order is cancelled and the new order for the now enabled strategy is placed.
protected override void Initialize()
{
IncludeCommission = true;
ExitOnClose = true; // Cancel all orders & open positions at end of session.
ExitOnCloseSeconds = 1800; // Cancel all orders & open positions 1800 seconds (30 min) before end of session.
TraceOrders = true; // Display order information in Output window for debugging.
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// At the start of a new session
if (Bars.SessionBreak)
{
// Reset the priorTrade variable
priorTrade = 0;
}
// First, we need to make sure we are flat before entering a trade.
if (Position.MarketPosition == MarketPosition.Flat)
{
if (entryOrder == null)
{
if (CurrentDayOHL().CurrentLow[0] >= Combo(3).CHM2[0]
&& priorTrade != Combo(3).CHM2[0])
{
entryOrder = EnterLongLimit(0, true, 1, Combo(3).CHM2[0], "long entry");
barNumberOfOrder = CurrentBar;
//Print("");
}
}
}
}
Regards,
suprsnipes

Comment