Hi all,
Please help me to solve the problem base on my subject.
my telegram alert already running for one by one alert, but when my exploration got 10 stocks, i will receive 10 message in telegram.
i tried to modify my afl so that my exploration result send all at once to my telegram channel.
with this modify, i got too much messages repetition and this alert doesn't match with my exploration result.
Filter = Close == 50;
TelegramAPI_ID = "****************";
TelegramCHAT_ID = "@************";
// Initialize an empty string to accumulate messages
allMessages = "";
// Loop through all the bars (rows)
for (i = 0; i < BarCount; i++)
{
// Check if the current bar meets the filter criteria
if (LastValue(Filter[i]))
{
// Format the message for the current stock
message = "Buy : " + Name() + ", Price : " + Close[i] + ", Open : " + Open[i] + ", Low : " + Low[i] + ", Change : " + StrFormat("%.2f", MoM_P[i]) + "%\n";
// Accumulate the message
allMessages = allMessages + message;
}
}
// Send the accumulated message if there is any
if (StrLen(allMessages) > 0)
{
TelegramAlerts = InternetOpenURL("https://api.telegram.org/bot" + TelegramAPI_ID + "/sendMessage?chat_id=" + TelegramCHAT_ID + "&text=" + allMessages);
InternetClose(TelegramAlerts);
}
the result of my exploration like this
Ticker Date/Time Close
PNBS 31/05/2024 15:30:00 50
MPPA 31/05/2024 15:45:00 50
MARI 31/05/2024 14:00:00 50
SQMI 31/05/2024 11:00:00 50
BABP 31/05/2024 15:15:00 50
but the alert message sent to my telegram like this
Buy : SMDR, Price : 50, Open : 49.6, Low : 49.2, Change : -2.31%Buy : SMDR, Price : 50, Open : 49.6, Low : 49.6, Change : 9.57%Buy : SMDR, Price : 50, Open : 50.4, Low : 49.6, Change : 9.57%Buy : SMDR, Price : 50, Open : 50, Low : 49.6, Change : 9.57%Buy : SMDR, Price : 50, Open : 50, Low : 50, Change : 9.57%Buy : SMDR, Price : 50, Open : 50, Low : 50, Change : 9.57%Buy : SMDR, Price : 50, Open : 50, Low : 50, Change : 5.08%Buy : SMDR, Price : 50, Open : 50, Low : 49.6, Change : 5.08%Buy : SMDR, Price : 50, Open : 50.4, Low : 50, Change : 5.08%
Doesn't match with my exploration result and too much repetition.
please help me to solved / modify the afl.
Thanks in advance
Dangin