Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiColor Plot Issue

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

    MultiColor Plot Issue

    Hi,

    I've been having some issues with this in Beta 5 and was wondering if its just me being an idiot:

    Initialize

    Add(new Plot());

    OnBarUpdate

    Values[0].Set(0);

    if(Close[0] < SMA(75)[0])
    PlotColors[0][0] = Color.Green;


    The plot should be coloured green at anypoint where the close was < SMA(75). This doesnt seem to be the case?

    #2
    No, that is not what will happen. Your code I believe will change the entire plot to green when the condition is true.

    To do what you wish, please see the reference sample contained in the following thread.

    RayNinjaTrader Customer Service

    Comment


      #3
      I believe the whole purpose of this change is to be able to change the plot color at any time and it would only affect the line segment it is applied to. That means the above code should work. Of course there should be an 'else' in there for a false condition and color change? Otherwise there would be no change from the old 6.5 method.
      Last edited by eDanny; 12-09-2009, 02:43 PM.
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        So got it working by putting a 'default' case in:


        Values[0].Set(0);

        PlotColors[0][0] = Color.Orange;

        if(Close[0] < SMA(75)[0])
        PlotColors[0][0] = Color.Green;


        Probably just me but this wasnt at all obvious to me. If you dont have the additional line in there it behaves kind of strange where the plot changes colour when you scroll left and right.

        Guess its all part of using a beta pre-documentation

        Comment


          #5
          FYI, even if you set a default plot colour in initialize it still doesn't work unless you set PlotColors on every OnBarUpdate. E.g. the following doesn't work:

          Initialize
          Add(new Plot(Color.Orange, "plot1"));


          OnBarUpdate
          Values[0].Set(0);

          If(Close[0] < SMA(75)[0]) {
          PlotColors[0][0] = Color.Green;

          Comment


            #6
            Please see the link I provided, it contains a reference sample that demonstrates how to have a multi-color plot.
            RayNinjaTrader Customer Service

            Comment


              #7
              This may have been reported elsewhere - but just in case.

              It seems that PlotColors[0][0] = Color.Empty is not recognised although Color.Transparent is...

              Also - a question - is there a .GetPlotColor or similiar that can be used in conjuction with PlotColors so if a Plot color is changed via Parameters the coloring code logic within an indicator can respond accordingly?

              Thanks

              Comment


                #8
                rt_trader,

                Color.Empty is the default value of PlotColors when you don't explicitly set it. That is why if you try to set it to Color.Empty it will still give you the Parameter set color.

                There is no .GetPlotColor, but you can print PlotColors to get the color if you set it. If you get a Color [Empty] that means you are using the Parameter color, otherwise it will print whatever you set it to.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                626 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                359 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                562 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                567 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X