Description
This indicator is based on the Smoothed High And Low Overlay Bands indicator and explores the highs evolution to its highs band and the lows to its low band.
It is curious to observe the divergences. It is not the definitive solution but one day it will come.
It is an indicator based on moving averages and it is consequently lagged, (one period I think), although the averages are accelerated by overweighting the most recent highs and lows.
I would also like to dedicate it to Mister George Soros for his undoubted contribution to global financial stability. With respect and admiration.
(Even what sucks is subject to God's law)
(Even what sucks is subject to God's law)
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SmoothedHighAndLowOverlayBands : 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; }
[Output("Result3", LineColor = "Blue")]
public IndicatorDataSeries Result3 { get; set; }
private IndicatorDataSeries max, min;
private double hmax, lmax;
private double hmin, lmin;
private IndicatorDataSeries remora;
private double hremora, lremora;
protected override void Initialize()
{
max = CreateDataSeries();
min = CreateDataSeries();
remora = CreateDataSeries();
}
public override void Calculate(int index)
{
max[index] = 0;
min[index] = 0;
for (int i = 1; i <= Periods; i++)
{
max[index] += Bars.HighPrices.Maximum(i);
min[index] += Bars.LowPrices.Minimum(i);
}
max[index] = max[index] / Periods;
min[index] = min[index] / Periods;
hmax = 0;
lmax = 0;
hmin = 0;
lmin = 0;
for (int i = 1; i <= Periods; i++)
{
hmax += max.Maximum(i);
lmax += max.Minimum(i);
hmin += min.Maximum(i);
lmin += min.Minimum(i);
}
hmax = hmax / Periods;
lmax = lmax / Periods;
hmin = hmin / Periods;
lmin = lmin / Periods;
remora[index] = max[index] - hmax + min[index] - lmin;
hremora = 0;
lremora = 0;
for (int i = 1; i <= Periods; i++)
{
hremora += remora.Maximum(i);
lremora += remora.Minimum(i);
}
hremora = hremora / Periods;
lremora = lremora / Periods;
Result1[index] = hremora;
Result2[index] = lremora;
//Result3[index] = hremora + lremora;
Result3[index] = remora[index];
}
}
}
srm_bcn
Joined on 01.09.2019
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: SmoothedHighAndLowRemora.algo
- Rating: 0
- Installs: 1367
- Modified: 13/10/2021 09:54
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.