![]() |
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: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
|
hello
i have a strategy of stop loss of 1.5 atr. in the code below i get error 10/12/2008 5:53:28 AM Order Sell stop or sell stop limit orders can't be placed above the market. Affected Order: Sell 9962 Stop @ 1.0747 the runtime ATR value is .0038. 10/12/2008 5:53:29 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ZLR' Mode=Ticks Value=0.00380578851165889 Currency=0 Simulated=False need to implement logicATR value 0.00380578851165889 10/12/2008 5:53:29 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ZLR' Mode=Ticks Value=0.00380578851165889 Currency=0 Simulated=False 10/12/2008 5:53:29 AM CancelAllOrders: BarsInProgress=0 Code:
privatevoid setupStops(){
Print("need to implement logic" + "ATR value " + ATRValue);
SetStopLoss(SIGNALZLR,CalculationMode.Ticks,ATRValue,false);
//entryOrder.
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
|
Hi junkone,
Please check out this reference sample dealing with StopLoss and ProfitTarget modifications - http://www.ninjatrader-support2.com/...ead.php?t=3222 Also the SetStopLoss() expects the offset to be entered in ticks (with CalculationMode.Ticks), so please make sure this works out to the stoplevel you expected.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
|
i have read it quite a bit and need more clarity.
the instrument in this case if AUDUSD and its tick value if .0001 and a buy price of 1.0747. am trying to set a stop loss of .0036 from my purchase price and to be expressed in ticks. so should the function call read SetStopLoss(SIGNALZLR,CalculationMode.Ticks,36 ,false); or should it read SetStopLoss(SIGNALZLR,CalculationMode.Ticks,.0036 ,false); |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
The first one with 36.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
|
how do i cancel the stop loss order?
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
|
Hi junkone,
The StopLoss order will be automatically cancelled if the position is closed by another order. You can also look into the CancelOrder() method - http://www.ninjatrader-support.com/H...ncelOrder.html
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Going from a Stop Loss to a Trailing Stop within a strategy | Sidhartha | Strategy Development | 28 | 03-24-2009 03:11 PM |
| Muliti enter strategy stop loss problem. | Czarek | Strategy Development | 1 | 08-19-2008 12:11 PM |
| Profit factor of a strategy - stop loss advice? | stefy | Strategy Development | 3 | 05-09-2008 12:37 PM |
| Stop loss strategy question | alanack | General Programming | 5 | 04-25-2008 09:55 AM |
| Strategy Cancels Stop Loss when Exiting??? | wayneFH | Strategy Development | 5 | 04-07-2008 10:03 AM |