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

Multi Colored plots.

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

    Multi Colored plots.

    I have read the tutorials and can get multi colored indicator plots by setting threshold values. However, it seems that if you are going to want a number of different colors and thresholds then you have to add a plot for each one and set the threshold values. It also seems that you then have to to do a "Set" command such as AboveZero. Set for each one of these plots at the end of the method even though you have no intention of ever using the set values that the method returns. You also then get multiple plots listed in the indicators dialog box. This system works, but it doesn't seem too elegant from a programming standpoint to have a method return so many "throw away" values and to have the indicator dialog box listing multiple plots. Does each plot really need to be set to a value at the end of the OnBarUpdate? I tried doing it a different way by having one plot and changing the Pen color, but as noted in other posts, this changes the color of the whole indicator plot and not the individual bar plot colors. Is there a way to color individual indicator plot bars without using the "threshold" method?

    I also have the feeling that when using this threshold method of coloring the plots, and with price markers turned on, that the price markers of all the plots are being updated, displayed, and overlayed simultaneously. I am thinking this because the price marker on my plots using the threshold method for coloring always displays in the same price color even though I am at a different threshold. (example: my price marker is currently DarkRed even though my indicator bar is Blue. DarkRed is one of my threshold colors, but the price marker is always displayed in the DarkRed color. It doesn't change when the indicator bar color changes) Thus the price marker color does not always match the indicator bar color.

    Thanks.

    #2
    Your understanding is correct. You do not have to set a plot value on each OnBarUpdate() method. If you do not set one, nothing will be plotted since there is no value.

    As always, things can always be improved upon. Thanks for taking the time to provide your thoughts.
    RayNinjaTrader Customer Service

    Comment


      #3
      OK. I'll use the threshold method for for multi colored plots. I was just wondering if there was another way. I do like NT a lot or else I wouldn't be putting all the time into learning how to program it.

      As far as my other question was concerned, when using multicolored plots via "thresholds", is there a way to display the price marker in the same color as the current indicator plot color? On my system, when I have a multicolored indicator, the price marker is always displayed in the same color irrespective of what my current plot color may be.

      Thanks.

      Comment


        #4
        Sorry for missing your question. Try playing around with the order of the added plots in the Initialize() method. There is no way to force the color of the marker. Changing the order will change the order they sit in the internal collection that is skipped through when plotting.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thank you.

          Comment


            #6
            I have an additional 2 questions:

            As indicated elsewhere (I forget where I read it), if the Plot's Min and Max is set from the Lines.Value in the Initialize method then if I later change the position (value) of the Lines in the Indicators dialog box then the Plot colors of my indicator won't update to reflect the values of the lines. This is because the initialize method is only called once at the very beginning of the indicator?

            Is there a reload or refresh button or option somewhere on a chart that would generate a recalc and cause a recalc that would update the indicator to calculate based upon my new line values and redraw the indicator so that the plot colors reflect the new Line values? Or, would it be acceptable to put setting the Plot Min and Max from the Lines.Value in the OnBarUpdate method so that it would get updated there? I have tried doing it in the OnBarUpdate method and it works but I'm not sure how much overhead I'm introducing by its being redetermined every tick. Any recommendations?

            Also, I've seen you refer to log files when a problem occurs. Can you tell me where I might find the log files?

            Thanks.

            Comment


              #7
              - Initialize only is called once per indicator
              - you can change the Min/Max value any time in OnBarUpdate, no performance penalty
              - log files: see tab "Log"

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NRITV, Today, 01:15 PM
              2 responses
              6 views
              0 likes
              Last Post NRITV
              by NRITV
               
              Started by frankthearm, Today, 09:08 AM
              7 responses
              31 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by maybeimnotrader, Yesterday, 05:46 PM
              5 responses
              25 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by quantismo, Yesterday, 05:13 PM
              2 responses
              19 views
              0 likes
              Last Post quantismo  
              Started by adeelshahzad, Today, 03:54 AM
              5 responses
              33 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X