Is there any way to programmatically access (or modify) the parameters within "time frame", in the back-testing menu? For back-testing, I'd love to be able to just select a specific time period (see: earlier question about enum) instead of having to type everything in by hand, every tmie.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Setting "begin" and "end" dates programmatically?
Collapse
X
-
Setting "begin" and "end" dates programmatically?
Hi,
Is there any way to programmatically access (or modify) the parameters within "time frame", in the back-testing menu? For back-testing, I'd love to be able to just select a specific time period (see: earlier question about enum) instead of having to type everything in by hand, every tmie.Tags: None
-
Once you set the session times, it will use the same sessions times when you run the backtest again.
It keeps the same sessions times until you shut down NinjaTrader. Then when you boot up NinjaTrader, it will use the default session times.
-
I iterate through a number of different backtesting periods... and would like to automate that, instead of punching it in by hand.Originally posted by mgbloomfield View PostOnce you set the session times, it will use the same sessions times when you run the backtest again.
It keeps the same sessions times until you shut down NinjaTrader. Then when you boot up NinjaTrader, it will use the default session times.
Comment
-
In that case, leave the default session times as 12:00:00 AM and 12:00:00 AM.Originally posted by heech View PostI iterate through a number of different backtesting periods... and would like to automate that, instead of punching it in by hand.
In your case, you'll need to set up private variables that would define your session times and trade between your private session variables.
How you set up and update your private session variables depends entirely on your overall backtesting framework.
Perhaps, during initialization, your strategy would read a config file to pull in the private session times.
Comment
-
I did consider that approach... but my sessions look like this:Originally posted by mgbloomfield View PostIn that case, leave the default session times as 12:00:00 AM and 12:00:00 AM.
In your case, you'll need to set up private variables that would define your session times and trade between your private session variables.
How you set up and update your private session variables depends entirely on your overall backtesting framework.
Perhaps, during initialization, your strategy would read a config file to pull in the private session times.
- test symbols A1-Z1 from Jan 1st until Feb 1st,
- A2-Z2 from Feb 1st until March 1st,
-A3-Z3 ...
Having a single session that runs from (let's say) Jan 1st - Dec 31st for ALL of the symbols ever touched seems like huge overhead. I'd like to be able to select (via a single parameter) "Jan"... and automatically the begin/end dates will also be set.
Comment
-
Session times are different per month? I think you actually want different session times per symbol?Originally posted by heech View PostI did consider that approach... but my sessions look like this:
- test symbols A1-Z1 from Jan 1st until Feb 1st,
- A2-Z2 from Feb 1st until March 1st,
-A3-Z3 ...
Having a single session that runs from (let's say) Jan 1st - Dec 31st for ALL of the symbols ever touched seems like huge overhead. I'd like to be able to select (via a single parameter) "Jan"... and automatically the begin/end dates will also be set.
Perhaps, create a config file with two columns. The first column is the symbol. The second column is a string of sessions times. Read the file into a key value collection. The symbols go into the key. The session time goes into value. For a given symbol, pull out the session time from the value and parse the string into two separate session start and end times.
Or something like that.
Just figure out the "lowest programming cost", ya know what I mean
Comment
-
I don't think you have any idea what I want to do.Originally posted by mgbloomfield View PostSession times are different per month? I think you actually want different session times per symbol?
Perhaps, create a config file with two columns. The first column is the symbol. The second column is a string of sessions times. Read the file into a key value collection. The symbols go into the key. The session time goes into value. For a given symbol, pull out the session time from the value and parse the string into two separate session start and end times.
Or something like that.
Just figure out the "lowest programming cost", ya know what I mean
I have 400-600 symbols used over the course of a year... but only about 50 are used in any particular month. Right now, I already do use a local configuration file that lists the symbols used in any particular month... I then read the file, and Add() the symbols I'm using.
But that still means I have to go into 'Backtest', scroll down to Timeframe, type in '01/15/2008' and '02/17/2008', and then click 'backtest'.
I'd prefer not having to memorize (and re-type) the start/end dates of each month. I'd prefer to just go into Backtest, and click on "TEST A" (on a enum parameter), and then "TEST B", and then "TEST C", etc.
Comment
-
Add all 600 symbols that you will use for the entire duration of the backtest.Originally posted by heech View PostI don't think you have any idea what I want to do.
I have 400-600 symbols used over the course of a year... but only about 50 are used in any particular month. Right now, I already do use a local configuration file that lists the symbols used in any particular month... I then read the file, and Add() the symbols I'm using.
But that still means I have to go into 'Backtest', scroll down to Timeframe, type in '01/15/2008' and '02/17/2008', and then click 'backtest'.
I'd prefer not having to memorize (and re-type) the start/end dates of each month. I'd prefer to just go into Backtest, and click on "TEST A" (on a enum parameter), and then "TEST B", and then "TEST C", etc.
Your config file denotes which symbols are active for each month.
In your OnBarUpdate, examine Time[0] to determine the month the backtest is in. In turn, this determines which symbols are "active" for that month (based on the config file you loaded).
Will that work?
Comment
-
I'm already doing exactly that internally in each month, actually. These symbols aren't all being traded all month.. some start earlier, end earlier, etc. So, I've considered expanding it to the full year.Originally posted by mgbloomfield View PostAdd all 600 symbols that you will use for the entire duration of the backtest.
Your config file denotes which symbols are active for each month.
In your OnBarUpdate, examine Time[0] to determine the month the backtest is in. In turn, this determines which symbols are "active" for that month (based on the config file you loaded).
Will that work?
But what I want to avoid is loading a year's worth of data x 500 symbols. I question whether NT can handle it, and I think the (wasted) overhead would be huge.
Comment
-
Originally posted by heech View PostI'm already doing exactly that internally in each month, actually. These symbols aren't all being traded all month.. some start earlier, end earlier, etc. So, I've considered expanding it to the full year.
But what I want to avoid is loading a year's worth of data x 500 symbols. I question whether NT can handle it, and I think the (wasted) overhead would be huge.
I was wondering the same thing.
Can symbols be added/removed during OnBarUpdate? If yes, then you could code it so that it only add/remove symbols that you need at the beginning of each month (or whatever your "timeframe" is).
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
333 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment