Skip to main content

Permission denied!

Anchored Moving Average for Metastock

carla over 15 years ago Metastock

  • Rating:
    0 / 5 (Votes 0)
  • Tags:
    metastock, moving average

An anchored moving average (AMA) is when you select a point on the chart and starting calculating the moving average from there. Importantly the moving average’s denominator is not fixed but cumulative. For example on day 7 the previous 6 days closes prices plus today’s close are totaled and divided by 7. On day 8 the previous 7 day’s closes plus today’s close are totaled and divided by 8. This continues until you run out of data.

Screenshots

Files

Indicator / Formula

Copy & Paste Friendly


eMonth:=Input("Enter the Month - MM",1,12,1);
eDate:=Input("Enter the Date - DD",1,31,2);
eYear:=Input("Enter the Year - YYYY",1900,2100,2001);
numdays:=BarsSince(DayOfMonth()=eDate AND
Month() =eMonth AND Year()=eYear);

cumtp:=Cum(Typical());
basecumtp:= ValueWhen(1, numdays=1, Ref(cumtp,-1));
avgval:=(cumtp-basecumtp)/numdays;
avgval;

0 comments

Leave Comment

Please login here to leave a comment.