NexusFi: Find Your Edge


Home Menu

 





IOrders not firing correctly?


Discussion in NinjaTrader

Updated
    1. trending_up 1,583 views
    2. thumb_up 2 thanks given
    3. group 0 followers
    1. forum 1 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,098

Hey nexusfi.com (formerly BMT) friends,

I am running into a issue with a strategy that is not firing a market order when I want it to. The code scales out of a position based on a signal ("sorry not going to say what it is") multiple times as the trend develops. The same code fires for each trade except sometimes it just does not fire.

(See attached image)


The system goes short 10 CL ##-## (market replay) and scales out a total of 5 contracts in 3 trades just as I wanted it too. However, the fourth trade to scale out 2 more contracts it does not fire. The bars are painted to show when it should be firing and the text Fire 2 is right next to the exitShort logic to show me that the code is running properly.

Here is the code that has the ExitShort syntax.

 
Code
if(Position.Quantity > ShortQty)
	{
	        int newposition = Position.Quantity - ShortQty;
	        //exitShort = ExitShort(newposition);
	        exitShort = ExitShort(newposition,"Buy to Close","Sell to Open");
	        if(exitShort == null)
			{
				DrawText("Qty2","Fire " + newposition,3,Low[0],Color.White) ;
			} else DrawText("Qty2","Not Null",3,Low[0],Color.White) ;	
		}
				
		if(Position.Quantity == 1 && exitShortStop != null && BarsSinceExit() > 1)
		{
			exitShort = ExitShort("Buy to Close","Sell to Open");
		}
          }
if you look at the chart again, you will also see that all my IOrder objects are properly set to null except for the stop, which is expected.

I can't see any logical reason why Ninjatrader is skipping exit logic, so I need your help to see if someone has ran into this before.

FYI, this is using the Managed approach IOrder with on execution.

Cheers,

Sody


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
Second Night of US Strikes Crushes Iran June 15 to 3.6% …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 
SodyTexas's Avatar
 SodyTexas 
Austin TX
 
Experience: Advanced
Platform: Ninjatrader, Python, & R
Broker: RJO
Trading: Futures, Spreads
Posts: 424 since Sep 2013
Thanks Given: 118
Thanks Received: 1,098

SOLVED

Issues with Market Order - NinjaTrader Support Forum

Cheers,

Sody


"The great Traders have always been humbled by the market early on in their careers creating a deep respect for the market. Until one has this respect indelibly engraved in their makeup, the concept of money management and discipline will never be treated seriously."
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:




Last Updated on October 16, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts