[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: flat 34 ema



PureBytes Links

Trading Reference Links

> I was wondering if someone has ever written an indicator that would
> define a flat 34 ema. I have tried several ways including multiple
> avarages, but nothing effective, I know it's easy enough to look at
> it and tell it's flat, but to include it in a system is another
> thing. 

"Flat" is either totally objective -- "NO change for X periods" -
- or subjective to some degree.  Your eye is applying a 
subjective definition of "flat" when you look at the chart.

The "NO change" criterion isn't very useful for an EMA.  So you 
need to choose some firm definition of a subjectively "flat" 
area.

What does "flat" mean to you?  "Less than X% change in X 
periods," maybe?

You could use an approach something like this:

ShortPeriod = 10;
LongPeriod = 100;

EMA = Xaverage(Close, EMAlength);

HHShort = Highest(EMA, ShortPeriod);
LLShort = Lowest(EMA, ShortPeriod);
HHLong = Highest(EMA, LongPeriod);
LLLong = Lowest(EMA, LongPeriod);

PctEMAMove = (HHShort - LLShort) / (HHLong - LLLong);

if PctEMAMove < WhateverLevel then ...

Then if the EMA has changed less than WhateverLevel in the last 
10 bars, relative to the last 100 bars, you define it to be 
"flat."

Gary