Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading Hours Template

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

    Trading Hours Template

    How can I manually set in the code which Trading Hours Template is used by strategy? I do not want to use Strategy Analyzer and drop-down list.

    I would like to use variable for this that this can be optimized and tested with multiple Trading Hours Template for the best fit.

    Thanks!

    #2
    Hello Jones,

    NinjaTrader does not have any supported ways to modify the primary series programmatically. This is all controlled by the chart data series or the data series in the strategy parameters when adding a script to the strategies tab of the control center.

    It is possible to add series to a script and set the trading hours template for an added series. You can use the data from that added series in the script any where in place of the primary series.

    It is not possible to dynamically add a series using variables.

    From the help guide:
    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result into an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."

    Below is a public link to the help guide on AddDataSeries().


    This is also mentioned in the help guide on Multi-Time Frame & Instruments.


    If you hardcode the additional series, you can use a switch to prevent logic from processing during the OnBarUpdates for that BarsInProgress.


    Alternatively, a BarsRequest can be used to call data out of sync.


    I'm happy to forward any feature requests you'd like our development to consider for future versions of NinjaTrader.
    Last edited by NinjaTrader_ChelseaB; 06-03-2018, 08:33 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    20 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X