Category Other  Published on 19/11/2020

Pivot Channels

Description

This is the building block indicator for this:

 It will help you view the pivot lines (support, resistance, pivot, high, low) from a higher time frame on your chart.

Find us at https://fxtradersystems.com


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Cloud("Yesterday's High", "Yesterday's Low")]
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PivotChannels : Indicator
    {

        [Parameter("High Bars")]
        public DataSeries HighBars { get; set; }

        [Parameter("Low Bars")]
        public DataSeries LowBars { get; set; }

        [Parameter("Close Bars")]
        public DataSeries CloseBars { get; set; }


        [Output("Pivot", LineColor = "White")]
        public IndicatorDataSeries Pivot { get; set; }

        [Output("Yesterday's Low", LineColor = "Cyan")]
        public IndicatorDataSeries YestLow { get; set; }

        [Output("Support 1", LineColor = "LawnGreen")]
        public IndicatorDataSeries Support1 { get; set; }

        [Output("Support 2", LineColor = "Lime")]
        public IndicatorDataSeries Support2 { get; set; }

        [Output("Support 3", LineColor = "Green")]
        public IndicatorDataSeries Support3 { get; set; }

        [Output("Yesterday's High", LineColor = "Cyan")]
        public IndicatorDataSeries YestHigh { get; set; }

        [Output("Resistance 1", LineColor = "Tomato")]
        public IndicatorDataSeries Resistance1 { get; set; }

        [Output("Resistance 2", LineColor = "Red")]
        public IndicatorDataSeries Resistance2 { get; set; }

        [Output("Resistance 3", LineColor = "DarkRed")]
        public IndicatorDataSeries Resistance3 { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            if (index == 0)
                return;

            Pivot[index] = (HighBars[index - 1] + LowBars[index - 1] + CloseBars[index - 1]) / 3;

            YestHigh[index] = HighBars[index - 1];
            YestLow[index] = LowBars[index - 1];

            Resistance1[index] = (2 * Pivot[index]) - LowBars[index - 1];
            Support1[index] = (2 * Pivot[index]) - HighBars[index - 1];

            Resistance2[index] = (Pivot[index] - Support1[index]) + Resistance1[index];
            Support2[index] = Pivot[index] + Support1[index] - Resistance1[index];

            Resistance3[index] = Pivot[index] - Support2[index] + Resistance2[index];
            Support3[index] = Pivot[index] + Support2[index] - Resistance2[index];

        }
    }
}


fxtradersystems's avatar
fxtradersystems

Joined on 10.09.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Pivot Channels.algo
  • Rating: 0
  • Installs: 2147
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.