Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 16:12:08 +0000



Post From: Differences while calculating moving averages (backtest, historical, replay)

[2020-06-24 18:17:37]
DonMattez - Posts: 8
Hello all,

I noticed a difference in the calculation of the moving averages when the custom study is used during system backtests, recalculation and replays.

The following code is beeing used:

int MAlen;
//MAlen used with 400, 100, 50
sc.SimpleMovAvg(sc.Close, sc.Subgraph[1], MAlen());
float MAVal = sc.Subgraph[1][sc.Index];

These are the results:

Backtest: 2876,18188  Difference to Backtest: 0
Recalc: 2876,17627  Difference to Backtest: -0,00561
Replay:   2876,17627  Difference to Backtest: -0,00561

Sometimes the value during replay is the same as during the backtest, sometimes the same as during recalculation and sometimes its completely different.
I tried it with various sizes of MALen, the smaller the numbers the higher the difference.

Du you know why this is happening and how to prevent this?

Thank you in advance.