Wealth-Lab MAs initialized with 0
Author: Carova
Creation Date: 2/26/2015 9:29 AM
profile picture

Carova

#1
I have noticed that the various MAs (EMA, SMA, etc) all appear to be initialized with a "0.0" value, making them very slow to converge if the length parameter is long (>100).

I would like to suggest that they be initialized with the original series instead.

Vince
profile picture

Eugene

#2
Let me suggest using this solution:

GetAllDataForSymbol
profile picture

Carova

#3
Hi Eugene!

That does work when there is enough data (not all symbols have that, e.g. FB), but I still suggest that the initialization solution is a better approach since it does not force the user to make programming changes to all of his affected scripts, and would maintain the speed (rather that performing unnecessary calculations on the lead bars to get convergence). Also, would that approach work for internal Wealthlab indicators that use these MAs? Furthermore, I do believe that the initialization with the base series is the defined approach for all of these MAs.

Vince
profile picture

Eugene

#4
Vince,

Quoting the Wealth-Lab User Guide:
QUOTE:
The EMA indicator is no longer initialized by the mean average of the period. Instead the indicator is now valid from bar 0 using the value of the base DataSeries and updated on successive bars using the IIR filter calculation.


I leave the SMA question up to Cone to decide.
profile picture

Cone

#5
There's really no way that I can foresee for Wealth-Lab Standard indicators to accommodate this request. The time to have done this would have been when Wealth-Lab 5 was released many years ago. (If you want to start working on the Community.Indicators, then have at it!)

Anyway, for others reading, if you're using indicators before they're valid, then your test is generally invalid and here's the reason: Two simulations using the same strategy but with different starting dates will very likely generate different trade results around the time the indicator(s) were invalid. Do you really want trades in the past that the same strategy wouldn't take in live trading? That won't happen if you properly use a seed period (ignoring indicators before they become valid) - and that especially goes for IIR indicators like EMA.
profile picture

Eugene

#6
+1

Vince,

a) indicators shouldn't be used before their FirstValidValue and
b) in general, such drastic changes must not be approached in a lighthearted manner because these indicators are backed by tons of scripts in the wild.

Realizing this, and to avoid any breaking changes that the others may not be interested in, I suggested the GetAllDataForSymbol workaround to you.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).