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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jonfletcher, Today, 01:52 PM
    0 responses
    1 view
    0 likes
    Last Post jonfletcher  
    Started by MarceloF, 10-02-2018, 09:46 PM
    13 responses
    569 views
    0 likes
    Last Post bltdavid  
    Started by demarcog, Today, 12:21 PM
    0 responses
    8 views
    0 likes
    Last Post demarcog  
    Started by money0101, Today, 11:57 AM
    0 responses
    6 views
    0 likes
    Last Post money0101  
    Started by M_ichel, 04-22-2025, 02:21 PM
    12 responses
    82 views
    1 like
    Last Post M_ichel
    by M_ichel
     
    Working...
    X