Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing plot color to an existing plotted plot

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

    Changing plot color to an existing plotted plot

    Hi,

    In my indicator, i paint a plot, then later I want to change the color of the plot that already has been painted. Somehow when I just write the plot value and with the new color by just calling the funciton, the old color still remains. Is there something I need to do to allow the color to change?

    to best clarify, here is some code, that fires each tick....

    Code:
    			  if (SetupActive)
    				  {
    					  PlotBrushes[(int) enuPlotList.TrailingStop_Long_Inner][0] = Color_TrailingStop_TradeActive;
    				  }
    				  else
    				  {
    					  PlotBrushes[(int) enuPlotList.TrailingStop_Long_Inner][0] = Color_TrailingStop_TradeNotActive;
    				  }
    So, initially, when the setup occurs, the trade is not active, so it will paint with TrailingStop_NotActive Color, but if it becomes active intrabar, then the color will change to TrailingActive_Color. Since this fires every tick, I assumed that it would just redraw the plot and hence change the color, but it doesnt seem to.

    Thanks in advance for your help.

    #2
    Hello KhaosTrader, and thank you for your question.

    The attached indicator behaves the way you described, in that intra-bar, the current bar's plot will alternate between two colors. You will notice previous bar's plots will alternate between the two colors I have selected. I am including a screenshot from my system. I believe studying this code and its behavior should answer any questions you have about PlotBrushes, but if not, or if there is anything else we can help with, please do not hesitate to reach out and we will be happy to assist further.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Ok, I have a question about plot colors. If the default plot color is transparent, and for a given bar, i change it to a color (say yellow), and then on the next bar i dont set the color, is the color back to default transparent on the next bar?

      Comment


        #4
        Hello again KhaosTrader,

        As you will be able to verify with the script I provided, the default color value for new bars is going to be the one you set up in your Initialize routine when you create the plot. I would recommend, then, creating your plot via


        AddPlot(Brushes.Transparent, "Plot Name");

        Please let us know if there are any other ways we can help.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by terofs, Yesterday, 04:18 PM
        1 response
        21 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by CommonWhale, Today, 09:55 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Gerik, Today, 09:40 AM
        2 responses
        7 views
        0 likes
        Last Post Gerik
        by Gerik
         
        Started by RookieTrader, Today, 09:37 AM
        2 responses
        12 views
        0 likes
        Last Post RookieTrader  
        Started by alifarahani, Today, 09:40 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X