+1 888 340 6572
MultiCharts Project Management
Go to the previous open issue
Go to the previous issue (open or closed)
Please log in to bookmark issues
Closed Bug report MC-2160

MC.NET: AverageFC does NOT work when changing Length attribute along the way

Go to the next issue (open or closed)
Go to the next open issue
icon_info.png This issue has been closed with status "Not a bug" and resolution "Not determined".


One might desire to change a moving average length along the way, as in the below:

if sky == blue then length = 10
if sky == dark then lengh = 20

One can see when doing this, that once length changed when CalcFunc() reaches Bar Number 1000, that the Moving Average value gets wrongly computed. Attahed picture with the proof:

1) Picture shows code to get this: simple dual moving average cross-over
2) When CurrentBar == 14000, I change the slow mov average length from 10 to 8
3) Immediately after Bar 14000, we can see the value of slow moving average jumps from 94.25 to 117.87. Looking at the Close price values on last 8 or 10 bars, we can see that mathematically it is INCORRECT: 117.87 CANNOT BE an average of last 8 Close prices.

4) Conclusion: when changing the length, of a moving average along the way, the mov average value is NOT CORRECTLY COMPUTED AFTERWARDS.

Obs: I think this also happens in MC powerlanguage if AverageFC is used ... I always use the simple Average function in easylanguage.

Steps to reproduce this issue

Phe proof is in the pudding, I mean attached picture.

Comments (1)
user-offline.png  MultiCharts Support (MultiCharts)
Jan 18, 2017 - 21:49
That is expected behavior. You cannot change the length “along the way” as Moving Average is a series function, it preserves and utilizes its previous values for calculations.
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    Not determined
  • Status
    Not a bug
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates