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

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 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
            2 views
            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