NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 08-20-2012, 12:31 PM   #1
andriuking
Junior Member
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Why my stop didnīt execute?

Hello.

In first time, sorry for my English level, itīs some bad.

I have the next problem: in my strategy I enter on market with long position on day 16 bar. You can see the picture:



EnterLong(DefaultQuantity, "Pos_Long");
stoplevel_alcista = Low[2]-filtro;
EnterShortStop(DefaultQuantity,stoplevel_alcista," Pos_Short");

Long order is executed the previous day with BarOnClose active, so is executed on day 16 open at 46.26, itīs ok. Also, a stop reverse order is executed at same time at 44.56. I supose than stop order is not ejecuted at 16 day because both orders are evaluated at same time (Iīm not sure), but I didnīt understand why stop executes on bar 18 and not in bar 17.

Could someone explains me where I mistaking?

Thanks

Regards,

Andres
andriuking is offline  
Reply With Quote
Old 08-20-2012, 12:50 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello andriuking,
Welcome to the forum and I am happy to assist you.

You have used Enter() method to place your stop order which will be rejected by the internal order handling rules. To place a stop please use the ExitLongStop method. Please refer to our help guide to know more
http://www.ninjatrader.com/support/h...itlongstop.htm

Also I would suggest to append the code TraceOrders = true, in the Initialize section of your code. This will provide you with the exact reasons for any internal order rejection. Please refer to this post for more debugging tips
http://www.ninjatrader.com/support/f...ead.php?t=3418
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-20-2012, 01:58 PM   #3
andriuking
Junior Member
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Joydeep for your suport!

Quote:
Originally Posted by NinjaTrader_Joydeep View Post

You have used Enter() method to place your stop order which will be rejected by the internal order handling rules. To place a stop please use the ExitLongStop method. Please refer to our help guide to know more
http://www.ninjatrader.com/support/h...itlongstop.htm
I donīt want a stop, I want reverse the order at this stop price, so I use EnterShortStop(), is not right? how can I do it?

I will check the information you provides me.

Thanks
andriuking is offline  
Reply With Quote
Old 08-20-2012, 04:54 PM   #4
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Please provide us with the TraceOrders output and we can help you determine exactly what is occurring and give you steps to resolve.

I look forward to assisting you further.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-21-2012, 09:44 AM   #5
andriuking
Junior Member
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Matthew View Post
Please provide us with the TraceOrders output and we can help you determine exactly what is occurring and give you steps to resolve.



Thanks
andriuking is offline  
Reply With Quote
Old 08-21-2012, 10:52 AM   #6
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello andriuking,
The internal order handling rules are rejecting the orders. To know exact reason please append the below code in the Initialize section of the code.

Code:
TraceOrders = true;
http://www.ninjatrader.com/support/h...raceorders.htm

You can get the messages in the output window (In Control Center menu bar click on Tools>Output Window).

Please provide us the TraceOrders output so that we can determine the exact reason for the order rejection.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-22-2012, 12:20 PM   #7
andriuking
Junior Member
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default

I only put until 26/01/2007 because is too long.

Appears that comment at 16, when orders dont execute: "**NT** A SellShort stop order placed at '16/01/2007 20:30:00' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy."



15/01/2007 20:30:00 Entered internal PlaceOrder() method at 15/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
15/01/2007 20:30:00 Entered internal PlaceOrder() method at 15/01/2007 20:30:00: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName='' FromEntrySignal=''
15/01/2007 20:30:00 Ignored PlaceOrder() method: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName='' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'
16/01/2007 20:30:00 Entered internal PlaceOrder() method at 16/01/2007 20:30:00: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName='Pos_Short' FromEntrySignal=''
**NT** A SellShort stop order placed at '16/01/2007 20:30:00' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.
16/01/2007 20:30:00 Ignored PlaceOrder() method at 16/01/2007 20:30:00: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName=Pos_Short' FromEntrySignal='' Reason='Invalid order price, please see log tab'
17/01/2007 20:30:00 Entered internal PlaceOrder() method at 17/01/2007 20:30:00: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName='Pos_Short' FromEntrySignal=''
18/01/2007 20:30:00 Entered internal PlaceOrder() method at 18/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
18/01/2007 20:30:00 Ignored PlaceOrder() method at 18/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
19/01/2007 20:30:00 Entered internal PlaceOrder() method at 19/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
19/01/2007 20:30:00 Ignored PlaceOrder() method at 19/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
22/01/2007 20:30:00 Entered internal PlaceOrder() method at 22/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
22/01/2007 20:30:00 Ignored PlaceOrder() method at 22/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
23/01/2007 20:30:00 Entered internal PlaceOrder() method at 23/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
23/01/2007 20:30:00 Ignored PlaceOrder() method at 23/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
24/01/2007 20:30:00 Entered internal PlaceOrder() method at 24/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
24/01/2007 20:30:00 Ignored PlaceOrder() method at 24/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
25/01/2007 20:30:00 Entered internal PlaceOrder() method at 25/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
25/01/2007 20:30:00 Ignored PlaceOrder() method at 25/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
26/01/2007 20:30:00 Entered internal PlaceOrder() method at 26/01/2007 20:30:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Pos_Long' FromEntrySignal=''
26/01/2007 20:30:00 Ignored PlaceOrder() method at 26/01/2007 20:30:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=0 SignalName=Pos_Long' FromEntrySignal='' Reason='Invalid order price, please see log tab'
Last edited by andriuking; 08-22-2012 at 12:24 PM.
andriuking is offline  
Reply With Quote
Old 08-22-2012, 12:30 PM   #8
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello andriuking,
Thanks for the information.

A sell stop order must be equal or less than the last traded price. If not, the sell stop order will be rejected.

Please edit your strategy and make sure the stop price is less than the last traded price.

Quote:
16/01/2007 20:30:00 Entered internal PlaceOrder() method at 16/01/2007 20:30:00: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName='Pos_Short' FromEntrySignal=''
**NT** A SellShort stop order placed at '16/01/2007 20:30:00' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.
16/01/2007 20:30:00 Ignored PlaceOrder() method at 16/01/2007 20:30:00: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=44,56 SignalName=Pos_Short' FromEntrySignal='' Reason='Invalid order price, please see log tab'
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-22-2012, 01:17 PM   #9
andriuking
Junior Member
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default

I understand now... So it executes at 18 bar (because the 17 bar closes over the order price) and donīt executes at 17 (because the 16 bar close below the order price).

Thanks very mucha for your help!
andriuking is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute EntryOrder Stephan123 Strategy Development 2 02-05-2012 04:44 PM
stop loss & profit target orders get activated only after buy stop order is execute clearpicks Automated Trading 1 07-21-2010 06:18 AM
Version 6 does not execute ts_gordo Installation and Licensing 12 08-25-2009 01:49 PM
can't get stop losses or profit targets to execute leemiles Strategy Development 9 11-04-2008 08:56 AM
NT, why didn't this execute? beauw Automated Trading 8 10-17-2008 08:14 AM


All times are GMT -6. The time now is 08:41 PM.