Hello,

i am trying to teach myself how to use teh looping statements in AFL.
So i have used teh code example:

_SECTION_BEGIN("Looptest");

Period=10*ATR(50);

Vaexp[ 0 ] = Close[ 0 ]; // initialise first value

for( i = 1; i < BarCount; i++)
{
    //calculate the value of the smoothing factor
    factor = 2/(period[ i ] + 1);

    //calculate the value of the i-th element of the array
    //using this bars close (close [ i ]) and the previous average value ( 
vaexp{ i - 1])
    Vaexp[ i ] = factor * Close[ i ] + (1 - factor) * Vaexp[ i - 1 ];
}
_SECTION_END();

...

now i want to know how i plot VAexp as an indicator on a chart (i am getting a 
few strange outputs with the code i have been trying - including using PLOT 
within the loop. When i use PLOT outside the loop i get an empty chart)

Think its probably a simple answer, but i cant get to it..

J


 
John Ramdenee


 

Reply via email to