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

Price marker

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

    Price marker

    I am using a colored HMA but the price marker is "weird" in that it shows decimal digits that are not part of the instruments tick increments but is even more fine tuned. See attached. The orange colored price marker is a simple EMA and shows correct price per the instrument's tick increments. The red price marker is a colored HMA but instead of showing "1.14150" it shows 1.14153".

    How do I change that?

    sandman
    Attached Files

    #2
    Hello sandman,

    Indicators will not always produce values that are an exact tick size.

    You can round the values to a tick size with Instrument.MasterInstrument.Round2TickSize(double price); where price is the value you want to round.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea. Thanks. Is there a code sample somewhere that shows where in the code I would use this?

      sandman

      Comment


        #4
        Hello sandman,

        I'm not aware of an example script that uses this. I've created a simple script to demonstrate.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea.

          Thanks very much for your time with this. I can easily see where and how it fits into my code and have used it.

          sandman

          Comment


            #6
            However I now noted that when I use it it not only changes the price marker but also the plot line. I do not want the plot line to change but only the price marker. How would that be made possible?

            sandman

            Comment


              #7
              Hello sandman,

              It is not possible to set the marker of a plot to a different price than the plot. The market will always show the current value of the plot.

              Instead, you can use two plots. One that is rounded to tick size and one that is not. One will set each bars color to Color.Empty to hide the plot from the chart.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                I understand what you say. However, setting the Rounded2TickSize plot to Color.Empty means the price marker is present but is also "Empty".

                I attach an image showing what I am trying to solve which is to a) get the smoothness of the standard EMA (left chart) and b) the relevant and correct price marker from the Rounded2TickSize EMA (right chart).

                This is only applicable for a few instruments like ES and 6E where the charted decimal increments are smaller than the decimal increments in for example the DOM.

                Perhaps there is another solution which would be to change the incoming datafeed altogether or whatever it depends on but that's beyond my (current) capabilities.

                sandman
                Attached Files

                Comment


                  #9
                  Hello sandman,

                  As I mentioned in post #7, you will need to set each bars color to Color.Empty to hide the plot from the chart. This means do not set the entire plot's pen color to Color.Empty, set each bars PlotColor to Color.Empty. This would hide the plot from the chart, but the price marker will have the original color of the plot.

                  Below is a link to the help guide on PlotColors.
                  http://ninjatrader.com/support/helpG...plotcolors.htm

                  I am not understanding how changing the data feed would cause the plot to be smooth while the price marker is at an exact tick size.

                  I am also not aware of any way to modify the data feed. Though after data is received in your script you can modify this anyway you want.

                  Attached is an example.
                  Attached Files
                  Last edited by NinjaTrader_ChelseaB; 07-11-2016, 03:58 PM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks for the sample which you included, Chelsea. It combines both SMAs and still did not do what I was after. It produces two price markers in the right hand margin. See attached image. I was able to produce an SMA, actually a single EMA, which shows the price marker that I wanted to see. The remaining drawdown was that it always kept showing up the EMA line in the current bar. I then replaced PlotStyle.Line with Plotstyle.Dot. See attached second image.

                    I now use a regular EMA to show the plotted line with Pricemarker set to False and a Rounded2TickSize EMA indicator with only a current plot as a dot and the price marker. Using both gives me what I wanted.

                    That would however not have been possible without you having supplied the sample code, so thank you!

                    sandman
                    Attached Files
                    Last edited by sandman; 07-27-2016, 11:13 PM.

                    Comment


                      #11
                      Price marker vs HLine

                      I too am having some challenges in adding a plot with PlotStyle.HLine and being dynamically able to "hide" the actual line whilst retaining the price marker.

                      I've tried various of the suggestions in this and other similar posts without success.

                      So, how do I add a price marker with an associate HLine where I can "hide" the line at will but the price marker remains unaffected?

                      Thanks.
                      Multi-Dimensional Managed Trading
                      jeronymite
                      NinjaTrader Ecosystem Vendor - Mizpah Software

                      Comment


                        #12
                        Hello jeronymite,

                        You would need to do this the way sandman accomplished this and use two indicators. (If you are only wanting 1 tag to show)
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Price marker vs HLine

                          Thanks, Chelsea. Is there an unsupported way to do this (in the spirit of opening up accessible but undocumented/unsupported APIs as evidenced in NT8 beta discussions)?

                          For example, the type ChartExecutionStyle has values of DoNotPlot, MarkersOnly and TextAndMarker. Are these or other possibilities able to achieve this?

                          Thanks.

                          Multi-Dimensional Managed Trading
                          jeronymite
                          NinjaTrader Ecosystem Vendor - Mizpah Software

                          Comment


                            #14
                            Hello jeronymite,

                            I am not aware of any undocumented way to show a different price on the price marker than the actual value of the plot.

                            So, two plots would need to be used. This causes two tags to appear. To only show one tag, the plots would need to be added to different indicators.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              To clarify, I want exactly the same value for price marker and plot. I simply want to show/hide the plot element at will whilst the price marker remains unaffected and visible.

                              Thanks.
                              Multi-Dimensional Managed Trading
                              jeronymite
                              NinjaTrader Ecosystem Vendor - Mizpah Software

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NRITV, Today, 01:15 PM
                              2 responses
                              8 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
                              26 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