Skip to main content

SMAD for Amibroker (AFL)

olegon11 about 13 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 2)
  • Tags:
    amibroker, moving average

Simple Moving Average previous Days

Another form of Moving Average that used the same candle data in previous days.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("SMAD");

function SMAD(array,periods)
{     local i,times;

result = 0;
times = TimeNum();
for (i = 0 ; i < periods ; i++)
       result += ValueWhen(times == times,array,i);
return result/periods;
}

Plot(SMAD(C,Param("Period",3,1,20)),"SMAD",colorGreen);

_SECTION_END();

0 comments

Leave Comment

Please login here to leave a comment.