![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
|
Hi everyone
I want to apply a stop loss using the ATR(14). I wrote the following code: // Condition set Long Stop Loss if (Close[0] < (Position.AvgPrice - ATR(14)[0]) && Position.MarketPosition == MarketPosition.Long) { ExitLong("STOPLOSS", "BUY"); } Problem is, the stop loss never kicks in! Any advice? Thank you |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
|
Hi Stefy,
Is "BUY" the same "fromentrysignal" used in the EnterLong() function? If not, that would cause the problem you are seeing... |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can't get stop losses or profit targets to execute | leemiles | Strategy Development | 9 | 11-04-2008 08:56 AM |
| Stop losses | lgarcia3 | Strategy Development | 1 | 04-12-2008 08:00 AM |
| Stop losses on Positions from limit orders | BenHeaton | Strategy Development | 5 | 03-04-2008 11:41 AM |
| Stop Losses not working? | zoltran | General Programming | 2 | 11-08-2007 04:00 AM |
| Stop Loss Orders activated by number of trades past stop level | DoveforUsAll | Suggestions And Feedback | 1 | 02-08-2006 01:19 AM |