NinjaTrader Support Forum  

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-07-2009, 01:50 PM   #1
sharkie
Junior Member
 
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default Setting optimization parameters

Hi,

I created my own strategy and would like to optimize it. I want to know how to create optimization paramters for the auto optmizer to pick up and test for me.

Thanks,

Sharkie
sharkie is offline  
Reply With Quote
Old 12-07-2009, 02:01 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

Sharkie,

All you have to do is create a normal parameter for your strategy like how you would make any other parameter. You can see SampleMACrossOver for examples of parameters. Then when you are using the Strategy Analyzer, just choose Optimize and it will handle the rest in allowing you to select a range to use.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-07-2009, 02:24 PM   #3
sharkie
Junior Member
 
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
Sharkie,

All you have to do is create a normal parameter for your strategy like how you would make any other parameter. You can see SampleMACrossOver for examples of parameters. Then when you are using the Strategy Analyzer, just choose Optimize and it will handle the rest in allowing you to select a range to use.
All the parameters in my strategy are hard coded, I change the value in the code in order to alter them. Do I use the Add() function for them appear as parameters on the optimizer set up screen ?
sharkie is offline  
Reply With Quote
Old 12-07-2009, 03:31 PM   #4
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

No, add is only for adding indicators or bar objects. Please see SampleMACrossOver and see how they created the Fast and Slow parameters. Pay attention to the Variables region and Properties regions of the code.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-08-2009, 02:58 PM   #5
sharkie
Junior Member
 
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

I tried and I still don't get Paramters to appear in the config table. this is the code I created which I expected should trigger the parameters table to show.Please let me know if there is anything more I should do


#region Properties

[Description("MACD Long Signal Entry")]
[Category("Parameters")]
public double MACD_Long
{
get { return MACD_long; }
set { MACD_long = Math.Max(1, value); }
}

/// <summary>
/// </summary>
[Description("MACD Long signal exit")]
[Category("Parameters")]
public double MACD_Long_Exit
{
get { return MACD_long_exit; }
set { MACD_long_exit = Math.Max(1, value); }
}
#endregion
sharkie is offline  
Reply With Quote
Old 12-09-2009, 07:12 AM   #6
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

You need to pay special attention to what is capitalized and what is not. Notice how in the SMA indicator there are variables in the Properties region that are not capitalized and some that are. Notice how the uncapitalized ones have a corresponding line of code in the Variables region of the code.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-09-2009, 07:45 AM   #7
sharkie
Junior Member
 
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

That is exactly what I did .First defined them in the Variables section and then using them in the Parameters section.Can I send you privatly the full code for you to review,I think I am missing out on something very simple here. This is the only think missing for me to start optimizing.
sharkie is offline  
Reply With Quote
Old 12-09-2009, 08:09 AM   #8
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

You can send in an email to support [at] ninjatrader [dot] com. Please be sure you put a link to this thread in the email along with Attn: Josh in it. Thank you.
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
Optimization skat100 Automated Trading 1 09-02-2009 07:18 AM
Error Log setting up parameters stefy Strategy Development 1 06-23-2009 09:10 AM
When optimization is too much optimization cunparis Strategy Development 2 11-28-2008 12:48 AM
Number of optimization parameters Sidhartha Strategy Development 1 04-16-2008 12:01 PM
Setting EntryHandling || EntriesPerDirection From Program Overridden by BackTest Parameters KBJ Strategy Analyzer 4 05-01-2007 07:24 AM


All times are GMT -6. The time now is 10:34 PM.