Description
HiLo Range indicator.
Trade long when indicator is above zero level, trade Short when indicator is below the zero level.
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(0, -100, +100)]
[Indicator(AccessRights = AccessRights.None)]
public class mHILOrange : Indicator
{
[Parameter("Range Bars (40)", DefaultValue = 40)]
public int inpRangeBars { get; set; }
[Output("High/Low Range", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outHILOrange { get; set; }
private IndicatorDataSeries _hh, _ll, _hl, _hlr;
protected override void Initialize()
{
_hh = CreateDataSeries();
_ll = CreateDataSeries();
_hl = CreateDataSeries();
_hlr = CreateDataSeries();
}
public override void Calculate(int i)
{
_hh[i] = i>inpRangeBars ? Bars.HighPrices.Maximum(inpRangeBars) : Bars.HighPrices[i];
_ll[i] = i>inpRangeBars ? Bars.LowPrices.Minimum(inpRangeBars) : Bars.LowPrices[i];
_hl[i] = _hh[i] - _ll[i];
_hlr[i] = _hl[i] != 0 ? (200.0 * (((Bars.HighPrices[i] + Bars.LowPrices[i]) / 2.0) - _ll[i]) / _hl[i]) - 100 : 0;
outHILOrange[i] = _hlr[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mHILOrange.algo
- Rating: 5
- Installs: 650
- Modified: 16/01/2023 17:18
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.