ADX INDICATOR ALERT ON TELEGRAM
ADX INDICATOR ALERT ON TELEGRAM
08 Apr 2022, 12:28
Dear Mr. Panagiotis Charalampous / Mr. Ahmad Noman,
Kindly send me a Sample of cBot, for sending Alert on Telegram if the ADX Indicator Level rises above a certain Level, for eg 25 or 30..
Thanks & Best Regards,
Altaf
Replies
steel.export
20 Apr 2022, 07:51
ADX INDICATOR ALERT ON TELEGRAM
Dear Mr. Ahmed,
Thanks for your reply.
The ADX Alert onTelegram is working fine, but along with the Telegram Alert it also shows a Pop-up Alert on screen on ctrader Platform. Is there any way to Disable the Pop-up Alerts on Screen, and only receive Alert on Telegram?
Awaiting your early reply.
Thanks and Best Regards,
Altaf
@steel.export
amusleh
20 Apr 2022, 09:10
Hi,
You can use the TriggerAlert method instead of ShowPopup:
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Alert;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class ADXwithAlert : Indicator
{
private AverageDirectionalMovementIndexRating _adx;
private int _lastAlertBarIndex;
[Parameter(DefaultValue = 14, Group = "ADX")]
public int Periods { get; set; }
[Parameter("Level", DefaultValue = 25, Group = "Alert")]
public double AlertLevel { get; set; }
[Parameter("Setup", DefaultValue = 25, Group = "Alert")]
public bool AlertSetup { get; set; }
[Output("ADX", LineColor = "Blue")]
public IndicatorDataSeries Adx { get; set; }
[Output("ADXR", LineColor = "Yellow")]
public IndicatorDataSeries AdxR { get; set; }
[Output("DI+", LineColor = "Green")]
public IndicatorDataSeries DiPlus { get; set; }
[Output("DI-", LineColor = "Red")]
public IndicatorDataSeries DiMinus { get; set; }
protected override void Initialize()
{
_adx = Indicators.AverageDirectionalMovementIndexRating(Periods);
if (AlertSetup)
{
Notifications.ShowPopup();
}
}
public override void Calculate(int index)
{
Adx[index] = _adx.ADX[index];
AdxR[index] = _adx.ADXR[index];
DiPlus[index] = _adx.DIPlus[index];
DiMinus[index] = _adx.DIMinus[index];
if (IsLastBar && _lastAlertBarIndex != index && Adx[index] > AlertLevel)
{
_lastAlertBarIndex = index;
var type = string.Format("ADX above {0}", AlertLevel);
AlertModel alert = new AlertModel
{
TimeFrame = TimeFrame,
Symbol = Symbol,
Price = Adx[index],
TriggeredBy = "ADX with Alert",
Type = type,
Time = Server.Time
};
Notifications.TriggerAlert(alert);
}
}
}
}
It only works if you already setup the telegram alert on popup settings.
@amusleh
steel.export
21 Apr 2022, 14:25
ADX INDICATOR ALERT ON TELEGRAM
Dear Mr. Ahmad,
Thanks for your reply.
At the time of Built it is giving the below error
The type or namespace name 'AlertModel' could not be found (are you missing a using directive or an assembly reference?)
@steel.export
amusleh
26 Apr 2022, 09:19
RE: ADX INDICATOR ALERT ON TELEGRAM
steel.export said:
Dear Mr. Ahmad,
Thanks for your reply.
At the time of Built it is giving the below error
The type or namespace name 'AlertModel' could not be found (are you missing a using directive or an assembly reference?)
Hi,
Add the using cAlgo.API.Alert.Models:
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Alert;
using cAlgo.API.Alert.Models;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class ADXwithAlert : Indicator
{
private AverageDirectionalMovementIndexRating _adx;
private int _lastAlertBarIndex;
[Parameter(DefaultValue = 14, Group = "ADX")]
public int Periods { get; set; }
[Parameter("Level", DefaultValue = 25, Group = "Alert")]
public double AlertLevel { get; set; }
[Parameter("Setup", DefaultValue = 25, Group = "Alert")]
public bool AlertSetup { get; set; }
[Output("ADX", LineColor = "Blue")]
public IndicatorDataSeries Adx { get; set; }
[Output("ADXR", LineColor = "Yellow")]
public IndicatorDataSeries AdxR { get; set; }
[Output("DI+", LineColor = "Green")]
public IndicatorDataSeries DiPlus { get; set; }
[Output("DI-", LineColor = "Red")]
public IndicatorDataSeries DiMinus { get; set; }
protected override void Initialize()
{
_adx = Indicators.AverageDirectionalMovementIndexRating(Periods);
if (AlertSetup)
{
Notifications.ShowPopup();
}
}
public override void Calculate(int index)
{
Adx[index] = _adx.ADX[index];
AdxR[index] = _adx.ADXR[index];
DiPlus[index] = _adx.DIPlus[index];
DiMinus[index] = _adx.DIMinus[index];
if (IsLastBar && _lastAlertBarIndex != index && Adx[index] > AlertLevel)
{
_lastAlertBarIndex = index;
var type = string.Format("ADX above {0}", AlertLevel);
AlertModel alert = new AlertModel
{
TimeFrame = TimeFrame,
Symbol = Symbol,
Price = Adx[index],
TriggeredBy = "ADX with Alert",
Type = type,
Time = Server.Time
};
Notifications.TriggerAlert(alert);
}
}
}
}
@amusleh
steel.export
04 May 2022, 14:36
RE: RE: ADX INDICATOR ALERT ON TELEGRAM
amusleh said:
steel.export said:
Dear Mr. Ahmad,
Thanks for your reply.
At the time of Built it is giving the below error
The type or namespace name 'AlertModel' could not be found (are you missing a using directive or an assembly reference?)
Hi,
Add the using cAlgo.API.Alert.Models:
using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Alert; using cAlgo.API.Alert.Models; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class ADXwithAlert : Indicator { private AverageDirectionalMovementIndexRating _adx; private int _lastAlertBarIndex; [Parameter(DefaultValue = 14, Group = "ADX")] public int Periods { get; set; } [Parameter("Level", DefaultValue = 25, Group = "Alert")] public double AlertLevel { get; set; } [Parameter("Setup", DefaultValue = 25, Group = "Alert")] public bool AlertSetup { get; set; } [Output("ADX", LineColor = "Blue")] public IndicatorDataSeries Adx { get; set; } [Output("ADXR", LineColor = "Yellow")] public IndicatorDataSeries AdxR { get; set; } [Output("DI+", LineColor = "Green")] public IndicatorDataSeries DiPlus { get; set; } [Output("DI-", LineColor = "Red")] public IndicatorDataSeries DiMinus { get; set; } protected override void Initialize() { _adx = Indicators.AverageDirectionalMovementIndexRating(Periods); if (AlertSetup) { Notifications.ShowPopup(); } } public override void Calculate(int index) { Adx[index] = _adx.ADX[index]; AdxR[index] = _adx.ADXR[index]; DiPlus[index] = _adx.DIPlus[index]; DiMinus[index] = _adx.DIMinus[index]; if (IsLastBar && _lastAlertBarIndex != index && Adx[index] > AlertLevel) { _lastAlertBarIndex = index; var type = string.Format("ADX above {0}", AlertLevel); AlertModel alert = new AlertModel { TimeFrame = TimeFrame, Symbol = Symbol, Price = Adx[index], TriggeredBy = "ADX with Alert", Type = type, Time = Server.Time }; Notifications.TriggerAlert(alert); } } } }
Dear Mr. Ahmad,
Thanks for your reply.
This time Built is giving the below 2 Errors.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.TimeFrame' to 'string' ADXwithAlert.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.Internals.Symbol' to 'string' ADXwithAlert.
Please Advice.
Thanks & Best Regards,
Altaf
@steel.export
amusleh
05 May 2022, 09:59
RE: RE: RE: ADX INDICATOR ALERT ON TELEGRAM
steel.export said:
Dear Mr. Ahmad,
Thanks for your reply.
This time Built is giving the below 2 Errors.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.TimeFrame' to 'string' ADXwithAlert.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.Internals.Symbol' to 'string' ADXwithAlert.
Please Advice.
Thanks & Best Regards,
Altaf
Hi,
You have to call the ToString method on them:
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Alert;
using cAlgo.API.Alert.Models;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class ADXwithAlert : Indicator
{
private AverageDirectionalMovementIndexRating _adx;
private int _lastAlertBarIndex;
[Parameter(DefaultValue = 14, Group = "ADX")]
public int Periods { get; set; }
[Parameter("Level", DefaultValue = 25, Group = "Alert")]
public double AlertLevel { get; set; }
[Parameter("Setup", DefaultValue = 25, Group = "Alert")]
public bool AlertSetup { get; set; }
[Output("ADX", LineColor = "Blue")]
public IndicatorDataSeries Adx { get; set; }
[Output("ADXR", LineColor = "Yellow")]
public IndicatorDataSeries AdxR { get; set; }
[Output("DI+", LineColor = "Green")]
public IndicatorDataSeries DiPlus { get; set; }
[Output("DI-", LineColor = "Red")]
public IndicatorDataSeries DiMinus { get; set; }
protected override void Initialize()
{
_adx = Indicators.AverageDirectionalMovementIndexRating(Periods);
if (AlertSetup)
{
Notifications.ShowPopup();
}
}
public override void Calculate(int index)
{
Adx[index] = _adx.ADX[index];
AdxR[index] = _adx.ADXR[index];
DiPlus[index] = _adx.DIPlus[index];
DiMinus[index] = _adx.DIMinus[index];
if (IsLastBar && _lastAlertBarIndex != index && Adx[index] > AlertLevel)
{
_lastAlertBarIndex = index;
var type = string.Format("ADX above {0}", AlertLevel);
AlertModel alert = new AlertModel
{
TimeFrame = TimeFrame.ToString(),
Symbol = SymbolName,
Price = Adx[index],
TriggeredBy = "ADX with Alert",
Type = type,
Time = Server.Time
};
Notifications.TriggerAlert(alert);
}
}
}
}
@amusleh
steel.export
06 May 2022, 08:53
RE: RE: RE: RE: ADX INDICATOR ALERT ON TELEGRAM
amusleh said:
steel.export said:
Dear Mr. Ahmad,
Thanks for your reply.
This time Built is giving the below 2 Errors.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.TimeFrame' to 'string' ADXwithAlert.
Error CS0029 Cannot implicitly convert type 'cAlgo.API.Internals.Symbol' to 'string' ADXwithAlert.
Please Advice.
Thanks & Best Regards,
Altaf
Hi,
You have to call the ToString method on them:
using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Alert; using cAlgo.API.Alert.Models; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class ADXwithAlert : Indicator { private AverageDirectionalMovementIndexRating _adx; private int _lastAlertBarIndex; [Parameter(DefaultValue = 14, Group = "ADX")] public int Periods { get; set; } [Parameter("Level", DefaultValue = 25, Group = "Alert")] public double AlertLevel { get; set; } [Parameter("Setup", DefaultValue = 25, Group = "Alert")] public bool AlertSetup { get; set; } [Output("ADX", LineColor = "Blue")] public IndicatorDataSeries Adx { get; set; } [Output("ADXR", LineColor = "Yellow")] public IndicatorDataSeries AdxR { get; set; } [Output("DI+", LineColor = "Green")] public IndicatorDataSeries DiPlus { get; set; } [Output("DI-", LineColor = "Red")] public IndicatorDataSeries DiMinus { get; set; } protected override void Initialize() { _adx = Indicators.AverageDirectionalMovementIndexRating(Periods); if (AlertSetup) { Notifications.ShowPopup(); } } public override void Calculate(int index) { Adx[index] = _adx.ADX[index]; AdxR[index] = _adx.ADXR[index]; DiPlus[index] = _adx.DIPlus[index]; DiMinus[index] = _adx.DIMinus[index]; if (IsLastBar && _lastAlertBarIndex != index && Adx[index] > AlertLevel) { _lastAlertBarIndex = index; var type = string.Format("ADX above {0}", AlertLevel); AlertModel alert = new AlertModel { TimeFrame = TimeFrame.ToString(), Symbol = SymbolName, Price = Adx[index], TriggeredBy = "ADX with Alert", Type = type, Time = Server.Time }; Notifications.TriggerAlert(alert); } } } }
Dear Mr. Ahmat,
It is now working well. Thanks a lot for your help.
Thanks & Best Regards,
Altaf
@steel.export
amusleh
15 Apr 2022, 13:09
Hi,
You can use this:
It uses the cAlgo.API.Alert Nuget package.
To use it:
For a more detailed guide check: Installation · afhacker/ctrader-alert_popup Wiki (github.com)
For Telegram notification setup check: Telegram · afhacker/ctrader-alert_popup Wiki (github.com)
@amusleh