How to add exact "Date/Time" of BUY/ SELL when send alerts to Telegram

Hi all,
Can someone help me to solve below problem code? I'm using "EXEC" telegram link to alert buy/sell signals, but the Date/Time output send to Telegram different to Date/Time of Alert Output

dt = DateTime();
dtformat = "\n%Y-%m-%d\n";
TelegramAPI_ID = ParamStr("Telegram Bot API Key","xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxx"); 
TelgramCHAT_ID = ParamStr("Telegram Channel ID","@xxxxxxxxx");  
Message = " BUY: " +  "-" + Name()+ " @ "   + WriteVal(C,1.2)+"-" + DateTimeFormat("dtformat", dt[i]);
AlertIf(Buy , "EXEC https://api.telegram.org/bot"+TelegramAPI_ID+"/sendMessage?chat_id="+TelgramCHAT_ID+"&text="+Message,"",1);

Alert output:
Alert
Telegram data:
telegram

One more thing, Alertif( "EXEC telegramlink") command opens lots of internet browser when signals generate. Can you guide me to mix Alertif(EXEC...) with "InternetOpenURL(ih)" and InternetClose(ih)
Thank you all.

3 Likes

I tried to use 1 bar/day only to scan and avoid other signal from different day, but Amibroker till appears some signals in last 1 or 2 days sometime. So i want to solve this problem with adding exact Date/time when the condition signal is true.
Can anyone help me to solve this problem?
Thank you in advance!

Read links below , might give you some ideas

https://www.amibroker.com/guide/afl/now.html

3 Likes

Thank you @awilson for your support,
I'm trying to code as the topic you suggest but i cant make the function working, it gives no output.

Hi Albert,
Did you solve with this problem? if yes, could you share it?

Thank you

Hi, i want to know, how to send alert for all ticker in 1 line message, not 1 by 1 message like mine photo_2021-09-16_15-05-17

Save all alerts in a text file and then send it to telegram

1 Like

Thank you for the reply, may I know the script to send the text file into telegram?

Hi Albert, for dt [i] having been initialized, for sure dt = Datetime() already write.

please advise Albert, thank you