View Full Version : Passing period parameter to Add function as a variable
JangoFolly
07-06-2007, 01:51 PM
Hi. I tried to pass an integer value to the Add function to populate the period parameter, but it did not work.
// where my_int is declared as a int variable
my_int = 5;
Add(PeriodType.Minute, my_int);
Is there a way to accomplish the goal of calling Add with a variable value for period, rather than a static constant?
Thank you.
Regards,
William
NinjaTrader_Ray
07-06-2007, 02:01 PM
Provided that the variable value my_int is the value you want prior to using it in the Add() method, this will work.
Try adding a Print(my_int) just before calling the Add() method to ensure the value is initialized as you expect.
gert74
07-08-2007, 06:47 PM
Am I right in assuming that there is no way to use user supplied inputs in the Add method, as they are not available yet when Initialize is called?
NinjaTrader_Ray
07-08-2007, 07:02 PM
You can use user inputs (properties) in the Add() method called within the Initialize() method.
whitmark
07-23-2007, 10:37 AM
Ray,
Could you please clarify your statement:
You can use user inputs (properties) in the Add() method called within the Initialize() method.
Is it possible to pass in a value via parameter inputs, define the period of the Add() method, and then iterate these values via the optimizer in the Strategy Analyzer? It appears the process to pass in this period value works in a Chart and when backtesting, but not during optimization operations. Please confirm.
Regards,
Whitmark
NinjaTrader_Ray
07-23-2007, 10:44 AM
I have never tried that in optimization. If you have and it does not work, then that is current expected behaviour.
whitmark
07-23-2007, 10:59 AM
As you can image, it can be pretty handy to use the optimizer to get a feel for the right combination of multiple timeframes or, for that matter, multiple instruments (enumerated of course) to be used within a strategy. Can we consider this for the enhancement list? Thanks.
Whitmark
NinjaTrader_Ray
07-23-2007, 01:59 PM
Yes, this is already on our list.
MONTERO
08-06-2007, 08:14 AM
Do you know which version and when the ETA is? I am very interested in this.
NinjaTrader_Dierk
08-06-2007, 08:38 AM
Unfortunately there no ETA available yet.
whitmark
05-10-2008, 02:56 PM
Has the ability to pass in the PeriodType and Period Size for a secondary series via a parameter AND allow these parameters to be iterated in the optimizer been considered yet for Version 7? Thanks.
Whitmark
NinjaTrader_Josh
05-10-2008, 04:32 PM
Thanks for the note whitmark. We will put it on the list for considerations.