Description
The Relative Strength Index Wave Indicator, was created by Constance Brown.
This custom indicator is realized as a rainbow with RSI indicators calculated from different input data types; high, low, hlcc4, and four different smooth periods.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(30,50,70)]
[Indicator(AccessRights = AccessRights.None)]
public class mRelativeStrengthIndexWave : Indicator
{
[Parameter("RSI Period (14)", DefaultValue = 14, MinValue = 2)]
public int inpPeriodRSI { get; set; }
[Parameter("Smooth Period 1 (2)", DefaultValue = 2, MinValue = 2)]
public int inpSmoothPeriod1 { get; set; }
[Parameter("Smooth Period 2 (5)", DefaultValue = 5, MinValue = 2)]
public int inpSmoothPeriod2 { get; set; }
[Parameter("Smooth Period 3 (9)", DefaultValue = 9, MinValue = 2)]
public int inpSmoothPeriod3 { get; set; }
[Parameter("Smooth Period 4 (13)", DefaultValue = 13, MinValue = 2)]
public int inpSmoothPeriod4 { get; set; }
[Output("RSI IndexWave 1", LineColor = "00bcd4", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRSIiw1 { get; set; }
[Output("RSI IndexWave 2", LineColor = "ff9800", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRSIiw2 { get; set; }
[Output("RSI IndexWave 3", LineColor = "2962ff", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRSIiw3 { get; set; }
[Output("RSI IndexWave 4", LineColor = "787b86", LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outRSIiw4 { get; set; }
private IndicatorDataSeries _pricec, _priceh, _pricel, _raw;
private RelativeStrengthIndex _rsip, _rsih, _rsil;
private MovingAverage _smooth1, _smooth2, _smooth3, _smooth4;
protected override void Initialize()
{
_pricec = CreateDataSeries();
_priceh = CreateDataSeries();
_pricel = CreateDataSeries();
_rsip = Indicators.RelativeStrengthIndex(_pricec, inpPeriodRSI);
_rsih = Indicators.RelativeStrengthIndex(_priceh, inpPeriodRSI);
_rsil = Indicators.RelativeStrengthIndex(_pricel, inpPeriodRSI);
_raw = CreateDataSeries();
_smooth1 = Indicators.MovingAverage(_raw, inpSmoothPeriod1, MovingAverageType.Weighted);
_smooth2 = Indicators.MovingAverage(_raw, inpSmoothPeriod2, MovingAverageType.Weighted);
_smooth3 = Indicators.MovingAverage(_raw, inpSmoothPeriod3, MovingAverageType.Weighted);
_smooth4 = Indicators.MovingAverage(_raw, inpSmoothPeriod4, MovingAverageType.Weighted);
}
public override void Calculate(int i)
{
_pricec[i] = (Bars.HighPrices[i] + Bars.LowPrices[i] + Bars.ClosePrices[i] + Bars.ClosePrices[i]) / 4;
_priceh[i] = Bars.HighPrices[i];
_pricel[i] = Bars.LowPrices[i];
_raw[i] = (_rsih.Result[i] + _rsil.Result[i] + (2 * _rsip.Result[i])) / 4;
outRSIiw1[i] = _smooth1.Result[i];
outRSIiw2[i] = _smooth2.Result[i];
outRSIiw3[i] = _smooth3.Result[i];
outRSIiw4[i] = _smooth4.Result[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mRelativeStrengthIndexWaveIndicator.algo
- Rating: 5
- Installs: 710
- Modified: 11/03/2023 20:51
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.