Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set manually in NinjaScript "From".."To" Timeframe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Set manually in NinjaScript "From".."To" Timeframe

    hi all!

    the title of this thread is pretty much self-explanatory: instead of determine the first and last date of timeseries data from Strategy Analyzer --> TimeFrame -->From..To or Data Series window, I'd like to set it manually via code.

    Within a strategy I set variables that hold the starting and ending date, I put them in a global "IF" statement before running anything else but although when I print out "ToDay(Time[0])" I get the right "From..To" timeframe dates, my indicators that I call INSIDE this IF statement, seem to disobey and they run for the whole timeseries timeframe.

    The idea is to perform multiple backtests (within a for loop) by calling indicators for let's say 3 months by changing their input parameters, and then run the strategy for let's say 1 month with optimal parameters coming from the 3 months period. I have done that but it works only when Session Template From..To coincides with the starting and ending dates variables within the code.

    Thank you for your patience to read this!

    I would appreciate any feedback.

    #2
    Hello Jim,

    Thank you for your note

    You won't be able to set the To and From dates in the hard value that you are looking to do.

    However, you can use a time filter in the strategy to only have it look back 3 months and then use those as variables to either change or potentially optimize.
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    86 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    48 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    29 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    67 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X