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

Displaying two indicators on the same chart panel in NT8

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

    Displaying two indicators on the same chart panel in NT8

    Hi,

    I can't get a strategy to add two indicators to a NT8 30M chart using the following code:

    ...
    else if (State == State.DataLoaded)
    {

    SpreadRatio1 = SpreadRatio(Close, 1, 1, true, @"YM 09-18 30M");
    SpreadRatio1.Plots[0].Brush = Brushes.ForestGreen;
    SpreadRatio1.ScaleJustification =ScaleJustification.Overlay;
    mySMA.Panel=2;
    AddChartIndicator(SpreadRatio1);

    mySMA =SMA(Close,14);
    mySMA.Plots[0].Brush = Brushes.Yellow;
    mySMA.ScaleJustification =ScaleJustification.Overlay;
    mySMA.Panel=2;
    AddChartIndicator(mySMA);
    ….

    I have a 30M candlestick chart with two data series ES 09-18 30M (Panel 1) and YM 09-18 30M (Panel 2) running a strategy (see chart 1 attached). The strategy attempts to adds two indicators to that chart. One of the indicators is the standard SMA indicator and the other indicator is a custom indicator called SpreadRatio. Instead of adding the two indicators to Panel 3 as desired, the strategy is incorrectly placing the SMA indicator in Panel 1 (see chart 2 attached) whilst SpreadRatio is correctly placed on Panel 3.

    What have I done wrong?
    Attached Files
    Last edited by dowtrader; 08-23-2018, 10:43 AM.

    #2
    Hello dowtrader,
    Thanks for your post.

    Your code looks correct. What version of NT8 are you on?

    Are you perhaps setting the panel somewhere else in your code?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Thanks for your reply.

      I am using NT version 8.0.15.1 64-bit . As far as I am aware I am not setting the panel elsewhere.

      Comment


        #4
        If you compile the code>>open a new chart>>add the indicator do you see the same thing?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_JoshG View Post
          If you compile the code>>open a new chart>>add the indicator do you see the same thing?
          Yes after compiling the code and opening a new chart I see the same thing. Any other ideas?

          Comment


            #6
            Are you able to plot to the correct panel if you use another indicator instead of SpreadRatio?
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              No. But my solution was to call/integrate the SMA as a plot in the Ninjascript code of the SpreadRatio indicator so that they plotted on the same panel. That solution did the trick. Thanks for your help nonetheless.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              32 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              12 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X