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

addplot in state.default

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

    addplot in state.default

    Hello, how do I write addplot in state.default that draws backbrush or barbrush on the chart? I cannot find an example of these two. If this is not possible and I can only use OBU, what addplot do I write in default that does not draw anything on my chart?

    Thank you.

    #2
    Hello imalil,

    I am not certain I understand your goal here, OnStateChange would be to configure the plots. Later in OnBarUpdate you can assign values to those plots and they would be rendered.

    What was the goal you had in mind with the plot?



    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse. When I assign values to backbrush in OBU it works fine. But when I configure a plot in state.default it makes a line, which ruins my chart. When I set this plot to Transparent in state.default to remove the line, I cannot control the color of my backbrush when I load the indicator on my chart. I have to hard code the color of my backbrush.

      I guess my question is how do I configure a plot in state.default that does not draw anything on my chart? I'm sure it's a simple question but I don't know how to do it.

      Thanks.

      Comment


        #4
        Hello imalil,

        Using Transparent for a plot is expected to remove it, that is a documented way to hide a plot from the UI. Using a brush will show the plot in the chart.

        I am still not understanding the problem as you described it, Are you trying to use a plot to just hold data and not display it? What is the goal you have with the plot?




        JesseNinjaTrader Customer Service

        Comment


          #5
          I want to be able to control the color of my two backbrushes from the UI, but all it shows right now is Transparent, not the colors I'm using in the backbrush. Here is my setup right now:
          In state.default I have AddPlot(Brushes.Transparent, "plot1"); AddPlot(Brushes.Transparent, "plot2"); (these two plots draw lines on my chart that I do not want, so I have to make them Transparent.)
          In OnBarUpdate I have two conditions. If it's a bearish condition I have BackBrush = Brown; bullish, BackBrush = White;
          plot1[0] = bearish BackBrush variable, plot2[0] = bullish BackBrush variable.
          When the indicator is loaded on my chart and I look at its UI, plot1 and plot2 are Transparent, not Brown and White. Meaning the UI is seeing the addplot in state.default, not the backbrush in OBU.

          My question/goal is how do I see my backbrush colors, Brown and White, in the UI?

          Thank you.

          Comment


            #6
            Hello imalil,

            I want to be able to control the color of my two backbrushes from the UI
            You would need to add two Brush user inputs and then use a default color for the AddPlot like Brushes.Red. In OnBarUpdate you can use the brushes the user selected by using the user input properties. The plot colors selection won't be relevant here because you want user selectable colors for the conditions you made.

            You can use the indicator wizard or strategy builder to generate brush user input properties and their syntax.

            If you want the plot to be transparent unless set you can still use a default color like Brushes.Red, in OnBarUpdate set the plot color to transparent before any other conditions which may reset it to a different color.

            Keep in mind that setting individual bar colors like this can be resource intense if you use large amounts of historical data. If that is the case you would want to switch to using OnRender to display the data in a more efficient way.


            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Aviram Y, Today, 05:29 AM
            0 responses
            1 view
            0 likes
            Last Post Aviram Y  
            Started by quantismo, 04-17-2024, 05:13 PM
            3 responses
            25 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by ScottWalsh, 04-16-2024, 04:29 PM
            7 responses
            34 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cls71, Today, 04:45 AM
            0 responses
            6 views
            0 likes
            Last Post cls71
            by cls71
             
            Started by mjairg, 07-20-2023, 11:57 PM
            3 responses
            216 views
            1 like
            Last Post PaulMohn  
            Working...
            X