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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    291 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    188 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    185 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    270 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    219 views
    0 likes
    Last Post CarlTrading  
    Working...
    X