Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Plot Order changed?

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

    Indicator Plot Order changed?

    You may have touched on this before, but it seems like the plot order has changed for indicators.

    I had indicators that would stack colors on top of one another. It seemed like the higher the Plots[#] the sooner it would have been plotted with NT7. Now it seems like that has been reversed as the "larger" bar now covers the smaller bar within NT8.

    Is there an easy way to change this order or do I have to restructure my code to change the order in which the plots are created?

    #2
    A few other questions as well due to the multi-tasking, etc..

    I used to setup pen width and opacity for plots in the OnSetup() (State.Historical), where I now get an error that a different thread has that object. It seems like the Plots are separate threads at that point an probably only READ-ONLY. Updating this in the User manual might be helpful as to how long you have to modify the objects.

    So right now, this is what I do:

    State.SetDefaults
    - I "AddPlot" with recommended "Brush"

    State.Configure
    - Set some plots removed from the study to Transparent Brushs
    - Try to update Width & Opacity (Can't seem to do this now)
    I tried:
    Plots[i].Pen.Thickness =3;
    But got an error this is read only, I couldn't figure out how to change the Opacity


    State.Historical
    - Initialize Series<>
    - Initialize Classes for NinjaScript


    Comment


      #3
      Originally posted by NJA_MC View Post
      A few other questions as well due to the multi-tasking, etc..

      I used to setup pen width and opacity for plots in the OnSetup() (State.Historical), where I now get an error that a different thread has that object. It seems like the Plots are separate threads at that point an probably only READ-ONLY. Updating this in the User manual might be helpful as to how long you have to modify the objects.

      So right now, this is what I do:

      State.SetDefaults
      - I "AddPlot" with recommended "Brush"

      State.Configure
      - Set some plots removed from the study to Transparent Brushs
      - Try to update Width & Opacity (Can't seem to do this now)
      I tried:
      Plots[i].Pen.Thickness =3;
      But got an error this is read only, I couldn't figure out how to change the Opacity


      State.Historical
      - Initialize Series<>
      - Initialize Classes for NinjaScript


      Set you pen thickness in the AddPlot statement itself..

      Code:
      [COLOR=#080808]
       AddPlot[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]new[/COLOR][COLOR=#080808]Pen[/COLOR][COLOR=#000000]([/COLOR][COLOR=#080808]System[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Windows[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Media[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Brushes[/COLOR][COLOR=#000000].Blue[/COLOR][COLOR=#000000], [/COLOR][COLOR=#ff8c00]5[/COLOR][COLOR=#000000]), [/COLOR][COLOR=#080808]PlotStyle[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Line[/COLOR][COLOR=#000000], [/COLOR][COLOR=#b22222]"PlotName"[/COLOR][COLOR=#000000]);[/COLOR]
      Interested in easiest way to set opacity of brushes (not just plots) myself..

      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Thanks,

        The issues is I sometimes need to change the plot after all selections have been made rather and at the old Initialization. I think you can set the Brush Opacity before adding it to the pen, but I am trying to figure out how to do it during the configuration of the plot rather than the SetDefault stage.

        Comment


          #5
          Originally posted by NJA_MC View Post
          Thanks,

          The issues is I sometimes need to change the plot after all selections have been made rather and at the old Initialization. I think you can set the Brush Opacity before adding it to the pen, but I am trying to figure out how to do it during the configuration of the plot rather than the SetDefault stage.
          Try doing it in State.DataLoaded.

          Comment


            #6
            The SampleMultiColoredPlot in the reference samples is doing it in State.Default.. But this seems to work in OnBarUpdate as well..

            Plots[0].Width = 5;

            Last edited by -=Edge=-; 05-07-2015, 10:29 AM.
            -=Edge=-
            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

            Comment


              #7
              Thanks for the approaches,

              I see the logic you are following to change the width, it didn't work. I tried it in most State.Settings with no luck.

              I wonder if the event that detect a change to parameters is not being handled properly? I will leave that for the development team...

              Comment


                #8
                Originally posted by NJA_MC View Post
                Thanks for the approaches,

                I see the logic you are following to change the width, it didn't work. I tried it in most State.Settings with no luck.

                I wonder if the event that detect a change to parameters is not being handled properly? I will leave that for the development team...

                All I did here was add the set width to the rising and falling in the SampleMultColredPlot reference sample provided here..



                Seems to work here..

                Attached Files
                -=Edge=-
                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                Comment


                  #9
                  Strange,

                  That didn't work either... There must be some property that needs to be set on the "Values[]" public export variables. I don't know if anyone found the new properties, I know they were not really document in NT7 but looks like NT8 we will need to know more about them. Hoping I can still include Input parameters from indicators that are only used for visual configuration so I don't need to pass 30 or so dummy variables when calling the same indicator from within a strategy.

                  Here is what I current have:
                  [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                  [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                  public Series<double> Plot1
                  {
                  get { return Values[0]; }
                  }

                  Comment


                    #10
                    Originally posted by NJA_MC View Post
                    You may have touched on this before, but it seems like the plot order has changed for indicators.

                    I had indicators that would stack colors on top of one another. It seemed like the higher the Plots[#] the sooner it would have been plotted with NT7. Now it seems like that has been reversed as the "larger" bar now covers the smaller bar within NT8.

                    Is there an easy way to change this order or do I have to restructure my code to change the order in which the plots are created?
                    For me the new order (if your observation is correct) is much more intuitive - it is exactly the way you would draw in real life.

                    Comment


                      #11
                      Agreed,

                      I think before it took me a while to figure it out, this makes better sense. I am just wondering if I need to re-write 300 lines of code or if I can change the plot/Zorder without moving the Addplot sequence around.

                      Comment


                        #12
                        Your observations are correct - it has been changed to what we understood to be more intuitive based on client feedback. Consider the following:

                        Code:
                        if (State == State.SetDefaults)
                        {
                           AddPlot(Brushes.Orange, "Plot1");
                           AddPlot(Brushes.Red, "Plot2");
                           AddPlot(Brushes.Green, "Plot3");
                        }
                        The Green "Plot3" would be drawn last, and reside on top of the rest of the plots.

                        There is no way to set the order after they've been added.
                        MatthewNinjaTrader Product Management

                        Comment


                          #13
                          Thanks,

                          I agree this is more logical, I will restructure my code.

                          You may want to list this as a CODE BREAKER as a warning to others. This is a major change in how plotting is done.

                          Comment


                            #14
                            Good point, I will have ammended.
                            MatthewNinjaTrader Product Management

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by TraderBCL, Today, 04:38 AM
                            2 responses
                            16 views
                            0 likes
                            Last Post TraderBCL  
                            Started by martin70, 03-24-2023, 04:58 AM
                            14 responses
                            106 views
                            0 likes
                            Last Post martin70  
                            Started by Radano, 06-10-2021, 01:40 AM
                            19 responses
                            609 views
                            0 likes
                            Last Post Radano
                            by Radano
                             
                            Started by KenneGaray, Today, 03:48 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post KenneGaray  
                            Started by thanajo, 05-04-2021, 02:11 AM
                            4 responses
                            471 views
                            0 likes
                            Last Post tradingnasdaqprueba  
                            Working...
                            X