Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StrategyPlot() PlotStyle and Tick by TIck operation

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

    StrategyPlot() PlotStyle and Tick by TIck operation

    Is there a way to modify the StrategyPlot() method to change the PlotStyle?

    Also, I've applied some StrategyPlot() methods to a Strategy and it seems they do not start plotting until the completion of the bar even though the Strategy is set of CalculateOnBarClose = false. Is this the expected behavior?

    taddypole...

    #2
    Hello,

    Thanks for the forum post.

    Unfortunately I do not know of a way to change PlotStyle with a StrategyPlot. It can be done with a regular plot but I do not see an option to allow this with StrategyPlot.

    Also Strategy Plot should update when you set it. Do you have Calculate On Bar Close specified in the indicator in Initialize()?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hi Brett,

      Actually found the answer in another thread.
      use:

      StrategyPlot(index).Plots[0].PlotStyle = PlotStyle.Square;
      StrategyPlot(index).Plots[0].Pen.Color = Color.Green;

      And I found that the StrategyPlot was updating tick by tick.
      At first I thought is wasn't but later found out it was.

      Thanks for your assistance...

      taddypole...

      Comment


        #4
        I have the StrategyPlot() working but have one other problem.

        How do I adjust the number of displayed decimal points?
        For the EC I should be displaying 4 decimal places but with the plots displayed by the StrategyPlots I only get 2 decimal places.

        regards,
        taddypole...

        Comment


          #5
          Taddypole, do you have those running in the price panel or separate panel?

          Comment


            #6
            Bertrand,

            They are running in the price panel.
            Other indicators I have are displaying 4 decimals but the StrategyPlots() are displaying 2 decimals.

            Comment


              #7
              Thanks Taddypole, in this case you could custom format the price markers used in the StrategyPlot indicator:

              public override string FormatPriceMarker(double price)
              {
              return price.ToString("N4");
              }

              Comment


                #8
                Thanks Bertrand,

                But when I insert that code, I get compile errors.

                1. Where do I insert it? I've tried "OnBarUpdate" and "Initiallize" but get compile errors.
                2. Do I insert the code directly or is "price" a general term where I should be using "Close[0]"?

                Comment


                  #9
                  It would be outside OnBarUpdate(), as it's an own method to override the default markers, please see the cs attached adding this snippet in.
                  Attached Files

                  Comment


                    #10
                    I notice your code is in an "indicator", mine is in a "Strategy".

                    Should the "FormatPriceMarker" also work in a Strategy?

                    I'm still getting compile errors.

                    Comment


                      #11
                      Specifically the error I'm getting is:


                      'NinjaTrader.Strategy.ManagedStrategySeven.FormatP riceMarker(double)': no suitable method found to override

                      Comment


                        #12
                        Hello,

                        Ah, yes running into that issue again where it may not be available in the strategy. I will check with Bertrand when he gets into the office to see if you can do this in a strategy with some workaround. I'm unaware of a way to do this with the strategy plot. The strategy plot is meant really to be a basic display to the chart only.

                        It may be beneficial to you to move all this into a separate indicator that you simply add on the chart with Add(IndicatorName()); in the strategy so that you do not run into these issues if you have more coding to do.

                        I look forward to assisting you further.
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          I would but these StrategyPlots are various stops calculated based on a position entry.
                          Is there a way for code in an indicator to know when a position is entered and if it is long or short?

                          If not then I need the plots to come from the strategy.

                          regards,
                          taddypole...

                          Comment


                            #14
                            taddypole, this is unfortunately not possible - why not plot the stops you want to see visually with drawing objects?

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            671 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            379 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            111 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            575 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            582 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X