Warning! This section will be deprecated on February 1st 2025. Please move all your Indicators to the cTrader Store catalogue.
Description
This indicator calculates the RSI based on the median price. If the RSI is > 50, the HighPrice values are displayed; if it is < 50, the LowPrice values are displayed.
Enjoy for Free =)
Previous account here : https://ctrader.com/users/profile/70920
Contact telegram : https://t.me/nimi012
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
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class TheRsiv10 : Indicator
{
[Parameter(DefaultValue = 14, Group = "RSI")]
public int PeriodRSI { get; set; }
[Parameter(DefaultValue = 1, Group = "RSI")]
public int PeriodSmoothRSI { get; set; }
[Parameter(DefaultValue = MovingAverageType.Weighted, Group = "RSI")]
public MovingAverageType MaTypeSmoothRSI { get; set; }
[Parameter(DefaultValue = 9, Group = "Signal")]
public int PeriodSignalRSI { get; set; }
[Parameter(DefaultValue = MovingAverageType.Weighted, Group = "Signal")]
public MovingAverageType MaTypeSignalRSI { get; set; }
[Parameter(DefaultValue = EnumMethod.High_Low, Group = "Calculation")]
public EnumMethod Method { get; set; }
public enum EnumMethod
{
High_Low,
Swhitch_High_Low
}
[Parameter(DefaultValue = 70, Group = "OverBuy/Sell Level")]
public int OverBuy { get; set; }
[Parameter(DefaultValue = 30, Group = "OverBuy/Sell Level")]
public int OverSell { get; set; }
[Output("LevelUp", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid)]
public IndicatorDataSeries LevelUp { get; set; }
[Output("LevelMid", LineColor = "Gray", PlotType = PlotType.Line, LineStyle = LineStyle.Solid)]
public IndicatorDataSeries LevelMid { get; set; }
[Output("LevelDown", LineColor = "Lime", PlotType = PlotType.Line, LineStyle = LineStyle.Solid)]
public IndicatorDataSeries LevelDown { get; set; }
[Output("Result", LineColor = "Lime", PlotType = PlotType.Line, LineStyle = LineStyle.Solid)]
public IndicatorDataSeries Result { get; set; }
[Output("Signal Init", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid)]
public IndicatorDataSeries Singal { get; set; }
private IndicatorDataSeries highData, medData, lowData, res1;
private MovingAverage smooth, signal;
private RelativeStrengthIndex rsiHigh, rsiMed, rsiLow;
protected override void Initialize()
{
highData = CreateDataSeries();
medData = CreateDataSeries();
lowData = CreateDataSeries();
res1 = CreateDataSeries();
rsiHigh = Indicators.RelativeStrengthIndex(Bars.HighPrices, PeriodRSI);
rsiMed = Indicators.RelativeStrengthIndex(Bars.MedianPrices, PeriodRSI);
rsiLow = Indicators.RelativeStrengthIndex(Bars.LowPrices, PeriodRSI);
smooth = Indicators.MovingAverage(res1, PeriodSmoothRSI, MaTypeSmoothRSI);
signal = Indicators.MovingAverage(smooth.Result, PeriodSignalRSI, MaTypeSignalRSI);
}
public override void Calculate(int index)
{
highData[index] = rsiHigh.Result.Last(0);
medData[index] = rsiMed.Result.Last(0);
lowData[index] = rsiLow.Result.Last(0);
res1[index] = Method == EnumMethod.High_Low ? medData[index] > 50 ? highData[index] : medData[index] < 50 ? lowData[index] : medData[index] : medData[index] < 50 ? highData[index] : medData[index] > 50 ? lowData[index] : medData[index];
Result[index] = smooth.Result.Last(0);
Singal[index] = signal.Result.Last(0);
LevelUp[index] = OverBuy;
LevelMid[index] = 50;
LevelDown[index] = OverSell;
}
}
}
YE
YesOrNot2
Joined on 17.05.2024
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: The Rsi Hilo.algo
- Rating: 5
- Installs: 414
- Modified: 23/07/2024 01:35
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.