Description
In the image, the indicator loaded four times with periods 5, 15, 30 and 60
(This indicator does a lot of calculations, especially with long periods, and probably, older PC's, will need an internal ssd disk, , not SATA, M.2 or faster)
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SmoothedHighAndLowOverlay : Indicator
{
[Parameter("Periods", DefaultValue = 20)]
public int Periods { get; set; }
[Output("Result1", LineColor = "Red")]
public IndicatorDataSeries Result1 { get; set; }
[Output("Result2", LineColor = "Green")]
public IndicatorDataSeries Result2 { get; set; }
private double max, min;
protected override void Initialize()
{
}
public override void Calculate(int index)
{
max = 0;
min = 0;
for (int i = 1; i <= Periods; i++)
{
max += Bars.HighPrices.Maximum(i);
min += Bars.LowPrices.Minimum(i);
}
max = max / Periods;
min = min / Periods;
Result1[index] = max;
Result2[index] = min;
}
}
}
srm_bcn
Joined on 01.09.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: SmoothedHighAndLowOverlay.algo
- Rating: 0
- Installs: 1171
- Modified: 13/10/2021 09:54
Comments
Hello, do not repaint. As for lag, all moving averages are lagged, but in this indicator, the averages accelerate by overweighting the nearest lows and highs through an iterative process.
It is a weighted average, therefore, it is faster than the simple average but has the particularity of going through the minimums and the maximums of the closing price. Her interest lies not only in identifying the trend but also in looking for possible turning points around a close.
Thanks for your question. Good luck.
Does this repaint/lag? Seems like it works like simple MA, but kinda nicer look. :D Thx :)
Her insterest consist .. Sorry for translation xD