AFL to Telegram Messages -- Error Multiple MSG sent

Hi All,
I have the code below which is sending multiple telegram messages in 5 mins time frame.

Someone please update the code so it can send only 1 message per Candle BAR.

TelegramAlerts = ParamTrigger("Telegram Alert","Send Alert");
TelegramAPI_ID = ParamStr("Telegram Bot API Key","1046872120:wwwwwn_TVmddddGfUlmc"); //Get the Bot API key via BotFather in Telgram
TelgramCHAT_ID = ParamStr("Telegram Channel ID","4xxxxx5"); //Channel ID
Message = "Check this Stock "+Name();
TelegramAlerts1 = InternetOpenURL(""+TelegramAPI_ID+"/sendMessage?chat_id="+TelgramCHAT_ID+"&text= "+Message );
AlertIf((Buy), "EXEC TelegramAlerts1","Tele Alert", 3);

Thanks a lot in advance

first you'll need to decide ... either you use AlertIf(EXEC ...), or InternetOpenURL()

lets consider we use only


and still i face multiple msg on telegram

Hi Rottor,

I have managed to get proper Telegram messages with your HINT,.. I have a new problem .. it works properly in 1 min chart and i get 1 telegram message in 1 min. But when in 5 mins chart, I get 10 telegram messages till the bar is over. So need to minimize the number of telegram messages..PLEASE GUIDE...

HERE is the code

if( LastValue( Buy ) )
TelegramAlertsBuy = InternetOpenURL(""+TelegramAPI_ID+"/sendMessage?chat_id="+TelgramCHAT_ID+"&text= "+MessageBUY );

if( LastValue( Sell ) )
Sell = ExRem (Sell,Buy);
TelegramAlertsSELL = InternetOpenURL(""+TelegramAPI_ID+"/sendMessage?chat_id="+TelgramCHAT_ID+"&text= "+MessageSELL );

Read this ....

and the example in the end of this

Can you please give me the correct working code.. i couldnt get it RIGHT ... plz plz guide