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.
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, ….
I replicate the same problem. I made a technical report too.
It has been identified and will be fixed in a next update.
I had confirmation today that it has been fixed for IG and PRT software version.