Description
This indicator is a stochastic of Camarilla pivot points ranging from R8 to S8. The indicator references three timeframes to establish its calculation.
Make the pivot point camarilla as reference : https://ctrader.com/algos/indicators/show/3819
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
{
[Levels(80, 50, 20)]
[Indicator(AccessRights = AccessRights.None)]
public class PivotPointCamarillaStoch : Indicator
{
[Parameter("Time Frame 1 ", DefaultValue = "Daily")]
public TimeFrame TF1 { get; set; }
[Parameter("Time Frame 2 ", DefaultValue = "Weekly")]
public TimeFrame TF2 { get; set; }
[Parameter("Time Frame 3 ", DefaultValue = "Monthly")]
public TimeFrame TF3 { get; set; }
[Parameter("Smooth Period", DefaultValue = 144)]
public int SmoothPeriod { get; set; }
[Parameter("Smooth MaType", DefaultValue = MovingAverageType.Weighted)]
public MovingAverageType SmoothMaType { get; set; }
[Parameter("Signal Period", DefaultValue = 255)]
public int SignalPeriod { get; set; }
[Parameter("Signal MaType", DefaultValue = MovingAverageType.Weighted)]
public MovingAverageType SignalMaType { get; set; }
[Output("Result °", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, LineColor = "White", Thickness = 1)]
public IndicatorDataSeries Result { get; set; }
[Output("Smooth °", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, LineColor = "Lime", Thickness = 1)]
public IndicatorDataSeries Smooth { get; set; }
[Output("Signal °", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, LineColor = "Red", Thickness = 1)]
public IndicatorDataSeries Signal { get; set; }
private PivotPointCamarilla[] pivot;
private IndicatorDataSeries[] res;
private MovingAverage ma;
private MovingAverage smooth;
protected override void Initialize()
{
res = new IndicatorDataSeries[6];
for (int i = 0; i < 3; i++)
{
res[i] = CreateDataSeries();
}
pivot = new PivotPointCamarilla[3];
pivot[0] = Indicators.GetIndicator<PivotPointCamarilla>(TF1);
pivot[1] = Indicators.GetIndicator<PivotPointCamarilla>(TF2);
pivot[2] = Indicators.GetIndicator<PivotPointCamarilla>(TF3);
smooth = Indicators.MovingAverage(Result, SmoothPeriod, SmoothMaType);
ma = Indicators.MovingAverage(Smooth, SignalPeriod, SignalMaType);
}
public override void Calculate(int index)
{
var resIndicator = 0.0;
for (int i = 0; i < 3; i++)
{
res[i][index] = (Bars.ClosePrices[index] - pivot[i].s8[index]) / (pivot[i].r8[index] - pivot[i].s8[index]) * 100;
resIndicator += res[i][index];
}
Result[index] = resIndicator / 3;
Smooth[index] = smooth.Result.Last(0);
Signal[index] = ma.Result.Last(0);
Print(pivot[0].s8[index]);
}
}
}
YE
YesOrNot
Joined on 10.10.2022 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Pivot Point Camarilla Stoch.algo
- Rating: 5
- Installs: 506
- Modified: 10/12/2023 21:59
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.