RSI alert under level 20
Created at 09 Sep 2021, 08:17
RSI alert under level 20
09 Sep 2021, 08:17
Hello,
how can I get alert on email when is RSI:
Under 20
Thanks.
Replies
amusleh
09 Sep 2021, 11:37
Hi,
Try this indicator:
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class RSIAlert : Indicator
{
private RelativeStrengthIndex _rsi;
private int _lastAlertBar;
[Parameter("Source", Group = "RSI")]
public DataSeries Source { get; set; }
[Parameter("Periods", DefaultValue = 14, MinValue = 1, Group = "RSI")]
public int Periods { get; set; }
[Parameter("Max Level", DefaultValue = 70, MinValue = 1, Group = "Alert")]
public int MaxAlertLevel { get; set; }
[Parameter("Min Level", DefaultValue = 20, MinValue = 1, Group = "Alert")]
public int MinAlertLevel { get; set; }
[Parameter("Email", DefaultValue = "your_email", Group = "Alert")]
public string Email { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
_rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
public override void Calculate(int index)
{
Result[index] = _rsi.Result[index];
if (index == _lastAlertBar) return;
if (Result[index] >= MaxAlertLevel)
{
Notifications.SendEmail(Email, Email, "RSI Max Level Alert", string.Format("RSI crossed/touched maximum level {0} for {1} {2}", MaxAlertLevel, SymbolName, TimeFrame));
}
else if (Result[index] <= MinAlertLevel)
{
Notifications.SendEmail(Email, Email, "RSI Min Level Alert", string.Format("RSI crossed/touched minimum level {0} for {1} {2}", MaxAlertLevel, SymbolName, TimeFrame));
}
_lastAlertBar = index;
}
}
}
This indicator will use cTrader email configuration, please configure your cTrader email before using this indicator.
You can find cTrader email on settings under advanced tab.
@amusleh
... Deleted by UFO ...