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 07-24-2008, 12:30 AM   #1
laydens
Junior Member
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
Default Unable to get SetTrailStop working in backtest

Hi,
I've been trying to backtest SetTrailStop(), but I have not been able to get it to work. I am using TD ameritrade backtest data (minute only). Any tips?


Here's the basic test code:

protected override void Initialize()
{

SetTrailStop("EnterLong",CalculationMode.Percent,S top,true);
CalculateOnBarClose = true;

}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CCI(14)[0] > MainEntryCriteria && Rising(this.TEMA(20)))
{
EnterLong(DefaultQuantity, "EnterLong");
}

}
laydens is offline  
Reply With Quote
Old 07-24-2008, 01:16 AM   #2
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 debug your strategy as per here:
http://www.ninjatrader-support.com/v...ead.php?t=3418
http://www.ninjatrader-support.com/v...ead.php?t=3627
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
How to monitor SetTrailStop toyogo00 Strategy Development 3 07-22-2008 12:41 AM
Unable to cancel backtest zoltran Historical NinjaTrader 6.5 Beta Threads 5 03-31-2008 09:52 AM
Commissions in SA Backtest not working? ThePatientOne Strategy Analyzer 7 10-22-2007 01:13 PM
SetTrailStop() funk101 Strategy Development 1 04-04-2007 03:39 AM
SetTrailStop() funk101 Strategy Development 8 03-27-2007 07:42 AM


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