NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 06-03-2007, 10:35 AM   #1
suedeuno
Member
 
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default CalculateMode.Percent stop loss gets cancelled

I'm using the simulator version of NT and when I try to use SetStopLoss(CalculateMode.Percent, 2) the stop gets cancelled. If I use one of the other modes the stop will trigger. Why is the percent mode always cancelling?
suedeuno is offline  
Reply With Quote
Old 06-03-2007, 11:18 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Try passing in 0.02 for your percent.
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-03-2007, 11:26 AM   #3
suedeuno
Member
 
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks. So will 0.02 be calculated as 0.02% or 2% ?

Quote:
Originally Posted by NinjaTrader_Ray View Post
Try passing in 0.02 for your percent.
suedeuno is offline  
Reply With Quote
Old 06-03-2007, 11:40 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

That would be 2%.
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-03-2007, 11:58 AM   #5
suedeuno
Member
 
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

Tried it and the stop orders still get cancelled.

I just added it to the MAcrossover template:

protectedoverridevoid Initialize()
{
SMA(Fast).Plots[
0].Pen.Color = Color.Orange;
SMA(Slow).Plots[
0].Pen.Color = Color.Green;
Add(SMA(Fast));
Add(SMA(Slow));
CalculateOnBarClose =
true;
SetStopLoss(CalculationMode.Percent,
0.02);
}
///<summary>
/// Called on each bar update event (incoming tick).
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
{
EnterLong(
"CrossLong");

}
elseif (CrossBelow(SMA(Fast), SMA(Slow), 1))
{
EnterShort(
"CrossShort");
}
}
suedeuno is offline  
Reply With Quote
Old 06-03-2007, 11:10 PM   #6
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-04-2007, 06:31 AM   #7
suedeuno
Member
 
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

I'm using the simulator version of Ninja Trader

Quote:
Originally Posted by NinjaTrader_Dierk View Post
Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.
suedeuno is offline  
Reply With Quote
Old 06-04-2007, 07:05 AM   #8
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Are there any funny messages on the logs?
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-04-2007, 08:51 PM   #9
suedeuno
Member
 
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
Default

Not that I can see.

There is a log entry stating Automated trading is disabled. But that shouldn't have affected the backtest since the other stop modes trigger.


Quote:
Originally Posted by NinjaTrader_Dierk View Post
Are there any funny messages on the logs?
suedeuno is offline  
Reply With Quote
Old 06-04-2007, 11:18 PM   #10
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

May be the stop gets cancelled as your strategy tries to enter on the other side and closes the opposite position plus cancels the associated stop order (expected).
NinjaTrader_Dierk 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
I'm getting the stop loss error again... funk101 Strategy Development 2 05-08-2007 11:30 PM
Stop Loss Orders activated by number of trades past stop level DoveforUsAll Suggestions And Feedback 1 02-08-2006 01:19 AM
stop loss feature QQQ Suggestions And Feedback 2 09-01-2005 12:04 AM
Stop Loss Size JohnnyB Suggestions And Feedback 0 07-21-2005 04:04 AM
Initial stop loss meyer99 ATM Strategies (Discretionary Trading) 1 04-26-2005 12:45 PM


All times are GMT -6. The time now is 07:02 PM.