Average Wick Indicator

by Xavier R in category Other at 11/02/2016
Description

I decided to make a simple indicator to see how wicks behave, some cool patterns seem to emerge.

You can see for example Upwicks tend to be bigger in downtrends and viceversa.

Download
1146 downloads
How to install
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 System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;


namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class AverageWick : Indicator
    {
        [Parameter("Period", DefaultValue = 10)]
        public int _Period { get; set; }

        [Output("UpWick", Color = Colors.Blue)]
        public IndicatorDataSeries _UpWick { get; set; }
        [Output("DownWick", Color = Colors.Red)]
        public IndicatorDataSeries _DownWick { get; set; }

        double _upresult, _downresult;

        protected override void Initialize()
        {
        }

        public override void Calculate(int index)
        {
            if (MarketSeries.Open.LastValue < MarketSeries.Close.LastValue)
            {
                for (int i = _Period; i >= 1; i--)
                {
                    _upresult += MarketSeries.High.Last(i) - MarketSeries.Close.Last(i);
                }
                _UpWick[index] = (_upresult / _Period) / Symbol.PipSize;
                _upresult = 0;
            }
            else if (MarketSeries.Open.LastValue > MarketSeries.Close.LastValue)
            {
                for (int i = _Period; i >= 1; i--)
                {
                    _downresult += MarketSeries.Close.Last(i) - MarketSeries.Low.Last(i);
                }
                _DownWick[index] = (_downresult / _Period) / Symbol.PipSize;
                _downresult = 0;
            }
        }
    }
}


Comments
5