Geometric mean for trend following

Discussion in 'Trading' started by varaamo, May 22, 2019.

  1. varaamo

    varaamo

    Geometric mean is typically used in portfolio analysis. However it seems to possess some properties (such as resiliency to outliers) that makes it ideal to filter some of the pullbacks during a trending move.Can anybody who have used or currently using it in trend following strategies share their experiences with this indicator?
     
  2. Handle123

    Handle123

    I played with this couple years ago, it is like most other indicators, you apply indicator then supply rules around indicator to filter out disappointing price action. Where it breaks down is range of bars, as range increases, your risk management rules must have some way to either increase risk/target or stoppage of taking trades.

    Time better spent studying ends of trends, they often have reoccurring patterns so that you can exit profitable trades and wait for either new trend forming or if old trend going into chop. IMO
     
    birdman, tommcginnis and varaamo like this.
  3. MarkBrown

    MarkBrown

    { Geometric Mean Function }

    Inputs: Price(NumericSeries), Length(NumericSimple);

    Variables: Product(0), ix(0);

    Product = 1;
    For ix = 0 to Length-1
    begin
    Product = Product * Price[ix];
    end;
    GeometricMean = Power(Product, 1/Length);

    { Geometric Mean Indicator }

    input: price(c),length(100);

    var:aa(0);

    aa=geometricmean(price,length);

    plot1(aa,"gm");

    -----------------------------------------------------

    Below Picture using close of bar for Price input and 20 for Length input.

    Red Line = Geo Mean

    Green/Magenta Line = T3average for comparison.

    Conclusion - pretty much the same as most moving averages.


    [​IMG]
     
    Last edited: May 23, 2019
  4. varaamo

    varaamo

    Have you tried converting this to an oscillator? Once a trend is established ( GM > 0 for uptrend and GM < 0 for downtrend) there are fewer whipsaws and false signals compared to ROC , MACD or other MA based oscillators.
     
  5. The Geometric moving average calculates the geometric mean of the previous N bars of a time series. The simple moving average uses the arithmetic mean, which means that it is calculated by adding the time series' value of the N previous bars and then dividing the result with the lookback period.
     
  6. panzerman

    panzerman

    Whether you use the geometric mean, arithmetic mean, you are still using a lowpass filter, and are subject to group delay, commonly known as lag. Specifically, your moving average is a finite impulse response (FIR) lowpass filter. The group delay of the filter is given by the formula (N-1)/2, where N is the lookback period.

    Trading with a lagging indicator is like driving a car while looking in the rearview mirror. Removing lag and still getting adequate levels of smoothing is difficult if not impossible. Of course "adequate" is in the eye of the beholder. Trust me, a causal lowpass filter with zero group delay, constant phase response, and at least 40dB of stopband frequency attenuation does not exist.

    John Ehlers does have some near zero lag IIR filters that might be useful to you.
     
    varaamo likes this.
  7. MarkBrown

    MarkBrown

    in the lower subgraph is the oscillator current close - geometric mean in red, average in yellow, boundaries at 50 and -50 can bee seen also.

    also system is based on the average line.

    [​IMG]
     
    Last edited: May 23, 2019
    varaamo likes this.
  8. varaamo

    varaamo

    Thanks for the inputs, panzerman. Wondering if you were able to develop a good trading system using the zero lag IIR filters? issue that I've come across with these filters ( FIR and zero lags) or for the matter of fact any indicator is they don't work well in ranging markets as Handle123 mention in the earlier post. IMO, the only approach that I know of, is to deal with it using proper risk management and adjusting the profit targets and stop loss levels. If you've found any another way to work around the issue, i'm willing to learn if you'd share your knowledge and expertise.
     
  9. varaamo

    varaamo

    Equity curve looks quite decent, @MarkBrown, how does it compare with other MA based oscillators, such as MACD for example?
     
  10. panzerman

    panzerman

    I have not been satisfied with the zero-lag IIR filters. I find that they just do not have enough attenuation (ie smoothing) for my liking. I'm looking into alpha-beta/alpha-beta-gamma/Kalman filters more, but I suspect I will encounter the same issue of inadequate attenuation.

    One area that I do find interesting is bandpass filtering and matched filtering, but that is more in the realm of cyclical trading and not trend following.
     
    #10     May 23, 2019