An Exit() method to submit an exit order at '4/29/2010 12:00:00 PM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
I've searched but can't grok what I'm doing wrong.
protected override void OnBarUpdate()
{
//==================================================
//----Setup local variables
//==================================================
bool InTrade = MarketPosition.Flat != Position.MarketPosition;
bool ShortTrade = MarketPosition.Short == Position.MarketPosition;
bool LongTrade = MarketPosition.Long == Position.MarketPosition;
if (!Forex)
{
OneTick = TickSize;
OneTickDollar = TickSize * Instrument.MasterInstrument.PointValue;
}
else
{
OneTick = TickSize * 10;
OneTickDollar = TickSize * Instrument.MasterInstrument.PointValue * 10;
}
//==================================================
//==================================================
//----Cancel limit orders
//==================================================
if (CurrentBar - BarCounter > EnterBarsSinceDot && LimitOrder != null && !InTrade)
CancelOrder(LimitOrder);
if (!InTrade && StopOrder != null)
{
CancelOrder(StopOrder);
LastStop = -1;
}
//==================================================
//==================================================
//----Long Entry
//==================================================
if ((!TrendStrengthConfirm || (TrendStrengthConfirm && BDTtrendStrength().Strength[0] > StrengthThreshold)) &&
(!BDTTrendConfirm || (BDTTrendConfirm && BDTTrend().BDTtrend[0] > 0)) &&
(!MarketSentimentConfirm || (MarketSentimentConfirm && USMktSentiment2(MktSentimentLength).Val3[0] < Close[0])))
{
if (PrimaryEntry && !InTrade)
{
if (BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).Primary_SE[0] > 0)
{
EnterShort("SE-Primary");
EntryName = "SE-Primary";
}
}
if (SecondaryEntry && !InTrade)
{
if (BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).Strike_LE[0] > 0)
{
if (SecondaryEntryMarket)
{
EnterLong("LE-Sec-Market");
EntryName = "LE-Sec-Market";
}
else
{
BarCounter = CurrentBar;
LimitOrder = EnterLongLimit(0,true,DefaultQuantity,Low[0]+SecEntryMoveOffset*OneTick,"LE-Sec-Limit");
EntryName = "LE-Sec-Limit";
}
}
}
}
//==================================================
//==================================================
//----Short Entry
//==================================================
if ((!TrendStrengthConfirm || (TrendStrengthConfirm && BDTtrendStrength().Strength[0] > StrengthThreshold)) &&
(!BDTTrendConfirm || (BDTTrendConfirm && BDTTrend().BDTtrend[0] < 0)) &&
(!MarketSentimentConfirm || (MarketSentimentConfirm && USMktSentiment2(MktSentimentLength).Val3[0] > Close[0])))
{
if (PrimaryEntry && !InTrade)
{
if (BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).Primary_SE[0] > 0)
{
EnterShort("SE-Primary");
EntryName = "SE-Primary";
}
}
if (SecondaryEntry && !InTrade)
{
if (BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).Strike_SE[0] > 0)
{
if (SecondaryEntryMarket)
{
EnterShort("SE-Sec-Market");
EntryName = "SE-Sec-Market";
}
else
{
BarCounter = CurrentBar;
LimitOrder = EnterShortLimit(0,true,DefaultQuantity,High[0]-SecEntryMoveOffset*OneTick,"SE-Sec-Limit");
EntryName = "SE-Sec-Limit";
}
}
}
}
//==================================================
//==================================================
//----Yellow Dot Exit
//==================================================
if (YellowDotExits && InTrade)
{
if (CloseOfBarExit)
{
if (LongTrade && BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).LX[0] > 0)
ExitLong("LX-YellowDot-Mkt",EntryName);
if (ShortTrade && BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).SX[0] > 0)
ExitShort("SX-YellowDot-Mkt",EntryName);
}
else
{
if (LongTrade && BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).LX[0] > 0)
{
if (StopOrder != null)
CancelOrder(StopOrder);
StopOrder = ExitLongLimit(0,true,DefaultQuantity,High[0]-DotExitMinMoveOffset*OneTick,"LX-YellowDot-Limit",EntryName);
}
if (ShortTrade && BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).SX[0] > 0)
{
if (StopOrder != null)
CancelOrder(StopOrder);
StopOrder = ExitShortLimit(0,true,DefaultQuantity,Low[0]+DotExitMinMoveOffset*OneTick,"SX-YellowDot-Limit",EntryName);
}
}
}
//==================================================
//==================================================
//----Stop Level Exits
//==================================================
if (StopLevelExits && InTrade)
{
double StopLevHigh = BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).StopLevHigh[0];
double StopLevLow = BDTShowMe(false,MktSentimentLength,true,true,StopLevelStrength,true,-1000).StopLevLow[0];
if (LongTrade && StopLevLow != 0)
{
if (StopOrder != null)
CancelOrder(StopOrder);
StopOrder = ExitLongStop(0,true,DefaultQuantity,StopLevLow-StopMinMoveOffset*OneTick,"LX-StopLevel",EntryName);
LastStop = StopLevLow;
}
if (ShortTrade && StopLevHigh != 0)
{
if (StopOrder != null)
CancelOrder(StopOrder);
StopOrder = ExitShortStop(0,true,DefaultQuantity,StopLevHigh+StopMinMoveOffset*OneTick,"SX-StopLevel",EntryName);
LastStop = StopLevHigh;
}
}
//==================================================
//==================================================
//----Max Target / Stop
//==================================================
SetStopLoss(CalculationMode.Ticks,MaxStopLoss*OneTickDollar);
SetProfitTarget(CalculationMode.Ticks,MaxTarget*OneTickDollar);
//==================================================
}

Comment