Category Other  Published on 10/12/2023

Pivot Point Camarilla

Description

Pivot Point Camarilla for using the stochastique camarilla here : https://ctrader.com/algos/indicators/show/3820


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PivotPointCamarilla : Indicator
    {

        [Parameter("Time Frame", DefaultValue = "Daily")]
        public TimeFrame TF { get; set; }

        [Output("Pivot", LineColor = "7200FFFF", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries p { get; set; }
        [Output("M", LineColor = "8EFFA500", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries m { get; set; }
        [Output("MH", LineColor = "6CFFFFFF", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries mh { get; set; }
        [Output("ML", LineColor = "6CFFFFFF", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries ml { get; set; }
        [Output("R1", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r1 { get; set; }
        [Output("R2", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r2 { get; set; }
        [Output("R3", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r3 { get; set; }
        [Output("R4", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r4 { get; set; }
        [Output("R5", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r5 { get; set; }
        [Output("R6", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r6 { get; set; }
        [Output("R7", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r7 { get; set; }
        [Output("R8", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r8 { get; set; }
        [Output("R9", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r9 { get; set; }
        [Output("R10", LineColor = "66008000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries r10 { get; set; }
        [Output("S1", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s1 { get; set; }
        [Output("S2", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s2 { get; set; }
        [Output("S3", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s3 { get; set; }
        [Output("S4", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s4 { get; set; }
        [Output("S5", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s5 { get; set; }
        [Output("S6", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s6 { get; set; }
        [Output("S7", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s7 { get; set; }
        [Output("S8", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s8 { get; set; }
        [Output("S9", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s9 { get; set; }
        [Output("S10", LineColor = "47FF0000", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries s10 { get; set; }

        private Bars bars;
        private int indexBase;
        private IndicatorDataSeries High;
        private IndicatorDataSeries Low;

        private IndicatorDataSeries Open;
        private IndicatorDataSeries Close;

        protected override void Initialize()
        {
            bars = MarketData.GetBars(TF);

            High = CreateDataSeries();
            Low = CreateDataSeries();
            Open = CreateDataSeries();
            Close = CreateDataSeries();
        }
        public override void Calculate(int index)
        {
            indexBase = bars.OpenTimes.GetIndexByTime(Bars.OpenTimes.Last(1));

            High[index] = bars.HighPrices[indexBase - 1];
            Low[index] = bars.LowPrices[indexBase - 1];
            Open[index] = bars.OpenPrices[indexBase - 1];
            Close[index] = bars.ClosePrices[indexBase - 1];


            p[index] = (High[index] + Low[index] + Close[index]) / 3.0;

            m[index] = Close[index];

            ml[index] = Close[index] - (High[index] - Low[index]) * 1.1 / 24;
            mh[index] = Close[index] + (High[index] - Low[index]) * 1.1 / 24;

            r1[index] = Close[index] + (High[index] - Low[index]) * 1.1 / 12.0;
            s1[index] = Close[index] - (High[index] - Low[index]) * 1.1 / 12.0;

            r2[index ] = Close[index] + (High[index] - Low[index]) * 1.1 / 6.0;
            s2[index ] = Close[index] - (High[index] - Low[index]) * 1.1 / 6.0;

            r3[index ] = Close[index] + (High[index] - Low[index]) * 1.1 / 4.0;
            s3[index ] = Close[index] - (High[index] - Low[index]) * 1.1 / 4.0;

            r4[index ] = Close[index] + (High[index] - Low[index]) * 1.1 / 2.0;
            s4[index ] = Close[index] - (High[index] - Low[index]) * 1.1 / 2.0;

            r5[index ] = Close[index] + (High[index] - Low[index]) * 1.1 * 3.0 / 4.0;
            s5[index ] = Close[index] - (High[index] - Low[index]) * 1.1 * 3.0 / 4.0;

            r6[index ] = Close[index] + (High[index] - Low[index]) * 1.1;
            s6[index ] = Close[index] - (High[index] - Low[index]) * 1.1;

            r7[index] = Close[index] + (High[index] - Low[index]) * 1.1 * 5.0 / 4.0;
            s7[index ] = Close[index] - (High[index] - Low[index]) * 1.1 * 5.0 / 4.0;

            r8[index] = Close[index] + (High[index] - Low[index]) * 1.1 * 3.0 / 2.0;
            s8[index ] = Close[index] - (High[index] - Low[index]) * 1.1 * 3.0 / 2.0;

        }
    }
}






YE
YesOrNot

Joined on 10.10.2022 Blocked

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Pivot Point Camarilla.algo
  • Rating: 5
  • Installs: 493
  • Modified: 10/12/2023 21:53
Comments
Log in to add a comment.
No comments found.