I have the Same CCI Indicator & Function, so far as I can tell, same inputs definitely, yet different outputs / trades between TS, which is live, and Multicharts which is the development desktop. When I compare the code between the functions and indicators, the MultiCharts code appears to be copied directly from TS, using generic variables, instead of naming them:
Here's MultiCharts:
Code: Select all
inputs:
Len( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ) ;
var0 = Average( H + L + C, Len ) ;
var1 = 0 ;
for var2 = 0 to Len - 1
begin
var1 = var1 + AbsValue( ( H + L + C )[var2] - var0 ) ;
end ;
var1 = var1 / Len ;
if var1 = 0 then
CCI = 0
else
CCI = ( H + L + C - var0 ) / ( .015 * var1 ) ;
Code: Select all
{ Search Tag: WA-CCI }
{ Commodity Channel Index }
inputs:
Length( numericsimple ) ; { will get divide-by-zero error if Length = 0 }
variables:
Mean( 0 ),
AvgDev( 0 ),
Counter( 0 ) ;
Mean = Average( H + L + C, Length ) ; { don't have to divide H+L+C by 3, cancels out }
AvgDev = 0 ;
for Counter = 0 to Length - 1
begin
AvgDev = AvgDev + AbsValue( ( H + L + C )[Counter] - Mean ) ;
end ;
AvgDev = AvgDev / Length ;
if AvgDev = 0 then
CCI = 0
else
CCI = ( H + L + C - Mean ) / ( .015 * AvgDev ) ;
let me know your thoughts, thank you. Makes me wonder if the subtle differences between the two platforms will create issues like this going forward of if it's addressable with code changes.