![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Location: Castle Pines, Co
Posts: 621
Thanks: 1
Thanked 2 times in 2 posts
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
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.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2008
Location: Castle Pines, Co
Posts: 621
Thanks: 1
Thanked 2 times in 2 posts
|
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..
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Yes, that's exactly it.
if (Position.MarketPosition == MarketPosition.Flat) SetStopLoss(CalculationMode.Ticks, 20);
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |