• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 ArmKnuckle, Today, 07:55 PM
        0 responses
        1 view
        0 likes
        Last Post ArmKnuckle  
        Started by Nabil, Today, 07:46 PM
        0 responses
        1 view
        0 likes
        Last Post Nabil
        by Nabil
         
        Started by mohdhm, Today, 04:37 PM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by trader14, Yesterday, 08:23 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by bigsurftrader, 02-24-2017, 12:23 AM
        4 responses
        1,162 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X