New_Candle_Alarm

Download script
Author: Zen_Leow
New_Candle_Alarm

This tool is designed to provide traders with real-time notifications regarding market structure changes. Specifically, it monitors the price charts on MetaTrader to identify the exact moment a new candle (the standard unit of time for price movement) begins.

How the Logic Works

The script operates on a continuous monitoring loop, observing the "current" timeframe you have selected on your trading platform. It functions through the following logical steps:

  • Time Tracking: When you first load the tool, it records the current market time as its starting point.
  • Continuous Monitoring: The script constantly compares the timestamp of the candle currently forming against the timestamp it recorded last.
  • Change Detection: If the script detects that the market has moved forward into a new candle (meaning the clock has ticked over to a new period, such as a new minute, hour, or day), it triggers an action.
  • Notification Trigger: Once a new candle is detected, the tool generates an automated alert on your screen. This notification clearly identifies which specific currency pair or asset you are viewing and which timeframe (e.g., M15, H1, D1) the alarm is associated with.
  • Update Cycle: Immediately after sending the alert, the script updates its internal memory with the new candle's time. This ensures that you only receive one notification per candle, preventing the system from repeating the same alert multiple times during a single trading period.

Purpose and User Experience

The primary objective of this logic is to eliminate the need for manual monitoring. Instead of having to watch the clock to see when a new period begins, the script acts as an automated "eyes-on" assistant. It ensures you are alerted the moment a new price block opens, allowing for more timely entries, exits, or analysis based on your specific trading strategy.

Miscellaneous
It issuies visual alerts to the screen
8 Views
1 Downloads
0 Favorites
New_Candle_Alarm
//+------------------------------------------------------------------+
//|                                             New_Candle_Alarm.mq4 |
//|                                                         Zen_Leow |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Zen_Leow"
#property link      ""

#property indicator_chart_window

datetime LastAlertTime;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   LastAlertTime = TimeCurrent();
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   if (LastAlertTime < Time[0])
   {
      Alert("New Candle Forming on ",Symbol()," TimeFrame: ",Period());
      LastAlertTime = Time[0];
   }
   return(0);
}
//+------------------------------------------------------------------+

Comments