TC2000 to AFL conversion

Hi All,

Below is the ADR% formula in Tc2000 provided by Qullamaggie


I have tried to convert it to an AFL scanner

ratio = High/Low;
ADR = 100 * (((MA((Sum(ratio, 20) )/ 20, 20))) - 1);
Filter = ADR > 6;
AddColumn(ADR, "ADR", 1.2);

As the values in my scanner and the TC2000 don't match, I believe I am making some mistakes in conversion. Would you mind pointing out the mistakes I'm making?

Thank you in advance for your time and consideration.

Your TC code only calculates SUM, not both sum and then Moving average from sum.
Your AFL code calculates sum then moving average. You made it too complex.
Instead you should just write

ADR = 100 * MA( ratio, 20 ) - 1; // MA already calculates sum and division
1 Like

Thanks, @Tomasz , Worked like a charm.

Parens are off. Correct formula is:

ADR = 100 * (MA(ratio, 20) - 1);

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.