category Other  at 26/04/2023

Pivot w optional CPR and Mids


Conventional Pivot, CPR and Mid levels are optional.

Supported Day, Week and Month pivot.

PivotTimeFrame: Day, Week, Month.

ShowCPR: If Yes, also plot the Central Pivot Range levels.

ShowMids: If Yes, also plot the Mid levels.

Updated 26 Apr 2023:

  • Auto enforce PivotTimeFrame to avoid slow drawing:
    • If current TF > Hour: use Week pivot.
    • If current TF > Hour4: use Month pivot.
  • Zone: Ctrl + Click to toggle zone drawing in the dedicated pivot area. Zones are equally divided between 2 key levels. 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using LittleTrader;
using LittleTrader.Models.PriceActions;

namespace cAlgo
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class LT_Ind_Pivot : Indicator
        [Parameter(DefaultValue = PivotTimeFrames.Day)]
        public PivotTimeFrames PivotTimeFrame { get; set; }

        [Parameter(DefaultValue = false)]
        public bool ShowCPR { get; set; }

        [Parameter(DefaultValue = false)]
        public bool ShowMids { get; set; }

        [Parameter(DefaultValue = 3)]
        public int NumZones { get; set; }

        Pivot _pivot;
        PivotLevelTypes _levelType = PivotLevelTypes.Primary;
        protected override void Initialize()
            var tf = PivotTimeFrame;
            if (this.TimeFrame > TimeFrame.Hour)
                tf = PivotTimeFrames.Week;
            if (this.TimeFrame > TimeFrame.Hour4)
                tf = PivotTimeFrames.Month;

            // Initialize and create nested indicators
            if (ShowCPR) _levelType |= PivotLevelTypes.CPR;
            if (ShowMids) _levelType |= PivotLevelTypes.Secondary;
            _pivot = new Pivot(this, tf, _levelType, NumZones);

            Chart.MouseDown += e =>
                if (e.CtrlKey == true)
                    var index = (int)e.BarIndex;
                    _pivot.ToggleZones(Chart, index);

        public override void Calculate(int index)
                _pivot.Calculate(index, Chart);
            catch (Exception ex)


dhnhuy's avatar

Joined 03.04.2023

  • Type: free
  • Language: C#
  • Trading Platform: cTrader Automate
  • Filename: LT_Ind_Pivot.algo
  • Rating: 5
  • Downloads: 685
Only logged in users can post a comment
w.b.z · 5 days ago

Hi dhnhuy,

Thanks for all your great work and Discriptions!

One Question:

In the code you added:

using LittleTrader;
using LittleTrader.Models.PriceActions;

are those your selfmade references?

I have errors building you codes.

Please tell me how to get all you GREAT work to compile withou errors.


mehrdad08 · 1 month ago


lauryfriese932 · 4 months ago

It works great!! 

evanilson · 4 months ago

It works like a charm.

Thank you.

teyib88228 · 4 months ago

Плавна та безпечна їзда починається з правильних шин та дисків. Я знайшов чудове джерело для цих важливих компонентів на сайті . Широкий вибір, конкурентоспроможні ціни та простий у користуванні сайт роблять покупку шин і дисків безтурботним процесом. Я дуже задоволений своєю покупкою і настійно рекомендую цей сайт для всіх ваших потреб у шинах і колесах.