RSI indicator line will not display. Please help. I'm still learning how to code.
RSI indicator line will not display. Please help. I'm still learning how to code.
21 Oct 2022, 14:13
Hello Good day.
I just started studying how to code on ctrader. Can you please help me? RSI line will not display. I tried to debug the code but I cant find the error.
-------------------------------------------------------------------------------------
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
{
//[Levels (30.0, 50.0, 70.0)]
[Indicator(AccessRights = AccessRights.None)]
public class RSITELEGRAMALERTS : Indicator
{
#region user settings
[Parameter("Period",Group ="Indicator Data", MinValue =0, MaxValue = 100, DefaultValue = 14)]
public int Period { get; set; }
[Parameter("Source", Group = "Indicator Data")]
public DataSeries Source { get; set; }
[Parameter("UpperThreshold", DefaultValue = 70, Group ="Indicator Data")]
public double UpperThreshold { get; set; }
[Parameter("LowerThreshold", DefaultValue = 30, Group ="Indicator Data")]
public double LowerThreshold { get; set; }
[Parameter("Send a Telegram?", DefaultValue = false, Group ="Telegram Notifications")]
public bool IncludeTelegram { get; set; }
[Parameter("Bot Token", DefaultValue = "", Group ="Telegram Notifications" )]
public string BotToken { get; set; }
[Parameter("Chat ID", DefaultValue = "", Group ="Telegram Notifications")]
public string ChatID { get; set; }
[Output("Main", PlotType = PlotType.Histogram, LineColor = "Green", Thickness = 2)]
public IndicatorDataSeries Result { get; set; }
#endregion
public RelativeStrengthIndex Rsi { get; set;}
protected override void Initialize()
{
Rsi = Indicators.RelativeStrengthIndex (Source, Period);
}
public override void Calculate(int index)
{
// Calculate value at specified index
Result[index] = Rsi.Result[index];
}
}
}
-----------------------------------------
I would humbly appreciate your help and much thank you in advance.