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

Second Chart for Multi Instrument

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

    Second Chart for Multi Instrument

    Is it possible to show a second chart of a second instrument in a multi Instrument strategy? With all Entries and Exits as for the main instrument?

    Thank's Frank

    #2
    Hello,

    Thank you for the question.

    While it is not directly possible to display the secondary series directly in a new panel, you can cause an indicator to plot prices or other values in a second panel.

    Using AddChartIndicator you can add a secondary indicator to perform plotting in another panel, we have a strategy example that demonstrates this concept: https://ninjatrader.com/support/foru...ead.php?t=6651

    Using the dummy indicator, the strategy could tell it to plot things as you need them like markers for executions or plots etc..

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank's Jesse!

      I tried the sampleStrategyPlot. Can You help me with the syntax of OverlayPlot and PanelPlot. I want them to plot my secondary data series ^NDX.

      else if (State == State.Configure)
      {

      AddDataSeries("^NDX", BarsPeriodType.Day, 1);

      OverlayPlot = ???
      PanelPlot = ???

      Frank

      Comment


        #4
        Hello,

        You could see the following document which explains how to access data in a multi-series script:


        The first example ( Accessing the Price Data in a Multi-Bars NinjaScript) demonstrates the general syntax needed to reference your secondary series.

        You could use Closes[1][0] as one option to plot the Close price.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          That works :-)


          AddDataSeries("^NDX", BarsPeriodType.Day, 1);

          OverlayPlot = new Series<double>(this);
          PanelPlot = new Series<double>(this);

          //Create an indicator which is set to overlayplot. The indicator will use this strategies references OverlayPlot series to plot.
          SampleOverlayPlot sampleOverlayPlot = SampleOverlayPlot();
          sampleOverlayPlot.Strategy = this;
          AddChartIndicator(sampleOverlayPlot);

          //Create an indicator which is set for a panel plot. The indicator will use this strategies references PanelPlot series to plot.
          SamplePanelPlot samplePanelPlot = SamplePanelPlot();
          samplePanelPlot.Strategy = this;
          AddChartIndicator(samplePanelPlot);
          }
          }

          protected override void OnBarUpdate()
          {
          //Set your plots here.
          OverlayPlot[0] = Closes[1][0];
          PanelPlot[0] = Closes[1][0];
          }

          [Browsable(false)]
          [XmlIgnore()]
          public Series<double> OverlayPlot;

          [Browsable(false)]
          [XmlIgnore()]
          public Series<double> PanelPlot;
          }
          }


          Thank's Frank

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by inanazsocial, Today, 01:15 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by rocketman7, Today, 02:12 AM
          0 responses
          10 views
          0 likes
          Last Post rocketman7  
          Started by dustydbayer, Today, 01:59 AM
          0 responses
          1 view
          0 likes
          Last Post dustydbayer  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          23 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Working...
          X