NinjaTrader Support Forum  
X

Attention!

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


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 12-10-2008, 04:03 AM   #1
junkone
Senior Member
 
Join Date: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
Default Strategy stop loss

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.
}
why is this code not firing a top which is .0038 away from my entry price
junkone is offline  
Reply With Quote
Old 12-10-2008, 06:25 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
Default

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.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 12-10-2008, 08:54 AM   #3
junkone
Senior Member
 
Join Date: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
Default

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);
junkone is offline  
Reply With Quote
Old 12-10-2008, 09:08 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

The first one with 36.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-10-2008, 06:15 PM   #5
junkone
Senior Member
 
Join Date: Sep 2008
Posts: 356
Thanks: 1
Thanked 1 time in 1 post
Default how to cancel the stop loss

how do i cancel the stop loss order?
junkone is offline  
Reply With Quote
Old 12-11-2008, 04:07 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
Default

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
NinjaTrader_Bertrand 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
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


All times are GMT -6. The time now is 03:21 PM.