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

Drawing Price for each Horizontal line - Wrong Format

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

    Drawing Price for each Horizontal line - Wrong Format

    Hi, i am trying to modify an NT7 indicator to show the price for each level i draw an horizontal line.

    It works fine, but when i use it with NQ, instead of showing the 4 digits and the tick size (0.25/0.50/.75), it shows the 4 digits and 2 decimals per line. (see pic attached)

    The indicator is getting the format in the right way because it shows all the digits...but it shows the decimals instead of the each tick.

    Any idea how to fix this?

    The string that the indicator is drawings is:

    string s = l1.EndY.ToString(_priceFormat);

    can we print the price marker instead? Any other way to fix this?

    thanks,
    Attached Files

    #2
    Hello,

    Thank you for the post.

    I wanted to check, are you currently using any rounding for the values you are displaying? If these are being calculated it is possible that the values being calculated are causing this, if that is the case there is a round to tick size method which may help:


    Code:
    double newValue = Instrument.MasterInstrument.Round2TickSize(2000.12343)
    If you are doing rounding or other logic already, could you provide an expanded sample of how the prices are being calculated? The strings format should only control the number of decimal places but you would still need to round to a tick size.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      finally i got. this is what i used to round to the tick size>

      double h = Instrument.MasterInstrument.Round2TickSize(l1.EndY );
      s2 = h.ToString(_priceFormat);

      thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by swestendorf, Today, 11:14 AM
      2 responses
      5 views
      0 likes
      Last Post NinjaTrader_Kimberly  
      Started by xiinteractive, 04-09-2024, 08:08 AM
      4 responses
      13 views
      0 likes
      Last Post xiinteractive  
      Started by Mupulen, Today, 11:26 AM
      0 responses
      2 views
      0 likes
      Last Post Mupulen
      by Mupulen
       
      Started by Sparkyboy, Today, 10:57 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by TheMarlin801, 10-13-2020, 01:40 AM
      21 responses
      3,917 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Working...
      X