Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot do two plots

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

    Cannot do two plots

    I am trying to do two plots:
    Code:
    			
    // Plot 0 is the primary security (IAU)
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    // Plot 1 is SPY
    Add("SPY", PeriodType.Day, 1);
    Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
    
    // These series are displayed each bar.
    Plot0.Set(Closes[0][0]);
    Plot1.Set(Closes[1][0]);
    The indicator should show IAU in orange and SPY in green. However, my program prints the SPY time series in orange.

    Any idea what would cause this?

    Many thanks.

    #2
    I might be missing something but I'm not seeing any errors standing out to me. I am also assuming the Add()s are in the Initialize() and Set()s are in the OnBarUpdate()

    Could you please attach the complete .cs file so that I may test on my end?

    Located in (MY)Documents\NinjaTrader 7\bin\Custom\Indicator
    LanceNinjaTrader Customer Service

    Comment


      #3
      Upload

      Please find attached.
      Attached Files

      Comment


        #4
        Originally posted by NinjaTrader_Lance View Post
        I might be missing something but I'm not seeing any errors standing out to me. I am also assuming the Add()s are in the Initialize() and Set()s are in the OnBarUpdate()

        Could you please attach the complete .cs file so that I may test on my end?

        Located in (MY)Documents\NinjaTrader 7\bin\Custom\Indicator
        I just sent it but in a separate reply to you.

        Many thanks for the fast response.

        FYI: I have been through this with the VS2010 debugger. Everything is called on each bar, it just fails to plot!

        Thks!

        Comment


          #5
          I spotted a minor typo in your #region Properties Section.

          You're returning both plot0 and plot1 to be Values[0]

          Instead you want to use Values[0] for Plot0 and Values[1] for Plot1

          Let me know if I can be of further assistance.
          LanceNinjaTrader Customer Service

          Comment


            #6
            That fixed it. Thanks!

            Originally posted by NinjaTrader_Lance View Post
            I spotted a minor typo in your #region Properties Section.

            You're returning both plot0 and plot1 to be Values[0]

            Instead you want to use Values[0] for Plot0 and Values[1] for Plot1

            Let me know if I can be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            578 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X