-
Notifications
You must be signed in to change notification settings - Fork 6
Show Popup
Trigger First Alert
After you installed the library on your cTrader indicator/cBot you will be able to show the popup by calling "Notifications.ShowPopup" method but before that, you have to add the "cAlgo.API.Alert" using on top of your indicator/cBot code:
using cAlgo.API.Alert;
Then call the "ShowPopup" method on your code:
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, Symbol.Bid, "AlertTest Indicator", TradeType.Sell, "No comment", Server.Time);
You don't have to care about the time zone, the user will be able to set the time zone on popup settings.
And you will see this:
The user will be able to change the popup theme and accent.
Full Working Indicator Sample
`using cAlgo.API; using cAlgo.API.Alert; using System;
namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class AlertTest : Indicator { private int _barIndex;
protected override void Initialize()
{
cAlgo.API.Alert.Types.Configuration.Tracer = Print;
}
public override void Calculate(int index)
{
if (_barIndex != index && IsLastBar)
{
_barIndex = index;
TradeType tradeType = MarketSeries.Close[index - 1] > MarketSeries.Open[index - 1] ? TradeType.Buy : TradeType.Sell;
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, Symbol.Bid, "AlertTest Indicator", tradeType, "No comment", Server.Time);
}
}
}
} `
using cAlgo.API;
using cAlgo.API.Alert;
using System;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class AlertTest : Indicator
{
private int _barIndex;
protected override void Initialize()
{
cAlgo.API.Alert.Types.Configuration.Tracer = Print;
}
public override void Calculate(int index)
{
if (_barIndex != index && IsLastBar)
{
_barIndex = index;
TradeType tradeType = MarketSeries.Close[index - 1] > MarketSeries.Open[index - 1] ? TradeType.Buy : TradeType.Sell;
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, Symbol.Bid, "AlertTest Indicator", tradeType, "No comment", Server.Time);
}
}
}
}