NinjaTrader Support Forum  
X

Attention!

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


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 05-25-2011, 07:48 PM   #1
gg80108
Senior Member
 
Join Date: Dec 2008
Location: Castle Pines, Co
Posts: 621
Thanks: 1
Thanked 2 times in 2 posts
Default Reset SetStopLoss

SetStopLoss, has a note that says " Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price/offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position "

how do u reset this?
gg80108 is offline  
Reply With Quote
Old 05-25-2011, 09:00 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Thanks for the note.

You can reset this by changing the stop loss value. You can do this with this sample:

http://www.ninjatrader.com/support/f...ead.php?t=3222

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Old 05-26-2011, 09:38 AM   #3
gg80108
Senior Member
 
Join Date: Dec 2008
Location: Castle Pines, Co
Posts: 621
Thanks: 1
Thanked 2 times in 2 posts
Default

So when the position is flat we are just setting the stop loss to be out of range, so when a new order fires it won't possibly be stopped out immediately..
gg80108 is offline  
Reply With Quote
Old 05-26-2011, 02:49 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Yes, that's exactly it.

if (Position.MarketPosition == MarketPosition.Flat)
SetStopLoss(CalculationMode.Ticks, 20);
NinjaTrader_RyanM 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
Reset occam Automated Trading 1 10-29-2010 07:47 AM
SetStopLoss gg80108 General Programming 3 10-11-2010 10:38 AM
How to See the Value of SetStopLoss NinexTim Automated Trading 7 08-04-2010 06:38 AM
SetStopLoss() Lost Trader Strategy Development 4 08-03-2010 02:14 PM
An example for SetStopLoss crunchy General Programming 3 05-09-2010 09:11 AM


All times are GMT -6. The time now is 10:20 PM.