Rounding differences

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #96349 quote
    robertogozzi
    Moderator
    Master

    I found out that there are differences between the rounding of numbers by ProOrder and the same done by ProBuilder.

    The following test was made on the indicator “Wilder’s Accumulative Swing Index (ASI)” and the same code turned into a strategy with embedded code, though some slight differences show also if I CALL it.

    Indicator:

    DEFPARAM CalculateOnLastBars = 3000  //commenting this will not work it out
    dailylimit=1
    if barindex>0 then
       //definition SwingIdx parameters
       AbsHighClose       = abs(high - close[1])
       AbsLowClose        = abs(low - close[1])
       AbsCloseOpen       = abs(close[1] - open[1])
       AbsMaxMin          = abs(high-low)
       CloseClose         = close-close[1]
       CloseOpenToday     = close - open
       CloseOpenYesterday = close[1] - open[1]
       //computation K
       k                  = max(AbsHighClose,AbsLowClose)
       //Computation R
       partialR           = max(AbsHighClose,max(AbsLowClose,AbsMaxMin))
       if AbsHighClose = partialR then
          r= AbsHighClose - 0.5 * AbsLowClose + 0.25 * AbsCloseOpen
       else
          r= AbsMaxMin + 0.25 * AbsCloseOpen
       endif
       if AbsLowClose=partialR then
          r= AbsLowClose-0.5*AbsHighClose+ 0.25 * AbsCloseOpen
       endif
       //main formula
       if r<>0 then
          SwingIdx = 50*((  CloseClose + 0.50 * CloseOpenToday + 0.25 * CloseOpenYesterday  ) / R ) *( K / DailyLimit )
       endif
       AccumulativeSwingIdx=AccumulativeSwingIdx+SwingIdx
    endif
    return AccumulativeSwingIdx AS "ASI"

    Strategy:

    DailyLimit = 1
    if BarIndex > 0 then
       //definition SwingIdx parameters
       AbsHighClose       = abs(high - close[1])
       AbsLowClose        = abs(low - close[1])
       AbsCloseOpen       = abs(close[1] - open[1])
       AbsMaxMin          = abs(high-low)
       CloseClose         = close-close[1]
       CloseOpenToday     = close - open
       CloseOpenYesterday = close[1] - open[1]
       //computation K
       k                  = max(AbsHighClose,AbsLowClose)
       //Computation R
       partialR           = max(AbsHighClose,max(AbsLowClose,AbsMaxMin))
       if AbsHighClose = partialR then
          r= AbsHighClose - 0.5 * AbsLowClose + 0.25 * AbsCloseOpen
       else
          r= AbsMaxMin + 0.25 * AbsCloseOpen
       endif
       if AbsLowClose=partialR then
          r= AbsLowClose-0.5*AbsHighClose+ 0.25 * AbsCloseOpen
       endif
       //main formula
       if r<>0 then
          SwingIdx = 50*((  CloseClose + 0.50 * CloseOpenToday + 0.25 * CloseOpenYesterday  ) / R ) *( K / DailyLimit )
       endif
       AccumulativeSwingIdx=AccumulativeSwingIdx+SwingIdx
    endif
    graph AccumulativeSwingIdx
    buy at -close limit    //dummy line

    Pics outline differences, even when CALLing the indicator, rather than embed it into my strategy.

    Asi-DAX.jpg Asi-DAX.jpg Asi-EURUSD.jpg Asi-EURUSD.jpg ASI-new.jpg ASI-new.jpg Wilders-Accumulative-Swing-2.itf Template-NEW2.itf
    #96355 quote
    robertogozzi
    Moderator
    Master

    Inserting this line just after the calculation of SwingIdx worked it out (I multiplied it by 100, rounded to always the lowest integer, then divided it by 100, I just truncated after the 2nd decimal digit) :

    SwingIdx = round((SwingIdx * 100) - 0.5) / 100

    but is not a real solution. Rounding should be always done the same way, no matter whether by ProOrder, ProBuilder, ….

    #96359 quote
    Nicolas
    Keymaster
    Master

    I replicate the same problem. I made a technical report too.

    #96518 quote
    Nicolas
    Keymaster
    Master

    It has been identified and will be fixed in a next update.

    robertogozzi, GraHal and Vonasi thanked this post
    #102181 quote
    Nicolas
    Keymaster
    Master

    I had confirmation today that it has been fixed for IG and PRT software version.

    robertogozzi thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Rounding differences


Platform Support: Charts, Data & Broker Setup

New Reply
Author
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Nicolas
6 years, 7 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 04/13/2019
Status: Active
Attachments: 5 files
Logo Logo
Loading...