NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 04-22-2011, 06:53 PM   #1
daqu40
Junior Member
 
Join Date: Apr 2008
Posts: 27
Thanks: 0
Thanked 0 times in 0 posts
Default Programmatic access to Parameters list

Hi Folks, I've been trying to figure this out for several days and haven't had any luck.

I'm trying to get a list of my Parameters at run time (use on first bar routine in OnBarUpdate) so I can store the values in a data base. I want to do this so I can reuse the same technique with multiple strategies and keep a generic database of the parameters and let NT generate the appropriate SQL on the fly instead of having to rewrite it myself every time a change a parameter.

Clearly NT does this since we can give the Parameters values in Backtest, Optimize and Walkforward.

I've tried various things around the Category attribute. Any ideas?

Thanks!
daqu40 is offline  
Reply With Quote
Old 04-23-2011, 10:19 AM   #2
VTtrader
Senior Member
 
Join Date: Feb 2008
Location: www.integratedtradingtech.com
Posts: 270
Thanks: 1
Thanked 80 times in 64 posts
Default

You could try something like this.

Code:
 
IndicatorBase[] ib = ChartControl.Indicators;
foreach (var item in ib)
{
    Print(item.ToString());
}
That will print each indicator on the chart to the output screen in this form:
EMA(Typical of TF 06-11 (4 Range),34)
MACD(TF 06-11 (4 Range),12,26,9)

You would have to add the code you need in the foreach loop to store item.ToString() where you want it.

BTW, putting it in OnStartUp() would be a better place than a routine in OnBarUpdate().

Hope this helps.

VT
VTtrader is offline  
Reply With Quote
Old 04-23-2011, 12:04 PM   #3
daqu40
Junior Member
 
Join Date: Apr 2008
Posts: 27
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks VT,

This got me on the right track.

What I needed was:

foreach(Parameter p in Parameters)
{
Print(p.Name);
}

Seems I got sidetracked by Attributes.

Thanks also for the OnStartUp() tip. Turns out this is the event I really needed.
daqu40 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
Different parameters for different instruments in a backtest on a list adamus Version 7 Beta General Questions & Bug Reports 18 05-05-2010 11:24 AM
Access Instrument List TraderGuy General Programming 1 12-26-2008 04:01 PM
Programmatic access to account value? andrewbee General Programming 1 12-09-2008 12:47 PM
Programmatic access to actual positions? heech General Programming 1 12-04-2008 11:50 PM
Programmatic Access to all Power Volume Indicators Forex Ninja Suggestions And Feedback 1 05-21-2007 08:24 AM


All times are GMT -6. The time now is 05:27 AM.