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 PhillT, Today, 02:16 PM
      1 response
      1 view
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Kaledus, Today, 01:29 PM
      3 responses
      9 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by frankthearm, Yesterday, 09:08 AM
      14 responses
      47 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      13 views
      0 likes
      Last Post gentlebenthebear  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      17 views
      0 likes
      Last Post PaulMohn  
      Working...
      X