Latest Alert_1
Download scriptThis tool is designed to function as an automated monitoring system for your trading platform. Its primary purpose is to keep a watchful eye on specific price milestones and notify you immediately when the market reaches them, allowing you to react quickly without needing to stare at the charts constantly.
How it Works
The script operates based on several user-defined parameters that allow you to customize your notifications:
- Price Thresholds: You can set specific "High" and "Low" price targets. The system continuously compares the live market price against these two levels.
- Time Restriction: It includes a time filter, ensuring that alerts are only triggered during specific times of the day (based on the minutes passed). This is useful for avoiding unnecessary noise during periods when you aren't actively trading.
- Alert Delivery: Depending on your preferences, the tool can provide feedback in two ways:
- Email Notifications: It can send a direct message to your registered email account identifying which price level was breached.
- Audio Alerts: It can trigger a specific sound file on your computer to grab your attention instantly.
Core Logic Summary
The logic follows a simple "if-then" sequence: The system checks every price tick to see if the current market value has crossed above your designated high price or below your designated low price. If these conditions are met—and it is within the time window you have specified—the script executes the requested actions (sending an email, playing a sound, or both).
Essentially, it acts as a 24/7 digital sentry, monitoring the market for you and only "waking you up" when your specific price targets are hit.
//+------------------------------------------------------------------+
//| n.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
extern double highPrice;
extern double lowPrice;
extern double rm;
extern bool showPriceLevels = false;
extern bool sendMailAlert = true;
extern bool soundAlert = false;
static int PrevSignal = 0, PrevTime = 0, SIGNAL_BAR=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
// Get close price of current bar
double currentClose = Bid;
if (sendMailAlert || soundAlert) {
if (Minute()>=rm && (currentClose >= highPrice || currentClose <= lowPrice)) {
if (sendMailAlert) {
SendMail("Price Alert", "Price breached target price of : " + highPrice);
}
if (soundAlert) {
PlaySound("alert.wav");
}
}
}
//----
//----
if(SIGNAL_BAR > 0 && Time[0] <= PrevTime )
return(0);
return(0);
}
//+------------------------------------------------------------------+
Comments