PDA

View Full Version : strategy stops.


junkone
06-02-2009, 08:44 AM
my code checks the price before sendng a market or a stop order. however there can be race situations and what i find is that i get error from NT
Native error='Sell stop or sell stop limit orders can't be placed above the market

and the strategy shuts down closing my positions. how do i avoid it.

NinjaTrader_Josh
06-02-2009, 08:58 AM
There is little that can be done except to move your stops farther away. This is the nature of electronic trading. It takes time for your order to traverse across the internet and by the time your brokerage receives and processes it, the market price could have moved in a direction that could cause your order to be rejected.

All you can try to do to help reduce these scenarios is to minimize the internet latency between you and your brokerage/exchange.

junkone
06-02-2009, 09:03 AM
its a buy stop to enter. why should the strategy stop when the buy stop cannot be accepted. this is riticulous.
in a automated strategy, i dont want it to halt unless i want it to halt.
additionally, why does the strategy fill when the stop price inspire of the error and NT automatically close the trade. its a wasted trade .

Additional clarification:
If i goto tws and enter a stop price below the market price, it will accept. why is NT creating all of this rules which the broker does not enforce.

NinjaTrader_Josh
06-02-2009, 09:10 AM
It halts because NinjaTrader does not know what your strategy wants to do next. For the most part, people do not program contingent plans when an order is rejected and as such to prevent drastic problems downstream, the strategy is defaulted to halt immediately. If you feel you have programmed your strategy in a way that would handle everything the way you want you can turn off error handling, but you will be doing so at your own risk.

http://www.ninjatrader-support.com/HelpGuideV6/RealtimeErrorHandling.html

NT closes the position because it is the safest thing to do. Leaving an unprotected position at the exchange is the last thing NT wants to do. The stance we take is to minimize damages. If you want otherwise, please turn off error handling and program your own ways to deal with problems your strategy may encounter.

NT is not making any rule. A stop order below the market will be accepted, even from within NT.

junkone
06-02-2009, 09:42 AM
where would the real errors or exceptions be stored. the link you haev proivded only shows how to handle when a order status changes. it does not show where the errors or exceptions are stored for me to analyse and handle appropriately.

NinjaTrader_Josh
06-02-2009, 10:02 AM
That is exactly how you do it. Order rejected, therefore do something.

junkone
06-02-2009, 10:21 AM
i would not know all the reasons why the order is rejected. my order handling would depend on the reasons why the order got rejcted. to do that i need to know why NT got a order rejected error or exception. where do i get it.

NinjaTrader_Josh
06-02-2009, 10:36 AM
Not available. You can try parsing it from the logs.

junkone
06-02-2009, 11:30 AM
common josh. pl dont make me run chasing wild gooses. somewhere somehow, NT can access the error. whether it is undocumented or not, i will use it at my own risk. but i need some one to give me a hint as to where to look.

NinjaTrader_Josh
06-02-2009, 11:39 AM
junkone,

Unfortunately it is not available.