Description
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
{
[Levels(0)]
[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;
Calculate(index);
_pivot.ToggleZones(Chart, index);
}
};
}
public override void Calculate(int index)
{
try
{
_pivot.Calculate(index, Chart);
}
catch (Exception ex)
{
Print(ex.ToString());
}
}
}
}

dhnhuy
Joined 03.04.2023
- Type: free
- Language: C#
- Trading Platform: cTrader Automate
- Filename: LT_Ind_Pivot.algo
- Rating: 5
- Downloads: 685
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.
Comments
Only logged in users can post a comment
ME
thanks
LA
EV
It works like a charm.
Thank you.
TE
Плавна та безпечна їзда починається з правильних шин та дисків. Я знайшов чудове джерело для цих важливих компонентів на сайті https://goroshina.ua/ . Широкий вибір, конкурентоспроможні ціни та простий у користуванні сайт роблять покупку шин і дисків безтурботним процесом. Я дуже задоволений своєю покупкою і настійно рекомендую цей сайт для всіх ваших потреб у шинах і колесах.
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.
Cheers