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 06-24-2008, 10:08 PM   #1
ooppie
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default How to use SetStopLoss with pecentage?

I used SetStopLoss with the ticks mode in my strategy and it worked in backtesting e-mini future contracts.

However, when I change to either price or percentage mode, the stop loss order did not seem to be placed.

Does the price or percentage mode work for future contracts? I must add that I enter at the same timeframe but exit at a longer timeframe:

From 1 min:
EnterShort(0, firstHalf, "FirstHalf");

From 15 min:
ExitShort(0, firstHalf, "ExitFirstHalf", "FirstHalf");

Seperately, if I enter two orders for scaling out, should I call SetStopLoss once without specifying the signal name or call it twice:

SetStopLoss(CalculationMode.Price, 1321);

or

SetStopLoss("FirstHalf", CalculationMode.Price, 1321, false);
SetStopLoss("SecondHalf", CalculationMode.Price, 1321, false);

Thanks!
Last edited by ooppie; 06-24-2008 at 10:26 PM.
ooppie is offline  
Reply With Quote
Old 06-24-2008, 10:29 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

For scaling out this reference sample may be of use: http://www.ninjatrader-support.com/v...ead.php?t=3751

In terms of CalculationModes they should all work. Please see the Control Center logs for any messages. Also please use TraceOrders = true to debug the orders. I suspect maybe they are getting cancelled via invalid stop price? TraceOrders will tell you in the Output Window if this is the case.
NinjaTrader_Josh 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
SetStopLoss Question... fxRichard Automated Trading 3 06-02-2008 04:50 PM
SetStopLoss thepcmd Strategy Development 2 12-01-2007 01:14 PM
SetStopLoss() and SetProfitTarget() SamIam Strategy Development 9 09-05-2007 08:49 PM
SetStopLoss Question aethelwulf General Programming 3 07-03-2007 04:00 PM
setstoploss order from TS 8.1 ppreal Automated Trading 15 12-20-2006 07:46 AM


All times are GMT -6. The time now is 08:56 PM.