Can any one help to add alerts to below code

 

Hi 


Can any of you add alerts to the attached code as tried using AI tools but all are producing code which are giving continuous alert but not whenever a new arrow is appeared , want to automate this using MX2 

Files:
onlyup.mq4  7 kb
 
raviyelleni:

Hi 


Can any of you add alerts to the attached code as tried using AI tools but all are producing code which are giving continuous alert but not whenever a new arrow is appeared , want to automate this using MX2 

Traders and coders often code without charge if:
 -- it is interesting for them personally
 -- it is interesting for many members on this forum.

Otherwise, consider to place a job on Freelance section  

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2024.10.21
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
i recommend that you search codebase. find codes with Alert in their title and then view and learn how to modify yours.
 
raviyelleni:

Hi 


Can any of you add alerts to the attached code as tried using AI tools but all are producing code which are giving continuous alert but not whenever a new arrow is appeared , want to automate this using MX2 

I moved your thread to MT4 section of the forum.

-------------------

About AI tools - read this thread: https://www.mql5.com/en/forum/448462
because of the following:

No help is provided for ChatGPT generated code on this forum.

Simple code error - *newbie*
Simple code error - *newbie*
  • 2023.06.05
  • Vitor Monteiro
  • www.mql5.com
Good night everyone, how are you...
 
raviyelleni:

Hi 


Can any of you add alerts to the attached code as tried using AI tools but all are producing code which are giving continuous alert but not whenever a new arrow is appeared , want to automate this using MX2 

use the Alert() function at the same place where the buffer CrossUp is assigned a value.

check documention to see how the Alert funtion works.

 

Hi

As was mentioned above you should simply use Alert function just below Cross Up assignment, but to avoid constant alerts you must add here some limitation for example add a condition to display alert only when you have last closed candle:

if(i==1) Alert(“alert”);

But to be perfectly sure it won’t be repeated you can also add a time flag to check when the last alert was placed and then allow new alerts only if current time is on ne candle.

Have a nice day👍📊