How to get moving-average value with AFL?

Let’s say MA-Line value is 1.70025
how to get that number using AFL ?

i’ve tried this code

MA_value = MA( Close, 500)
printf(" MA value is = %g\n", MA_value);

what i got is -1e+010 instead of 1.70025

@ab-ami, MA() returns an array (hint you may want to look at the LastValue() function to get the last value of an array).

But more in general, please, read/study this thread:

1 Like

Let’s say price = 1.26511
MA Line = 1.27000

I need to compare the price ( 1.26511) and MA Line value (1.27000)

if price > MA_Line
printf bla bla bla

i just want to know if the current price is above/below MA-Line

i try this codes

MA-value = MA( Close, 500)
printf (“The MA Value = %g\n”, MA-value);

but this is the value i got 1e+010 instead of 1.27000

some changes to your example work for me.

MA_value = MA( Close, 500);
printf ("The MA Value = %g\n", MA_value);

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