Unstable indicators and the use of parameter slide
Author: M635
Creation Date: 3/28/2009 12:30 PM
profile picture

M635

#1
New user here, not a coder but learning via cut and paste from rules built code, and making progress.

I am aware that certain indicaters need a lot of seed data before they stabilize, EMA's being one of them. If using the slider parameters to set the EMA periods does the rules built int bar declaration acommodate the required increase in data periods to stabilize the EMA?

CODE:
Please log in to see this code.


If not how do I modify the statement to stabilize the data?

All help and advice welcomed!
profile picture

Eugene

#2
When using a moving average, the trading loop of a rule-based strategy will start on the bar that corresponds to selected moving average's period. For EMA, you'd want to at least triple that period:
CODE:
Please log in to see this code.
profile picture

M635

#3
Got it!!

Thanks Eugene, I'll be back with more questions in some new topic posts.
profile picture

DartboardTrader

#4
Hi Eugene,

For ease of use, and to make it less likely someone uses data that is not stabilized, all indicator's "FirstValidValue" should be the first stable value. This is more meaningful since it comes directly from the indicator's algorithm.

It seems misleading that:

CODE:
Please log in to see this code.

returns "39", instead of 39*2, or whatever algorithmically would be correct.

That way, if someone decides to use the bars immediately between 39 and the first "stable" value, we were at least warned.

This problem is compounded when using GetExternalSymbol, because the external symbol may have less data than the selected dataset member. So the calculation is GetExternalSymbols("SYMBOL",true).FirstActualBar + indicator.FirstStableBar + indicator's stability fudge factor.

Or consider adding an attribute for "FirstStableValue" or "BarsBeforeStable".

Regards,
--Mike
profile picture

Cone

#5
The fact is that the values are "valid", they're just not stable in the sense that if you change the starting date of the seed data, the values at later dates won't be precisely the same as before (but the values are always the same with the same starting date).

In some cases, especially with Weekly or Monthly data, you may not have enough seed data to arrive at "stability", and for these cases users will want what's available - not to be hindered by a rule of thumb that Eugene. and I are promoting. I don't even know of any other platform that points out this issue of stability for this group of indicators.

QUOTE:
Or consider adding an attribute for "FirstStableValue" or "BarsBeforeStable".
Again, it would be misleading for WL to make a determination of what's stable for all indicators in this group (EMA, MACD, etc.) across the entire range of parameters that can be used.
profile picture

Eugene

#6
Hi Mike,

FirstBalidValue can be modified on-the-fly in your strategy code:
CODE:
Please log in to see this code.


By the way, I stabilize FirstValidValue (where applicable) as a rule in Community.Indicators - just to err on the side of caution.
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).