The function to get the ticker and some others :
function GetTicker(CUR_FROM, CUR_TO )
dim nonce, StringToEncode, signature, JsonObject
G_xmlhttp.open "GET", "
https://cex.io/api/ticker/" & CUR_FROM &"/"& CUR_TO, false
on error resume next
G_xmlhttp.send ""
Set JsonObject= New VbsJson
'Wscript.echo G_xmlhttp.responseText
Set GetTicker = JsonObject.Decode(G_xmlhttp.responseText)
on error goto 0
end function
Function calculateSimpleMovingAverage( Var_Tab )
dim i
calculateSimpleMovingAverage = 0
for i=0 to ubound( Var_Tab )
calculateSimpleMovingAverage = calculateSimpleMovingAverage + Var_Tab(i)
next
calculateSimpleMovingAverage = calculateSimpleMovingAverage / (ubound( Var_Tab )+1)
end function
Function calculateWeightedMovingAverage( Var_Tab, IndexOfLastData )
dim i, j, divider, SummOfExponential
divider = 0
SummOfExponential = 0
j = 1
for i=IndexOfLastData+1 to ( ubound( Var_Tab ) )
SummOfExponential = SummOfExponential + ( j * Var_Tab(i) )
j = j+1
next
for i=0 to ( IndexOfLastData )
SummOfExponential = SummOfExponential + ( j * Var_Tab(i) )
j = j+1
next
for i=0 to ( ubound( Var_Tab ) )
divider = divider + (i+1)
next
calculateWeightedMovingAverage = SummOfExponential / divider
'wscript.echo " DEBUG dessus = " & SummOfExponential
'wscript.echo " DEBUG dessous = " & divider
'wscript.echo " DEBUG calculateExponentialAverage = " & calculateExponentialAverage
end function