Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit() method has been ignored

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exit() method has been ignored

    I'm getting the following error when I try an execute ExitStop orders:

    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.


    Code:
    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);
    	//==================================================
    }

    #2
    Hello,

    Is this an example of what you are having issues with?
    ExitLong("LX-YellowDot-Mkt",EntryName);

    It looks like you have the ExitLong() parameters messed up:


    Specifically, you have two signal names...it looks like.
    DenNinjaTrader Customer Service

    Comment


      #3
      Hey Ben

      Thanks for the reply. That's weird because that's the only thing that was working. What I ended up finding was when you start handling orders, cancelling them and what-not, "SetStopLoss" and "SetProfitTarget" conflict with that. So I just replaced those two function calls with Limit and Stop orders and that fixed it.

      Zach

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X