Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculation equities - currencies

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

    Calculation equities - currencies

    Hello,

    I was experiencing a strange plotting as result from a simple calculation and worked round all day with it to find the reason The issue is that the calculation works for ES, NQ, YM but not for 6E, 6B...

    Now I found out that when I remove the "Math. Round" then the result is OK also with 6E and 6B. What is the reason for this please?

    Example: the NT Indicator "samplegethighlowbytimerange" I calculate the mid from the highestHigh and the lowestLow with rthMid = Math.Round((highestHigh+lowestLow)/2,2);
    And the result from is ok for ES.... but for 6E and 6B I have to use rthMid = (highestHigh+lowestLow)/2); for having a correct number from this calculation.

    Why please?

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    If you would like to round a number in a NinjaScript it is suggested to use the NinjaScript method RoundToTickSize. RoundToTickSize returns a value that is rounded up to the nearest valid value evenly divisible by the instrument's tick size.

    Please see the example script in the NinjaTrader help guide documentation linked below for how this could be used.

    SampleRoundToTickSize - https://ninjatrader.com/support/help...he_nearest.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Skifree, Today, 03:41 AM
    1 response
    2 views
    0 likes
    Last Post Skifree
    by Skifree
     
    Started by usazencort, Today, 01:16 AM
    0 responses
    1 view
    0 likes
    Last Post usazencort  
    Started by kaywai, 09-01-2023, 08:44 PM
    5 responses
    603 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    23 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    23 views
    0 likes
    Last Post Pattontje  
    Working...
    X