Description
Rsi Super TDI 3.0 is a comprehensive indicator that allows you to use the RSI in several different ways.
1. Candle: The candles represent the Open, Close, High, Low values of the RSI.
2. Histogram: Histogram values work like an accelerator (the greater the gap between the two MAs, the greater the accelerator, the smaller the gap between the two MAs, the smaller the accelerator). This histogram also has a sensitivity function to filter out signals that are too weak (white histogram).
3. Signals: You have 2 signal clouds that allow you to correctly locate the signal strength (the values are taken from the ClosePrices).
4. Bollinger: You have 3 Bollinger bands (values are taken from the ClosePrices).
5. Fractal: For fun, Fractals on RSI
Have fun, and for any collaboration, contact me !!!
On telegram : https://t.me/nimi012 (direct messaging)
On Discord: https://discord.gg/jNg7BSCh (I advise you to come and see, Money management strategies and Signals Strategies !)
**** Update **** 05/09/2023
- Stabilisation : return if the index < max period
- Function max/min
- Incorportation of max/min function to the code.
**** Update **** 08/09/2023
- Delete the minimum value of Histogram
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
{
[Cloud("MA Signal Fast 1", "MA Signal Fast 2")]
[Cloud("MA Signal Slow 1", "MA Signal Slow 2")]
[Levels(100, 70, 50, 30)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class RsiSuperTDI30 : Indicator
{
[Parameter("Period Rsi", DefaultValue = 13, MinValue = 1, Group = "---RSI PERIODS---")]
public int PeriodRsi { get; set; }
[Parameter("Thickness Candle", DefaultValue = 3, MinValue = 1, MaxValue = 5, Group = "---RSI PERIODS---")]
public int ThicknessCandle { get; set; }
[Parameter("Use Histogram", DefaultValue = "true", Group = "---HISTOGRAM---")]
public bool UseHistogram { get; set; }
[Parameter("Sensibility Histo", DefaultValue = 2, Group = "---HISTOGRAM---")]
public int Sensibility { get; set; }
[Parameter("MA Signal Fast", DefaultValue = 3, MinValue = 1, Group = "---HISTOGRAM---")]
public int MaSignalFastHisto { get; set; }
[Parameter("Ma Type Fast", DefaultValue = MovingAverageType.Weighted, Group = "---HISTOGRAM---")]
public MovingAverageType MaTypeSignalFastHisto { get; set; }
[Parameter("MA Signal Fast 2", DefaultValue = 13, MinValue = 1, Group = "---HISTOGRAM---")]
public int MaSignalFast2Histo { get; set; }
[Parameter("Ma Type Fast 2", DefaultValue = MovingAverageType.Weighted, Group = "---HISTOGRAM---")]
public MovingAverageType MaTypeSignalFast2Histo { get; set; }
[Parameter("Use Signal", DefaultValue = "true", Group = "---SIGNAL---")]
public bool UseSignal { get; set; }
[Parameter("Signal Fast ", DefaultValue = 3, MinValue = 1, Group = "---SIGNAL---")]
public int Smooth1 { get; set; }
[Parameter("Ma Type ", DefaultValue = MovingAverageType.Weighted, Group = "---SIGNAL---")]
public MovingAverageType MaType1 { get; set; }
[Parameter("Signal Fast 2", DefaultValue = 8, MinValue = 1, Group = "---SIGNAL---")]
public int Smooth2 { get; set; }
[Parameter("Ma Type ", DefaultValue = MovingAverageType.Weighted, Group = "---SIGNAL---")]
public MovingAverageType MaType2 { get; set; }
[Parameter("Signal Low ", DefaultValue = 21, MinValue = 1, Group = "---SIGNAL---")]
public int Signal { get; set; }
[Parameter("Ma Type ", DefaultValue = MovingAverageType.Weighted, Group = "---SIGNAL---")]
public MovingAverageType MaTypeSignal { get; set; }
[Parameter("Signal Low 2 ", DefaultValue = 34, MinValue = 1, Group = "---SIGNAL---")]
public int Signal2 { get; set; }
[Parameter("Ma Type ", DefaultValue = MovingAverageType.Weighted, Group = "---SIGNAL---")]
public MovingAverageType MaTypeSignal2 { get; set; }
[Parameter("Use Fractal Signal", DefaultValue = "False", Group = "---FRACTAL---")]
public bool UseFractal { get; set; }
[Parameter(DefaultValue = 3, MinValue = 1, Group = "---FRACTAL---")]
public int Period { get; set; }
[Parameter("Use Bollinger Bands", DefaultValue = "false", Group = "---BOLLINGER---")]
public bool UseBoll { get; set; }
[Parameter("Periode Boll", DefaultValue = 34, MinValue = 1, Group = "---BOLLINGER---")]
public int PeriodeBoll { get; set; }
[Parameter("DevBoll", DefaultValue = 1, MinValue = 0.001, Group = "---BOLLINGER---")]
public double DevBoll { get; set; }
[Parameter("DevBoll 2", DefaultValue = 2, MinValue = 0.001, Group = "---BOLLINGER---")]
public double DevBoll2 { get; set; }
[Parameter("DevBoll 3", DefaultValue = 3, MinValue = 0.001, Group = "---BOLLINGER---")]
public double DevBoll3 { get; set; }
[Parameter("Ma Boll", DefaultValue = MovingAverageType.Simple, Group = "---BOLLINGER---")]
public MovingAverageType MaTypeBoll { get; set; }
[Parameter("Use Level Bands", DefaultValue = "true", Group = "---LEVELS---")]
public bool UseLevel { get; set; }
[Parameter("levelup 1", DefaultValue = 40, Group = "---LEVELS---")]
public int SetLevelUp1 { get; set; }
[Parameter("leveldown 1", DefaultValue = 60, Group = "---LEVELS---")]
public int SetLevelDown1 { get; set; }
[Parameter("levelup 2", DefaultValue = 70, Group = "---LEVELS---")]
public int SetLevelUp2 { get; set; }
[Parameter("leveldown 2", DefaultValue = 30, Group = "---LEVELS---")]
public int SetLevelDown2 { get; set; }
[Parameter("levelup 3", DefaultValue = 80, Group = "---LEVELS---")]
public int SetLevelUp3 { get; set; }
[Parameter("leveldown 3", DefaultValue = 20, Group = "---LEVELS---")]
public int SetLevelDown3 { get; set; }
[Parameter("Level Middle 50", DefaultValue = 50, Group = "---LEVELS---")]
public int SetLevelMiddle { get; set; }
[Parameter("level for center graph ", DefaultValue = 100, Group = "---LEVELS---")]
public int SetLevelForCenter { get; set; }
[Output("Result Close", LineColor = "transparent", PlotType = PlotType.Points)]
public IndicatorDataSeries ResultClose { get; set; }
[Output("Result Open", LineColor = "transparent", PlotType = PlotType.Points)]
public IndicatorDataSeries ResultOpen { get; set; }
[Output("Result High", LineColor = "transparent", PlotType = PlotType.Points)]
public IndicatorDataSeries ResultHigh { get; set; }
[Output("Result Low", LineColor = "transparent", PlotType = PlotType.Points)]
public IndicatorDataSeries ResultLow { get; set; }
[Output("MA Signal Fast 1", LineColor = "D3008000", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries MaSignalFast1 { get; set; }
[Output("MA Signal Fast 2", LineColor = "D5FF0000", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries MaSignalFast2 { get; set; }
[Output("MA Signal Slow 1", LineColor = "D3008000", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries MaSignalSlow1 { get; set; }
[Output("MA Signal Slow 2", LineColor = "D5FF0000", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries MaSignalSlow2 { get; set; }
[Output("White", PlotType = PlotType.Histogram, LineColor = "White", Thickness = 4)]
public IndicatorDataSeries White { get; set; }
[Output("Up Bullish", PlotType = PlotType.Histogram, LineColor = "Lime", Thickness = 4)]
public IndicatorDataSeries StrongBullish { get; set; }
[Output("Down Bullish", PlotType = PlotType.Histogram, LineColor = "Green", Thickness = 4)]
public IndicatorDataSeries WeakBullish { get; set; }
[Output("Down Bearish", PlotType = PlotType.Histogram, LineColor = "Red", Thickness = 4)]
public IndicatorDataSeries StrongBearish { get; set; }
[Output("Up Bearish", PlotType = PlotType.Histogram, LineColor = "DarkSalmon", Thickness = 4)]
public IndicatorDataSeries WeakBearish { get; set; }
[Output("Fractal Up ", LineColor = "Lime", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries UpFractal { get; set; }
[Output("Fractal Down ", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries DownFractal { get; set; }
[Output("Boll Top Dev 1", LineColor = "Lime", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma1T { get; set; }
[Output("Boll Midd Dev 1", LineColor = "White", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma1M { get; set; }
[Output("Boll Low Dev 1", LineColor = "Red", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma1L { get; set; }
[Output("Boll Top Dev 2", LineColor = "45FFD700", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma2T { get; set; }
public IndicatorDataSeries Ma2M { get; set; }
[Output("Boll Low Dev 2", LineColor = "45FFD700", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma2L { get; set; }
[Output("Boll Top Dev 3", LineColor = "3CFFFF00", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma3T { get; set; }
public IndicatorDataSeries Ma3M { get; set; }
[Output("Boll Low Dev 3", LineColor = "3CFFFF00", LineStyle = LineStyle.LinesDots, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries Ma3L { get; set; }
[Output("Level up 1", LineColor = "7EC0C0C0", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelUp1 { get; set; }
[Output("Level down 1", LineColor = "7EC0C0C0", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelDown1 { get; set; }
[Output("Level up 2", LineColor = "4AFFFF00", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelUp2 { get; set; }
[Output("Level down 2", LineColor = "4AFFFF00", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelDown2 { get; set; }
[Output("Level up 3", LineColor = "Red", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelUp3 { get; set; }
[Output("Level down 3", LineColor = "Red", LineStyle = LineStyle.DotsRare, PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries LevelDown3 { get; set; }
[Output("Level Middle50", LineColor = "7EC0C0C0", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 2)]
public IndicatorDataSeries LevelMiddle { get; set; }
[Output("Level 0", LineColor = "7EC0C0C0", LineStyle = LineStyle.Solid, PlotType = PlotType.Line, Thickness = 2)]
public IndicatorDataSeries LevelForCenter { get; set; }
private RelativeStrengthIndex rsiClose, rsiOpen, rsiHigh, rsiLow;
private MovingAverage maSignalF, maSignalF2, maSignalL, maSignalL2, maSignalFHisto, maSignalF2Histo;
private BollingerBands boll, boll2, boll3;
protected override void Initialize()
{
rsiClose = Indicators.RelativeStrengthIndex(Bars.ClosePrices, PeriodRsi);
rsiOpen = Indicators.RelativeStrengthIndex(Bars.OpenPrices, PeriodRsi);
rsiHigh = Indicators.RelativeStrengthIndex(Bars.HighPrices, PeriodRsi);
rsiLow = Indicators.RelativeStrengthIndex(Bars.LowPrices, PeriodRsi);
maSignalF = Indicators.MovingAverage(ResultClose, Smooth1, MaType1);
maSignalF2 = Indicators.MovingAverage(ResultClose, Smooth2, MaType2);
maSignalL = Indicators.MovingAverage(ResultClose, Signal, MaTypeSignal);
maSignalL2 = Indicators.MovingAverage(ResultClose, Signal2, MaTypeSignal2);
maSignalFHisto = Indicators.MovingAverage(ResultClose, MaSignalFastHisto, MaTypeSignalFastHisto);
maSignalF2Histo = Indicators.MovingAverage(ResultClose, MaSignalFast2Histo, MaTypeSignalFast2Histo);
boll = Indicators.BollingerBands(ResultClose, PeriodeBoll, DevBoll, MaTypeBoll);
boll2 = Indicators.BollingerBands(ResultClose, PeriodeBoll, DevBoll2, MaTypeBoll);
boll3 = Indicators.BollingerBands(ResultClose, PeriodeBoll, DevBoll3, MaTypeBoll);
}
public override void Calculate(int index)
{
if (index < Max(PeriodRsi, Smooth1, Smooth2, Signal, Signal2, MaSignalFastHisto, MaSignalFast2Histo, PeriodeBoll))
return;
ResultClose[index] = rsiClose.Result[index];
ResultOpen[index] = rsiOpen.Result[index];
ResultHigh[index] = rsiHigh.Result[index];
ResultLow[index] = rsiLow.Result[index];
IndicatorArea.DrawTrendLine("Body_" + index.ToString(), index, ResultClose[index], index, ResultOpen[index], (ResultClose[index] > ResultOpen[index] ? Color.Lime : Color.Red), ThicknessCandle);
IndicatorArea.DrawTrendLine("Tail_" + index.ToString(), index, Min(ResultLow[index], ResultOpen[index], ResultClose[index]), index, Max(ResultHigh[index], ResultOpen[index], ResultClose[index]), (ResultClose[index] > ResultOpen[index] ? Color.Lime : Color.Red), 1);
if (UseSignal)
{
MaSignalFast1[index] = maSignalF.Result[index];
MaSignalFast2[index] = maSignalF2.Result[index];
MaSignalSlow1[index] = maSignalL.Result[index];
MaSignalSlow2[index] = maSignalL2.Result[index];
}
if (UseHistogram)
{
double HistogramValue = maSignalFHisto.Result[index] - maSignalF2Histo.Result[index];
double prevHistogramValue = maSignalFHisto.Result[index - 1] - maSignalF2Histo.Result[index - 1];
if (HistogramValue > Sensibility)
{
if (prevHistogramValue >= HistogramValue)
{
WeakBullish[index] = HistogramValue;
StrongBullish[index] = 0;
WeakBearish[index] = 0;
StrongBearish[index] = 0;
White[index] = 0;
}
else
{
StrongBullish[index] = HistogramValue;
WeakBullish[index] = 0;
WeakBearish[index] = 0;
StrongBearish[index] = 0;
White[index] = 0;
}
}
else if (HistogramValue < -Sensibility)
{
if (HistogramValue <= prevHistogramValue)
{
StrongBearish[index] = HistogramValue;
WeakBearish[index] = 0;
StrongBullish[index] = 0;
WeakBullish[index] = 0;
White[index] = 0;
}
else
{
WeakBearish[index] = HistogramValue;
StrongBearish[index] = 0;
StrongBullish[index] = 0;
WeakBullish[index] = 0;
White[index] = 0;
}
}
else
{
if (HistogramValue <= prevHistogramValue)
{
White[index] = HistogramValue;
WeakBearish[index] = 0;
WeakBearish[index] = 0;
StrongBullish[index] = 0;
WeakBullish[index] = 0;
}
else
{
WeakBearish[index] = 0;
White[index] = HistogramValue;
StrongBearish[index] = 0;
StrongBullish[index] = 0;
WeakBullish[index] = 0;
}
}
}
if (UseLevel)
{
LevelUp1[index] = SetLevelUp1;
LevelUp2[index] = SetLevelUp2;
LevelUp3[index] = SetLevelUp3;
LevelMiddle[index] = SetLevelMiddle;
LevelDown1[index] = SetLevelDown1;
LevelDown2[index] = SetLevelDown2;
LevelDown3[index] = SetLevelDown3;
LevelForCenter[index] = SetLevelForCenter;
}
if (UseBoll)
{
Ma1T[index] = boll.Top.Last(0);
Ma1M[index] = boll.Main.Last(0);
Ma1L[index] = boll.Bottom.Last(0);
Ma2T[index] = boll2.Top.Last(0);
Ma2L[index] = boll2.Bottom.Last(0);
Ma3T[index] = boll3.Top.Last(0);
Ma3L[index] = boll3.Bottom.Last(0);
}
if (UseFractal)
{
if (index < Period)
return;
DrawUpFractal(index);
DrawDownFractal(index);
}
}
private void DrawUpFractal(int index)
{
int period = Period % 2 == 0 ? Period - 1 : Period;
int middleIndex = index - period / 2;
double middleValue = ResultClose[middleIndex];
bool up = true;
for (int i = 0; i < period; i++)
{
if (middleValue < ResultClose[index - i])
{
up = false;
break;
}
}
if (up)
UpFractal[middleIndex] = middleValue;
}
private void DrawDownFractal(int index)
{
int period = Period % 2 == 0 ? Period - 1 : Period;
int middleIndex = index - period / 2;
double middleValue = ResultClose[middleIndex];
bool down = true;
for (int i = 0; i < period; i++)
{
if (middleValue > ResultClose[index - i])
{
down = false;
break;
}
}
if (down)
DownFractal[middleIndex] = middleValue;
}
static double Max(params double[] numbers)
{
return numbers.Max();
}
static double Min(params double[] numbers)
{
return numbers.Min();
}
}
}
YesOrNot
Joined on 10.10.2022 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Rsi Super TDI 3.0.algo
- Rating: 5
- Installs: 685
- Modified: 08/09/2023 06:01
Comments
Line 26 : you can change the min value to 0 for better functionnality
[Parameter("Sensibility Histo", DefaultValue = 2, MinValue = 0, Group = "---HISTOGRAM---")]
I have a small suggestion
Avoid magic numbers: Replace magic numbers with constants or named variables. For example, replace ThicknessCandle = 3 with const int CandleThickness = 3.