I am trying to duplicate the output of this AB code in Excel.
HVlookBack = 100;
HV = Prec(StDev(log(C/Ref(C,-1)),HVlookBack )*100*sqrt(252),2);
Right now I am trying to just duplicate the log(C/Ref(C,-1)) snip specifically using the Explorer. In AB I get the output of -0.0100 and in Excel I get -0.0043398.
I think I am getting the same answer, and it may just be a rounding issue in the AB Explorer via some setting I am not aware of. I thought the Prec function might be the key, but that had no effect.
Can anyone see what I might be doing wrong?
if (status( "action" ) == actionExplore)
Filter = 1;
AddColumn ( Prec(log(177.24/179.02),4), "LOG test" , 1.4);
Please carefully read the AB manual.
It's pretty clearly documented that AB
log is natural logarithm.
So in Excel use LN.
Equivalent to Excel LOG in AB it is log10 function.
Please also read here for further questions.
Yeah I did read the manual, but I am not mathematically astute enough to know the difference in Excel between LOG and LN functions. Thank you for pointing me to the right function in Excel.
For what it is worth, Excel LOG function takes TWO arguments, second argument is logarithm BASE. It just happens that if you don't supply second argument in Excel, it defaults to 10, see: https://exceljet.net/excel-functions/excel-log-function
Excel also has LOG10 function which takes one argument.
In AmiBroker Formula Language exactly as in "C" programming language, log is natural logarithm and log10 is decimal.
AmiBroker Users' manual:
Thank You Tomasz. I appreciate your insight!