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

Show Second Instrument Instead of Main Instrument in NinjaTrader 8

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

    Show Second Instrument Instead of Main Instrument in NinjaTrader 8

    Hey there everyone,

    I have a code where it uses Main Instrument's data to make trades for Second Instrument but the problem is that, main instrument is currently shown in the chart. What I want is that Second Instrument should be shown in the chart instead of Main Instrument. Is there anyway to do this? If so, how do I do it? or what specific code do I need? Thank you in advanced!

    #2
    Hello itgoesbrrrrrr,

    Thanks for your post.

    When using multi-timeframe or multi-instrument NinjaScripts, only the primary data series will display on the chart window. Secondary data series added to the script is used for calculations in the script and there are no supported ways to have that secondary series displayed on the chart.

    You could consider using the current secondary instrument as the primary instrument in your script. Then the current primary instrument could be added as a secondary instrument used for calculations in the script to place trades.

    See the help guide documentation below for more information.
    AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm
    Multi-TimeFrame and Multi-Instrument: https://ninjatrader.com/support/help...nstruments.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_BrandonH,

      Thank you for the information. How do I make the second instrument become a main instrument?

      Comment


        #4
        Hello itgoesbrrrrrr,

        Thanks for your note.

        The primary instrument that a NinjaScript strategy uses is the instrument that the strategy is enabled on. The secondary series would be added to the script using AddDataSeries().

        Say your current primary instrument is ES 03-22 and the secondary instrument added to the script with AddDataSeries() is CL 02-22. Say you want the CL 02-22 chart to display instead of the ES 03-22 chart.

        You would need to change these instruments around so that the primary instrument is CL 02-22 and the secondary instrument that is added to the script using AddDataSeries() is ES 03-22. This way, the CL 02-22 chart would be displayed. The ES 03-22 chart would not be displayed but would be used for calculations in the script.

        Please review the Multi-Timeframe and Multi-Instrument help guide documentation in post #2 for more information about working with multi-timeframe/instrument NinjaScripts.

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Hello NinjaTrader_BrandonH,

          Thank you so much! I was able to switch the main chart to Second Instrument's chart by changing the Main Instrument in State.Configure.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Barry Milan, Today, 10:35 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by WeyldFalcon, 12-10-2020, 06:48 PM
          14 responses
          1,428 views
          0 likes
          Last Post Handclap0241  
          Started by DJ888, Yesterday, 06:09 PM
          2 responses
          9 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          40 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Today, 08:51 AM
          2 responses
          16 views
          0 likes
          Last Post bill2023  
          Working...
          X