Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Price marker format for T-Notes Futures Pivot Points

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

    #31
    Thank you very much Harry! This works like charm.

    Comment


      #32
      Hello,

      I wonder if in this situation a solution was developed.

      Originally posted by NinjaTrader_RyanM View Post
      Hello Ricam,

      Currently, you would have to use multiple indicators as FormatPriceMarkers() will apply to all charts. There would have to be a change here to allow different format per plot. Thank you for taking the time to provide us with valuable feedback, we have inserted your suggestion into our tracking system and assigned it ID # 715.
      Originally posted by Ricam View Post
      Once again am requesting a way to do the following:

      In an indicator that has more than one plot, to be able to use FormatPriceMarker to display properly formatted values for all of the plots, not just one.

      I believe there would have to be different FormatPriceMarker statements for each of the plots, not sure if that can be done.

      Can anyone can figure out a way to do this, Thanks
      Or if possible in MA for each plot customize the format. for example:



      Thanks in advance,

      Comment


        #33
        Ekann, Ryan's comment would unfortunately still apply here. I have made sure your request for his enhancement id is tracking in our lists as well though.
        BertrandNinjaTrader Customer Service

        Comment


          #34
          With regards to different labels for multiple plots in an indicator, would it be possible to return a global string whose value had been set just prior to the call to FormatPriceMarker() ?

          there would need to be some what to determine when FormatPriceMarker() is being called. Does it get called, for example, immediately after a Plot.set() ? or if not, is there any other way to determine the timing or some other trigger?

          Thanks,
          Will.

          Comment


            #35
            Different Price Marker Format or Label for each of multiple plots

            Currently, you would have to use multiple indicators as FormatPriceMarkers() will apply to all charts. There would have to be a change here to allow different format per plot. Thank you for taking the time to provide us with valuable feedback, we have inserted your suggestion into our tracking system and assigned it ID # 715.
            To be precise, we are not talking about "all charts". The subject is different custom formats for price markers of multiple plots of ONE indicator in ONE chart panel.

            Ekann, Ryan's comment would unfortunately still apply here. I have made sure your request for his enhancement id is tracking in our lists as well though.
            As shown below, you DON'T need multiple instances of the indicator, or a global string, to customize each of the price markers of a multi-plot indicator.

            Just iterate through the list of Values and find the one that matches the current price that is being fed into the FormatPriceMarker method. Then customize the return value for that particular price.

            It's always a good idea to put try/catch error trapping in the FormatPriceMarker method. Just take my word for it.
            Attached Files
            Last edited by Ricam; 01-14-2015, 11:09 AM.

            Comment


              #36
              Originally posted by Harry View Post
              I have now modified the indicator code of the EMA to address the problem - but, then I would have to add that piece of code to all my indicators to make them display properly on bond and treasury note futures.
              I know this thread is old, but I wanted to add my own universal solution to this discussion.

              I, too, found that treasury futures (eg, ZB, ZF, ZN, ZT, et al) show indicator price markers that don't match the format of the chart prices displayed on the Y axis. That is, the Y axis shows neatly formatted treasury prices with an apostrophe, but every indicator (when applied to a treasury futures chart) shows its price marker(s) with a decimal point. This makes for an annoying mish-mash of price formats that clash visually, and (as noted elsewhere) shifts the Y axis slightly to the left to make room for the long-ish decimal formatted treasury price from the indicator.

              To solve this problem for *all* indicators, I added these 3 functions to bin/Custom/Indicators/UserDefinedMethods.cs,

              Code:
              public double Round2TickSize(double Price)
              {
                  return Instrument.MasterInstrument.Round2TickSize(Price);
              }
              
              public string FormatPrice(double Price)
              {
                  return Instrument.MasterInstrument.FormatPrice(Round2TickSize(Price));
              }
              
              public override string FormatPriceMarker(double Price)
              {
                  return FormatPrice(Price);
              }
              This solves the problem for all price markers of all indicators for all instruments for all data series for all bar intervals for all bar types.

              How can it do this? Because these methods are defined in UserDefinedMethods.cs, they provide a simple and consistent custom default FormatPriceMarker() for every indicator derived from the "Indicator" base class. This new default FormatPriceMarker() produces a correctly formatted price for every instrument in all cases.

              I've attached my UserDefinedMethods.cs with these 3 functions.
              Attached Files
              Last edited by bltdavid; 03-16-2017, 10:21 PM.

              Comment


                #37
                Basically this simplifies the code for correctly formatting indicators in overlay mode to:

                Code:
                public override string FormatPriceMarker(double price)
                {
                      return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price));
                }

                Comment


                  #38
                  Originally posted by Harry View Post
                  Basically this simplifies the code for correctly formatting indicators in overlay mode to:

                  Code:
                  public override string FormatPriceMarker(double price)
                  {
                        return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price));
                  }
                  True, but Round2TickSize() and FormatPrice() could be very useful standalone functions in their own right ...

                  Comment


                    #39
                    The Missing Manual

                    Archived here for posterity is a document explaining how to achieve a full solution.

                    Written for the non-programmer, inexperienced user who has no idea what to "do" with the solution discussed in this thread, this 2-page document will explain the missing steps.

                    See attached file.

                    Enjoy!
                    Attached Files

                    Comment


                      #40
                      Originally posted by Harry View Post
                      Basically this simplifies the code for correctly formatting indicators in overlay mode to:

                      Code:
                      public override string FormatPriceMarker(double price)
                      {
                      return Instrument.MasterInstrument.FormatPrice(Instrument.MasterInstrument.Round2TickSize(price));
                      }
                      Many moons back, I took Harry's comment in red to heart,
                      and I updated my "bin\Custom\Indicator\UserDefinedMethods.cs" to this,

                      Code:
                      #region Using declarations
                      using System;
                      using System.ComponentModel;
                      using System.Drawing;
                      using NinjaTrader.Cbi;
                      using NinjaTrader.Data;
                      using NinjaTrader.Gui.Chart;
                      #endregion
                      
                      // This namespace holds all indicators and is required. Do not change it.
                      namespace NinjaTrader.Indicator
                      {
                          /// <summary>
                          /// This file holds all user defined indicator methods.
                          /// </summary>
                          partial class Indicator
                          {
                              public double Round2TickSize(double Price)
                              {
                                  return Instrument.MasterInstrument.Round2TickSize(Price);
                              }
                              public string FormatPrice(double Price)
                              {
                                  return Instrument.MasterInstrument.FormatPrice(Round2Tick Size(Price));
                              }
                              public override string FormatPriceMarker(double Price)
                              {
                                  return [B][COLOR=#e74c3c]Overlay[/COLOR][/B] ? FormatPrice(Price) : string.Format("{0:0.00}", Price);
                              }
                          }
                      }
                      The idea is that when Overlay is True, your indicator is running in the main price
                      panel, so the price markers should be formatted according to the MasterInstrument.

                      When Overlay is False, such as with indicators like CCI, RSI, MACD, etc, standard
                      decimal formatting should be used, regardless of the MasterInstrument.

                      Enjoy!

                      PS:
                      The NT8 solution is here.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by frankthearm, Today, 09:08 AM
                      7 responses
                      28 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by NRITV, Today, 01:15 PM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      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
                      16 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