Tirone Levels indicator free

by mfejza in category Trend at 13/09/2022
Description

John Tirone Levels are a set of the appropriate support and resistance levels based on a trading range for a certain period of time.

Usually they are used only to improve visual perception of the market price moves. In this case, the Midpoint method is used for the calculation of all three Tirone Levels.

Market minimum and maximum for a certain period of time are calculated at first.

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 = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mTironeLevels : Indicator
    {
        [Parameter("Periods (15)", DefaultValue = 15)]
        public int inpPeriods { get; set; }

        [Output("Upper TironeLevels", IsHistogram = false, LineColor = "Magenta", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outTironeLevelsUpper { get; set; }
        [Output("Middle TironeLevels", IsHistogram = false, LineColor = "Magenta", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outTironeLevelsMiddle { get; set; }
        [Output("Lower TironeLevels", IsHistogram = false, LineColor = "Magenta", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outTironeLevelsLower { get; set; }

        private IndicatorDataSeries _hh, _ll, _up, _mid, _dn;


        protected override void Initialize()
        {
            _hh = CreateDataSeries();
            _ll = CreateDataSeries();
            _up = CreateDataSeries();
            _mid = CreateDataSeries();
            _dn = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _hh[i] = i > inpPeriods ? Bars.HighPrices.Maximum(inpPeriods) : Bars.HighPrices[i];
            _ll[i] = i > inpPeriods ? Bars.LowPrices.Minimum(inpPeriods) : Bars.LowPrices[i];
            _up[i] = _hh[i] - (_hh[i] - _ll[i]) / 3;
            _mid[i] = _ll[i] + (_hh[i] - _ll[i]) / 2;
            _dn[i] = _ll[i] + (_hh[i] - _ll[i]) / 3;

            outTironeLevelsUpper[i] = _up[i];
            outTironeLevelsMiddle[i] = _mid[i];
            outTironeLevelsLower[i] = _dn[i];
        }
    }
}
Comments
0