Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Possible for strategy to change main instrument used

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

    Possible for strategy to change main instrument used

    Mostly, NT works by taking a chart with a loaded instrument and applying a strategy or indicator to it. Is it possible for a strategy, by itself, to replace the loaded instrument with another instrument?

    For instance, start a strategy with futures contract instrument ESU22 and the strategy will change the instrument on rollover date, for example, to ESZ22.

    #2
    Hello bfalls,

    That would not be possible by using any supported code, that would also restart the strategy assuming the instrument is changed in a chart where the strategy is applied.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks. Actually, thinking about it, I should be able to load another instrument as a series, and base the strategy on that particular series to make trading decisions; but can the strategy make trades on the secondary loaded instrument instead of the main instrument loaded in the chart?
      Code:
      EnterShort(int barsInProgressIndex, int quantity, string signalName)
      I'm thinking the strategy should be able to reload the secondary instrument with a different instrument while the strategy keeps running. There may be limitations like no open orders using that instrument. All I see for supporting multi-instrument strategies is AddDataSeries but I don't see DeleteDataSeries or any management functions to manage the instrument objects. Any ideas along these lines?

      Comment


        #4
        Hello bfalls,

        You can place trades to secondary series, you would use the entry methods that have BarsInProgress. A secondary series would be bars in progress 1.

        AddDataSeries is not something which can be dynamic, that requires hard coding the instrument and is not something which can change again without reloading the strategy. That is part of the strategies startup and defines how the functions like OnBarUpdate will run when the script is active.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RDTrader16, Today, 10:19 PM
        0 responses
        5 views
        0 likes
        Last Post RDTrader16  
        Started by gemify, 03-08-2023, 08:02 AM
        9 responses
        148 views
        0 likes
        Last Post culpepper  
        Started by elirion, Today, 10:03 PM
        0 responses
        1 view
        0 likes
        Last Post elirion
        by elirion
         
        Started by RaddiFX, Today, 09:55 PM
        0 responses
        9 views
        0 likes
        Last Post RaddiFX
        by RaddiFX
         
        Started by Trader146, 03-29-2024, 01:22 PM
        4 responses
        27 views
        0 likes
        Last Post Trader146  
        Working...
        X