NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 11-15-2008, 12:27 AM   #1
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default Disabling stop loss

Hi there,

I'm trading a multi-day strategy that looks at intraday bars.

I have a SetStopLoss() set as part of my initialize(). However, I'd like to temporarily disable any stop losses during the first bar (30 minute bars) of each session... to avoid being taken out by any temporary gap downs.

Do I need to fake it with a SetStopLoss(Price, 0); ...? I imagine there's a call out there that I can call to temporarily cancel any stop orders...
heech is offline  
Reply With Quote
Old 11-15-2008, 07:39 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

Hi,

There is no way to disable the submission of stops via the SetStopLoss() method. The only thing you could do is move them to a price far enough away from the market.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-15-2008, 09:25 AM   #3
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Ray,

I guess I'll have to do that. SetStopLoss() with a price at close to zero. I have a few followup questions.

1) What happens programatically if the order is rejected by the broker as being too far from the current price? What gets called in my application?

2) With other automated systems I've traded in the past, I've actually had issues with getting stop orders submitted at the beginning of the day. At 4 PM the previous day, the exchange cancels all day stop orders. And some brokers seem to cancel any newly submitted stop orders (for the open of market) overnight.

Do you know how NinjaTrader handles stop orders for the first bar of the session? (If it matters, this would be with TDAmeritrade.) Are stop orders submitted GTC, so never canceled? If I modify the stop order's price at the close of session the previous day... what if it gets caught at 4:00 - 4:20 PM and never submitted? When would the exchange actually take action?

Some of this I know I'll figure out as I actually deploy, but if anyone has expertise on how stop orders work in reality...that would be great. Again, my concern is effectively making sure my stop order will *not* be hit (under any condition) the first bar of the next session.
heech is offline  
Reply With Quote
Old 11-15-2008, 09:32 AM   #4
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by heech View Post
1) What happens programatically if the order is rejected by the broker as being too far from the current price? What gets called in my application?
Just to answer my own question on this point.. .this sample referenced in another thread goes a long way towards explaining that:

http://www.ninjatrader-support2.com/...ead.php?t=5790
heech is offline  
Reply With Quote
Old 11-15-2008, 02:43 PM   #5
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

We will reply on item #2 on Monday.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-17-2008, 07:39 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

2) When you run your strategy you have the option to choose what time in force setting you want to use for your orders. http://www.ninjatrader-support.com/H...meInForce.html

NinjaTrader handles all bars of the session. If you want something to happen on the first bar immediately I would recommend using CalculateOnBarClose = false. This way you can process at every single incoming tick. Also, if you have ExitOnClose set NinjaTrader will cancel your orders at the end of your trading session. http://www.ninjatrader-support.com/H...itOnClose.html
NinjaTrader_Josh 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
stop loss, trailing stop modification in NT6 alfie Strategy Development 1 03-26-2008 03:46 PM
Create a parked STOP order with simple stop loss skynetman Strategy Development 3 03-14-2008 12:36 AM
Disabling Snap to OHLC in one pane Lost Trader Indicator Development 1 12-21-2007 05:02 PM
Order Entry Property: Use stop market for stop loss orders higler SuperDOM and other Order Entry Windows 7 07-02-2007 09:06 AM
Stop Loss Orders activated by number of trades past stop level DoveforUsAll Suggestions And Feedback 1 02-08-2006 01:19 AM


All times are GMT -6. The time now is 06:53 PM.