Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated February 19, 2023
Top Posters
looks_one
sam028
with 5 posts (6 thanks)
looks_two
Belltalks
with 4 posts (3 thanks)
looks_3
bobwest
with 3 posts (1 thanks)
looks_4
cutzpr
with 2 posts (0 thanks)
Best Posters
looks_one
vspatrick
with 4 thanks per post
looks_two
sam028
with 1.2 thanks per post
looks_3
Belltalks
with 0.8 thanks per post
looks_4
bobwest
with 0.3 thanks per post
trending_up
11,853 views
thumb_up
15 thanks given
group
21 followers
forum
23 posts
attach_file
2 attachments
July 12th, 2018, 05:12 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
cutzpr
I'll try something during the next weeks.
If I forgot send me a reminder .
Success requires no deodorant! (Sun Tzu)
July 22nd, 2018, 11:46 AM
Vancouver
Posts: 29 since Apr 2018
Thanks Given: 19
Thanks Received: 9
sam028
I'll try something during the next weeks.
If I forgot send me a reminder
.
Reminder ! Let’s work together guys and figure it out
Sent using the NexusFi mobile app
July 23rd, 2018, 09:51 AM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
supreme23
It's more painful than expected, and when you have things like this:
'Flood prevention. Telegram now requires your program to do requests again only after 62734 seconds have passed (TimeToWait property). If you think the culprit of this problem may lie in TLSharp's implementation, open a Github issue please.'
it's not helping.
Wait & see...
Success requires no deodorant! (Sun Tzu)
August 14th, 2018, 11:11 AM
United States
Experience: None
Platform: TWS,Ninja Trader
Trading: Forex, Futures, Stocks
Posts: 35 since Apr 2012
Thanks Given: 10
Thanks Received: 10
sam028
It's more painful than expected, and when you have things like this:
'Flood prevention. Telegram now requires your program to do requests again only after 62734 seconds have passed (TimeToWait property). If you think the culprit of this problem may lie in TLSharp's implementation, open a Github issue please.'
it's not helping.
Wait & see...
Any luck? I appreciate you taking on this endeavor.
August 14th, 2018, 12:59 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
cutzpr
Any luck? I appreciate you taking on this endeavor.
I gave up, too many bugs in the C# libraries.
I tried with some Python libraries and it was much better but it will require to integrate this in C# code which I haven't done. One day maybe...
Success requires no deodorant! (Sun Tzu)
June 25th, 2020, 06:41 AM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
At the end the solution I used was:
- one .exe program, which can be use in command line, which send a Telegram message
- a strategY/indicator which calls this .exe when needed
The .exe code:
Code
namespace TelegramSam
{
class Program {
static int Main ( string [] args ) {
if ( args . Length != 3 ) {
Console . WriteLine ( "Please enter your API token, your chatID and the message." );
Console . WriteLine ( "Usage: TeleLennard <bottoken <chatID> <test to send>" );
return 1 ;
}
ServicePointManager . Expect100Continue = true ;
ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls12 ;
string apiToken = args [ 0 ];
string chatId = args [ 1 ];
string message = args [ 2 ];
var toto = "https://api.telegram.org/" + apiToken + "/sendMessage?chat_id=" + chatId + "&text=" + message ;
WebRequest request = WebRequest . Create ( toto );
Stream rs = request . GetResponse (). GetResponseStream ();
StreamReader reader = new StreamReader ( rs );
string line = "" ;
StringBuilder sb = new StringBuilder ();
while ( line != null ) {
line = reader . ReadLine ();
if ( line != null )
sb . Append ( line );
}
string response = sb . ToString ();
Console . WriteLine ( message );
return 0 ;
}
}
}
The NinjaScript:
Code
public class TeleTest : Strategy
{
string apiToken = "botXXX" ;
string chatId = "0123456798" ;
string a = "Is Sam" ;
string b = "a genius" ;
string c = "or what?" ;
string msg ;
string exeToRun = @ "C:\Users\sam\Source\repos\Tele\bin\Release\Tele.exe" ;
private void sendToTelegram ( object msg ){
ProcessStartInfo startInfo = new ProcessStartInfo ();
startInfo . FileName = exeToRun ;
startInfo . Arguments = apiToken + " " + chatId + " " + msg ;
startInfo . WindowStyle = ProcessWindowStyle . Hidden ;
Process . Start ( startInfo );
}
protected override void Initialize ()
{
CalculateOnBarClose = true ;
Thread thread = new Thread ( sendToTelegram );
msg = "\"" + a + " " + b + " " + c + "\"" ;
thread . Start ( msg );
}
}
Success requires no deodorant! (Sun Tzu)
September 13th, 2020, 07:02 PM
Western Florida
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,170 since Jan 2013
Thanks Given: 57,799
Thanks Received: 26,369
cls71
This article (in spanish) explains step by step how to send messages (text & images ) to Telegram from
NinjaTrader 8.
Hi @cls71
I have had to delete your message, because it contains a link to your company web site, where you offer paid services and courses in addition to the information about Telegram.
Forum rules to not allow a vendor to post links to their web site or otherwise do anything that could promote their products or services.
You may not have intended to violate the rules, but this requirement must be enforced to ensure a commercial-free environment in the forum.
Bob.
When one door closes, another opens.
-- Cervantes, Don Quixote
October 8th, 2020, 07:07 PM
NEW BRUNSWICK
Experience: Intermediate
Platform: ninjatrader
Trading: nq
Posts: 11 since Jun 2020
Thanks Given: 2
Thanks Received: 0
sam028
At the end the solution I used was:
- one .exe program, which can be use in command line, which send a Telegram message
- a strategY/indicator which calls this .exe when needed
The .exe code:
Code
namespace TelegramSam
{
class Program {
static int Main ( string [] args ) {
if ( args . Length != 3 ) {
Console . WriteLine ( "Please enter your API token, your chatID and the message." );
Console . WriteLine ( "Usage: TeleLennard <bottoken <chatID> <test to send>" );
return 1 ;
}
ServicePointManager . Expect100Continue = true ;
ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls12 ;
string apiToken = args [ 0 ];
string chatId = args [ 1 ];
string message = args [ 2 ];
var toto = "https://api.telegram.org/" + apiToken + "/sendMessage?chat_id=" + chatId + "&text=" + message ;
WebRequest request = WebRequest . Create ( toto );
Stream rs = request . GetResponse (). GetResponseStream ();
StreamReader reader = new StreamReader ( rs );
string line = "" ;
StringBuilder sb = new StringBuilder ();
while ( line != null ) {
line = reader . ReadLine ();
if ( line != null )
sb . Append ( line );
}
string response = sb . ToString ();
Console . WriteLine ( message );
return 0 ;
}
}
}
The NinjaScript:
Code
public class TeleTest : Strategy
{
string apiToken = "botXXX" ;
string chatId = "0123456798" ;
string a = "Is Sam" ;
string b = "a genius" ;
string c = "or what?" ;
string msg ;
string exeToRun = @ "C:\Users\sam\Source\repos\Tele\bin\Release\Tele.exe" ;
private void sendToTelegram ( object msg ){
ProcessStartInfo startInfo = new ProcessStartInfo ();
startInfo . FileName = exeToRun ;
startInfo . Arguments = apiToken + " " + chatId + " " + msg ;
startInfo . WindowStyle = ProcessWindowStyle . Hidden ;
Process . Start ( startInfo );
}
protected override void Initialize ()
{
CalculateOnBarClose = true ;
Thread thread = new Thread ( sendToTelegram );
msg = "\"" + a + " " + b + " " + c + "\"" ;
thread . Start ( msg );
}
}
Hello
Could you check the below code to see if you could find out why is not working
//Set-up for telegram BOT
private DateTime dateTime;
private string botUrl = "https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}";
private string apiKey = "4902146:AAHrSh0GVj_2TDeGiXiSDTr0DVKsF02y9J A";
private string chatId = "-1001278608";
private string messageText = "";
private string instrumentName = "";
private string contractMonth = "";
private string signalSeries = "";
private string CurrentDate = "";
private string dataSeriesDate = "";
private string indicatorName = "HeikenAshi CandleSticks Entry \n";
/For Telegram Bot
if (CurrentDate == dataSeriesDate && TelegramAlert == true)
{
signalSeries = indicatorName + instrumentName + " " + contractMonth + " " + vCall.ToString() + " CE";
messageText = signalSeries;
botUrl = "https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}";
botUrl = String.Format(botUrl, apiKey, chatId, messageText);
WebRequest request = WebRequest.Create(botUrl);
request.GetResponse();
October 9th, 2020, 05:58 AM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
Hard to say without more details about the error message.
Success requires no deodorant! (Sun Tzu)
Last Updated on February 19, 2023