Description
Its a library for cTrader indicators and cBots to show a popup alert window, you can use it on your custom indicators and cBots.
Your indicator/cBot user will be able to select the alert sound file or enable/disable it without any coding effort by you.
You will be able to add popup, sound, email, and Telegram alert on your indicator/cBot with a single line of code!
Its free and open-source, any kind of contribution is welcome!
Features
- Easy to use
- WPF window instead of Windows Forms
- Multiple themes and accents
- Removing alerts
- Playing sound and allowing the user to select the sound file via Windows Explorer
- Email alert
- Changing the time zone and format
- Telegram Bot Alert
- Shows only a single window even if you use it on multiple indicators and cBot, it uses .NET thread synchronization objects
- You can choose to only trigger email, sound, and Telegram alerts on the background without showing the popup window
You can find the installation instruction on Github Wiki (below documentation link), its recommended to install/update/remove it via Visual Studio Nuget package manager.
Github: https://github.com/afhacker/ctrader-alert_popup
Documentation: https://github.com/afhacker/ctrader-alert_popup/wiki
If you have an issue or you found any bug please use Github issues to report, if you leave a comment here we will not get any notification and we will not be able to help you.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Blank : Indicator
{
protected override void Initialize()
{
// Please use the above full sample code instead
}
public override void Calculate(int index)
{
}
}
}
afhacker
Joined on 15.10.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Blank.algo
- Rating: 3.33
- Installs: 4541
- Modified: 13/10/2021 09:54
Comments
Please use Github to report bugs, or contact us directly via our website if you need support.
@afhacker
Thank you for your response.
The error message I get: "Indicator 'macross' caused cTrader application crash. It was removed from all charts. Indicator exception details:
LiteDB.LiteException: Cannot insert duplicate key in unique index '_id'. The duplicate value is '"637233397083142409_XAUUSD_Buy"'.
w LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, Byte level, IndexNode last)
w LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, IndexNode last)
w LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
w LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction)
w LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
w cAlgo.API.Alert.Helpers.AlertManager.<>c__DisplayClass2_0.<<AddAlerts>b__0>d.MoveNext()
--- ---
w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w cAlgo.API.Alert.Helpers.AlertManager.<AddAlerts>d__2.MoveNext()
--- ---
w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w cAlgo.API.Alert.Helpers.AlertManager.<AddAlert>d__1.MoveNext()
--- ---
w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w cAlgo.API.Alert.Launcher.<Launch>d__8.MoveNext()
--- ---
w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
w System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
w System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
w System.Threading.ThreadPoolWorkQueue.Dispatch()
I installed the "cAlgo.API.Alert" Nuget package and done everything that is written on github Wiki but it doesn't work.
Hello, I need some help with adding this alert popup indicator to my MA crossover indicator. I wanna have telegram notifications. But when apply this to one of my charts, my cTrader crashes and close itself. Could you help me to set it up?
To use the test indicator you have to install the "cAlgo.API.Alert" Nuget package, otherwise it will not work.
Please read the Github Wiki.
Hello Ahmed,
You've done great work here. Spotware should acquire your work and pay you handsomely for this.
It took me awhile to set it up but never the less - Great Work!!!
Kenneth
Hi Afhacker
When I want to start this indicator, and apply it to one of my charts, my cTrader crashes and close itself. When I restart it, it is telling me this:
"Indicator 'test' caused cTrader application crash. It was removed from all charts."
Where "test" is my indicator name. I don't know how that's comming. Do you have any ideas why it's like that?
I just notice your information. I'll try out this week Thanks
Now you can trigger the alerts (sound, email, Telegram) without showing the alert popup.
You can use the new "TriggerAlert" method of Notifications for triggering an alert without showing the popup window.
I was trying to open the db file with DB Browser for SQL Lite without success. It works fine with LiteDBViewer.
Great job!
This library writes the alert records on a LiteDB, which is a file-based object database.
I will add the silent mode feature, it will allow you to just write the alert record to the database but it will not show any popup.
The previous version of this library was using CSV files too, but due to performance issues, I switched to LiteDB.
You can open the alerts database file and browse the alerts with LiteDBViewer.
Dear Ahmad,
Years ago the following indicator https://ctrader.com/algos/indicators/show/67 was providing a pop-up alert system based on a different library. One of the key features is to write down all alerts in a CSV file. Even after you delete the alert in the list, the CSV file will keep all records. It'll be a great improvement to add that feature together with a silent mode ( no show up). That will enable us to backtest the alert rules in order to get better quality and accuracy of alerts. Thanks
I updated the documentation sample code, its hard for me to keep everything up to date so please use VisualStudio and IntelliSense will show you the method argument positions.
Anyone who wants to use this library on cTrader indicators/cBot, please use it with Visual Studio and install it via Nuget.
I finally got the change, the new one is:
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, tradeType, "AlertTest Indicator", Symbol.Bid, "No comment", Server.Time);
Dear Ahmad
In the wiki the example is:
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, Symbol.Bid, "AlertTest Indicator", tradeType, "No comment", Server.Time);
In the new Alert model TimeFrame = timeFrame,
Symbol = symbol,
Price = price,
TriggeredBy = triggeredBy,
Type = type,
Comment = comment,
Time = time
In the sample indicator "Alert test indicator" is the triggeredBy (argument 4) and "no comment" is comment (argument 6), where is the ordering change ?
If you can provide a new command line to replace the previous it will better clarify
Thanks.
@jedimaster Hello,
The issue with argument position, I have changed the position of arguments so you have to call the new overloads of ShowPopup method.
You can find all ShowPopup method overloads here:
https://github.com/afhacker/ctrader-alert_popup/blob/master/src/Alert/INotificationsExtensions.cs
Hi Ahmad, I am testing the latest GNU package (2.1.2) with your Alert tester sample indicator and I cannot compile because the following arguments 4 and 6 are double " Error CS1928: '
Code is your Alert tester:
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); }
I get the following errors:
cAlgo.API.Internals.INotifications' does not contain a definition for 'ShowPopup' and the best extension method overload 'cAlgo.API.Alert.INotificationsExtensions.ShowPopup(cAlgo.API.Internals.INotifications, cAlgo.API.TimeFrame, cAlgo.API.Internals.Symbol, cAlgo.API.TradeType, string, double, string, System.DateTimeOffset)' has some invalid arguments" "
Error CS1503 Argument 4: cannot convert from 'double' to 'cAlgo.API.TradeType' Alert tester
Error Argument 6: cannot convert from 'cAlgo.API.TradeType' to 'double' Alert tester
Can you help me out?
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net45'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net472'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net472'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm='cAlgo.API.Alert'&targetFramework='net472'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net35'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net35'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
Error when I try to load source inVStudio from Github
[Package source] The V2 feed at 'https://github.com/afhacker/ctrader-alert_popup/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net45'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
Telegram issue has been fixed.
No, it is not possible to set different sound files.
Regarding the Telegram issue, I will release a new version ASAP.
It's not a bot, it's a library that allows you to show a popup window from your cTrader cBots or indicators.
Is it possible to set a different alert sound for each alert triggered?
Also having trouble getting my Telegram bot connected - when I paste the name and key in the alert window crashes.
Hi Ahmad, is the bot still available? The downloaded file is a blank one.
Regards,
cleboldetrich
OK, now everything's is working.
Thanks!
Danis,
I have uploaded the new version DLL files to Google drive folder, download the new version DLL files
Danis;
Did you installed the latest version of cAlgo.API.Alert.UI (2.0.1.1) package?
Hi,
very good work
I have trouble with Telegram settings. The alert Popup crashed after I inserted the username and cBot Key.
Can you check this?
Thanks,
Ok its here
Danis
In new version time column shows full date time, not just time, and you can show/hide columns, change columns size, and sort alerts based on all columns and it will remember all your changes.
Two new columns added, Price and Triggered By.
As you asked in the new version you can fully change the email subject/body and telegram message templates by using template keywords.
The thing I'm struggling with is avoiding multi popup opening with pipe server, that's the hard part and I'm doing my best to find a solution for it.
There is an issue on cTrader indicator initialization process, sometimes the indicator code executed twice upon initialization and it causes lots of issues for those indicators that show a window, I reported the issue and they said it will be fixed in November release.
Once I finished the pipe server issue and tested it fully I will release it.
The new version will be on Nugget so you will be able to install it from Visual Studio Nugget console or package manager.
Another major change is using cAlgo API INotifications interface for showing the popup, the popup show method is implemented as an extension method to INotifications interface so to show the popup you do this:
Notifications.ShowPopup(...);
Same like play sound and send email methods.
And you don't need to set your indicator/cBot to alert library on Initialize/OnStart method unless you need debugging info.
The new version code is written fully in MVVM pattern.
And a suggestion
In time column add the option also for day (usefull for long term trade to see also the day not just the time of alert)
Super cool
I use your alert popup togheter with a telegram routine in one robot. It works well!
Danis
The new version isn't finished yet, I will release it in the next few days with some really cool features like Telegram bot alert.
Hi,
Can you the new version (with mods from GitHub) compile?
I can't compile the GitHub project (dependence errors)
Thanks
[erk86],
Check the log tab of cTrader => Automate and if there was any error message post it here, then I will be able to help you.
i'm stuck with ctader 3.0, why it can't build?
i am sorry, i'm noob here
Thanks AFhacker, That worked perfectly! Still working on my Git skills. Thanks again.
clloyd.
The master branch contains the new version of the library which is under development and not released yet.
The current version is in branch 1.0 so clone that branch not the master and try to rebuild it.
In case you want to use the version 2.0 which is under development re-clone the master branch and try to build it again.
Hi afhacker,
Fantastic Indicator and thankyou very much for sharing. I am having a little trouble rebuilding the solution int VStudio though. All references nuGet and dependencies are clean. But I have these two errors I cant resolve.
1/ From the Core.Factory CS0246 C# The type or namespace name 'MainWindow' could not be found (are you missing a using directive or an assembly reference?)
and
2/ Also Core.Factory CS0118 C# 'Alert' is a namespace but is used like a type.
Apologies for asking. If this is to complex don't worry. I will persist and advise on success.
Regards
Hello afhacker,
I created an indicator and referenced to this thread in my discription for adding alerts to the indicator. If you do not want you referenced please say so and I will remove it.
https://ctrader.com/algos/indicators/show/1775
Thank you for creating this amazing project!
Kind regards,
Vince
everything seems fine. thanks a lot for your help.. and this great indicator.
Appreciate your help a lot. i have tried the Test script above and the alert was good. I also tried re-installing my cTrader, but I don't know if that helped. WIll test with my indicator again once the market is live and will let you know. Have a great weekend! Bless you!
Alerts File Path: \Documents\cAlgo\alerts.csv
I made some changes, re-download the DLL files and try again.
Can you tell me what's your system language? culture setting?
yes I did reference it to ControlzEX.dll. It is still having the same error message in logs.
I could not find the alerts CSV file you mentioned. am I not checking the correct folder? I tried searching the whole folder but no file was found.
thanks for your patience.
Did you reference "ControlzEx.dll" file?
Delete the alerts CSV file, it's inside cAlgo folder in your documents.
Is it returning the same error message in logs?
Hi, apologies. I tried the above again using .Algo, but I still got the blank screen. The build succeeded though.
Hi. I tested it on your Test script as above, and there was an error upon building it. Thank you so much.
Error CS0117: 'Alert.Factory' does not contain a definition for 'Indicator'
[rosemarie.bautista]
Test the new version and let me know if there was any issue.
[rosemarie.bautista]
I will test it on Friday and then let you know the result.
it has the same error in live conditions. appreciate your help/input on how I can solve this.
here is a sample message, although i am unsure if it was different when the market was live. thank you for looking into it.
14/07/2018 18:39:21.980 | Exception: An unexpected error occurred.
14/07/2018 18:39:21.980 | Exception: An unexpected error occurred.
14/07/2018 18:39:21.996 | Source: CsvHelper
14/07/2018 18:39:21.996 | Source: CsvHelper
14/07/2018 18:39:21.996 | StackTrace: at CsvHelper.Configuration.Configuration.<>c.<.ctor>b__148_4(CsvHelperException exception) at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Alert.Factory.ReadAlerts()
14/07/2018 18:39:21.996 | StackTrace: at CsvHelper.Configuration.Configuration.<>c.<.ctor>b__148_4(CsvHelperException exception) at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Alert.Factory.ReadAlerts()
14/07/2018 18:39:21.996 | TargetSite: Void <.ctor>b__148_4(CsvHelper.CsvHelperException)
14/07/2018 18:39:21.996 | TargetSite: Void <.ctor>b__148_4(CsvHelper.CsvHelperException)
14/07/2018 18:39:21.996 | InnerException: System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset) at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) at CsvHelper.TypeConversion.DateTimeOffsetConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData) at lambda_method(Closure ) at CsvHelper.Expressions.RecordCreator.Create[T]() at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext()
14/07/2018 18:39:21.996 | InnerException: System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset) at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) at CsvHelper.TypeConversion.DateTimeOffsetConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData) at lambda_method(Closure ) at CsvHelper.Expressions.RecordCreator.Create[T]() at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext()
14/07/2018 18:39:21.996 | Exception: String was not recognized as a valid DateTime.
14/07/2018 18:39:21.996 | Exception: String was not recognized as a valid DateTime.
14/07/2018 18:39:21.996 | Source: mscorlib
14/07/2018 18:39:21.996 | Source: mscorlib
14/07/2018 18:39:21.996 | StackTrace: at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset) at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) at CsvHelper.TypeConversion.DateTimeOffsetConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData) at lambda_method(Closure ) at CsvHelper.Expressions.RecordCreator.Create[T]() at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext()
14/07/2018 18:39:21.996 | TargetSite: System.DateTime Parse(System.String, System.Globalization.DateTimeFormatInfo, System.Globalization.DateTimeStyles, System.TimeSpan ByRef)
14/07/2018 18:39:21.996 | StackTrace: at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset) at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) at CsvHelper.TypeConversion.DateTimeOffsetConverter.ConvertFromString(String text, IReaderRow row, MemberMapData memberMapData) at lambda_method(Closure ) at CsvHelper.Expressions.RecordCreator.Create[T]() at CsvHelper.CsvReader.<GetRecords>d__63`1.MoveNext()
14/07/2018 18:39:21.996 | TargetSite: System.DateTime Parse(System.String, System.Globalization.DateTimeFormatInfo, System.Globalization.DateTimeStyles, System.TimeSpan ByRef)
Use cTrader "Automation" and check the cBot / Indicator "Logs" tab, is there any error message?
thank you. I have been using the alert for few weeks now but suddenly the alert turned blank. the window comes out but there is no data coming out. i have tried it with the Alert test indicator as well, but it is still the same. any suggestions? Appreciate your help.
[rosemarie.bautista]
If you call the Trigger method with default TriggerType which is Per Bar then the popup should only appear once per each bar even if you call the Trigger method multiple times during time span of a single bar.
hi @afhacker, can you help? is there a way for this alert to appear only once per candle? some command that is native only to the Alert namespace? sort of a newbie in coding here.. i used it to alert on a higher timeframe but it keeps on triggering endlessly if the candle is not done yet. many many thanks.
I can't give you an exact date but I will do my best to do it in next few months.
And when will be ready?
I will, the new version will have Telegram alert option too.
And also with the option to personalise the email message content
Can you a new version update, more compatible with cTrader3.0?
Thanks,
Sorry, I can't help you with that.
hI,
First, thanks for your alert library. It's work quite well for me.
I finished a cBot and I want to add a procedure to make optimisation of the parameters before to start the cBot.
Can you help me with this?
Thanks,
Daniel, Vienna
the bug in alert library version 1.3.2 fixed, about fast MACD no I don't know how it's calculated.
Apropos, do you know a formula for fast MACD calculates?
Now it works, but if you close the popup message windows this will never appear again. You must rebuild the indicator that use allert.dll to start again the popup windows.This is the only one bug.
Thanks for your hard work. I make some indicators, just for personal use, and this one helps me a lot.
Test the new version
Now it´s working, but just for one pair. If you use the same indicator with the alert popup for more pairs, the alert popup message will be opened for each pair, and every popup repeats the alert messages. That make to use all system resources (i5 8GB RAM, stop and CPU 98% and memory 60%).
Link fixed.
Sorry, but the link to download not exist.
Important personal note:
If you can fix it, this library will be for me the most important indicator published in last 2 years. I know very well all indicators and cBots from this site.
Thanks again!
And the new alert clears the old one, without to make a list of alerts.
It starting to work, but after 5 min FxPro cTrader crash.
Thanks, anyway, can you fix it?
I really need an alert sistem for my trading strategy. The old version is working but it is a little difficult to manage this.
Can you make this .dll files to work? Because, until now, I tried everithing and work just for 5 minutes and after that the alerts are just as .csv file writed.
thanks a lot.
buy not working agin?!
https://ctrader.com/forum/indicator-support/11992
[hamidreza.taali@gmail.com]
I lost your forum thread link.
thanks.
i am update my indicator.
but not working popup agian.
thanks.
i am update my indicator but not show popup again.
can you see my topic an help me?please.
[hamidreza.taali@gmail.com],
Your indicator access rights are set to "None", change it to full access.
And you are using the old alert library use the WPF version instead.
thanks.
iam set for my indicator but not show alert window?whay?
https://ctrader.com/forum/indicator-support/11992
i appreciate you posting this for us!
masonry contractors brooklyn