Hi,
I am trying to code a two line indicator (Blau's Ergodic - I found the ECO.efs formula, but I have a different version I want to use). I have read the introductory PDFs and looked at some examples. However, I get errors in my few lines of code. My guess is that my errors are so basic that they will jump out at anyone with experience. Here is the efs code as it appears in main(). The preMain() function simply indicates it is not a price study and to draw it as a line.
var mtm = close() - close(-1);
var ergodic = (100 * (ema(5, ema(34, mtm)) / ema(5, ema(34, Math.abs(mtm))), 5));
return ergodic;
I get two errors -- first, that the second argument to the ema function, mtm, is incorrect. The variable mtm is simply meant to be a given bar's close minus the prior bar's close. Is there a reason that won't work as the second arg, or that an ema of an ema of mtm wouldn't work?
Second, abs is reported to be an unknown function, however, Math.abs shows up as a valid auto-complete and in the javascript documentation.
I'm new with efs, so this is probably simple stuff for someone. I'd appreciate help that anyone might be able to provide such that I can work with this. Thanks!
Regards,
Gordon
I am trying to code a two line indicator (Blau's Ergodic - I found the ECO.efs formula, but I have a different version I want to use). I have read the introductory PDFs and looked at some examples. However, I get errors in my few lines of code. My guess is that my errors are so basic that they will jump out at anyone with experience. Here is the efs code as it appears in main(). The preMain() function simply indicates it is not a price study and to draw it as a line.
var mtm = close() - close(-1);
var ergodic = (100 * (ema(5, ema(34, mtm)) / ema(5, ema(34, Math.abs(mtm))), 5));
return ergodic;
I get two errors -- first, that the second argument to the ema function, mtm, is incorrect. The variable mtm is simply meant to be a given bar's close minus the prior bar's close. Is there a reason that won't work as the second arg, or that an ema of an ema of mtm wouldn't work?
Second, abs is reported to be an unknown function, however, Math.abs shows up as a valid auto-complete and in the javascript documentation.
I'm new with efs, so this is probably simple stuff for someone. I'd appreciate help that anyone might be able to provide such that I can work with this. Thanks!
Regards,
Gordon
Comment