Slope of an EMA

Discussion in 'Technical Analysis' started by moonmist, Jan 3, 2013.

  1. moonmist

    moonmist

    Hi,

    The slope or angle of an EMA depends on the size of the monitor, scaling factor of the chart ( how zoomed in you were on the chart ), starting point for calculation, unit of the horizontal/vertical axis, etc. Some people use normalized slope.

    What is the most popular way to quantify the "steepness" of an EMA or a trendline objectively ?

    Any comment or suggestion would be appreciated. :)
     
  2. 030985

    030985

    I don't know if it is the most popular or not but one way to quantify it for the MA can be to calcultate for each bar the difference of the (E)MA value between actual bar and the previous bar ( which is independent of the chart scaling ).
    The bigger is this absolute value the "steeper" is the slope. :)
     
  3. dom993

    dom993

    Beyond the Y-axis, there is also the issue of the X-axis.

    Especially if you are on a range-chart, but even if you are trading on a volume/tick-chart, you might benefit from converting that back to time, in which case your "instant slope" will be (pseudo C# code):

    (EMA[1]-EMA[0]) / (Time[1]-Time[0]).TotalSeconds

    I would then not bother trying to optimize for that value ... instead, keep a distribution of it for the last N days/weeks/months, and optimize using just a std-dev offset vs the mean.
     
  4. This is probably your best way, but you still have the question of a standardized method of choosing the correct starting and ending spots. For example, if slope = (EMA[a] - EMA) / (Time[a] - Time) then you need to have a standard definition of what a and b will be.
     
  5. dom993

    dom993

    Pick a time interval (say 15min or 1h or whatever), and dynamically (bar by bar) compute index b so that the time interval between a & b matches your reference interval.
     
  6. moonmist

    moonmist



    The index "a" would refer to current bar. Unfortunately, I still cannot find a "b" that would lead to an AbsValue((EMA[a] - EMA) / (Time[a] - Time)) that is consistent across all timeframes even for a single trading instrument.
     


  7. That will probably be difficult to find something consistent. I suppose you could choose a standard interval (say 15 mins so that (Time(B) - Time(A) = 15mins) then start data mining for slopes of ema's that led to some standard definition of a "strong trend." If you have a normal distribution, then set a threshold of 2 standard deviations up in your strategy. This gives you an 80% chance that the trend you are looking at is what you define as a strong trend. Also run a ttest to ensure that it is a different population than the slopes that didn't lead to strong trends. Although, using some form of linear regression would probably be much more helpful if you have some time on your hands.

    This is, of course, just a conjecture. It shouldn't take too long to do some analysis on this. I also hope I was clear enough, sometimes I'm not very good at explaining relationships of variables so any questions are welcome. Hope that helps! :)
     
  8. cornix

    cornix

    IMO such things as "correct" slope of EMA can't be quantified mechanically. Too many inputs to code. Human brain is able to process all these inputs quite effectively though.

    Suggestion here would be stop trying to make things purely mechanical and just watch the price + EMA(s) until you clearly see the difference between "good" and "bad" behaviour.
     
  9. It's easy to take a quick look at the concept if you use Sierracharts. Put up your moving average then add the study called "Bar Difference" and set it all up so you are seeing the Avg[0] - Avg[n] values.. Pretty interesting really.
     
  10. I was just working on a simple back test just because I was curious.

    At first I tried changing the 'slope threshold' and seeing if yearly returns were correlated. And just judging from my observation, the results on that seem pretty random, but there are a lot of variables to test. I think its an interesting idea
     
    #10     Jan 10, 2013