Gann HiLo free

by kalex718 in category Trend at 12/09/2012
Description

Gann HiLo is a trend indicator that helps identify entry and exit signals.

 

 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class GannHighLow:Indicator
    {
        private SimpleMovingAverage _smaHigh;
        private SimpleMovingAverage _smaLow;
        private double _d;

        [Parameter("Period", DefaultValue = 10)]
        public int Period { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            _smaHigh = Indicators.SimpleMovingAverage(MarketSeries.High, Period);
            _smaLow = Indicators.SimpleMovingAverage(MarketSeries.Low, Period);
        }

        public override void Calculate(int index)
        {
            if(index < Period) 
                return;

            double close = MarketSeries.Close[index];
            double smaHigh = _smaHigh.Result[index - 1];
            double smaHighPrev = _smaHigh.Result[index - 2];
            double smaLow = _smaLow.Result[index - 1];

            if (close > smaHigh)
                Result[index] = smaLow;
            else
            {
                if (close < smaLow)
                    Result[index] = smaHigh;
                else
                {
                    if (Result[index - 1] == smaHighPrev)
                        Result[index] = smaHigh;
                    else
                        Result[index] = smaLow;
                }
            }

        }
    }
}
Comments

MrTrader - June 13, 2013 @ 01:27

Hi kalex718 can you turn this into a robot and upload it? thanks.

CityClyk_Holdings - November 18, 2014 @ 17:26

This Indicator is useful on H1 Chart.

5