I have an idea for ict traders who looks out for liquidity sweeps and I hope that someone could make this alert system indicator works, am not a coder,but just have tried to help the coder with 80% of work so that we can take benefit of this amazing alert system which could afford daily ote entries and the community take benefit of it:
an MQL5 indicator that identifies the high and low of a candlestick, draws horizontal lines with text labels for the high and low, and triggers an alert when the price breaks above the high or below the low. This indicator also includes a multi-timeframe option
//+------------------------------------------------------------------+
//| HighLow.mq5|
//| Copyright 2024, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2024, Your Name"
#property link "https://yourwebsite.com"
#property version "1.00"
#property indicator_chart_window
// Input parameters
input ENUM_TIMEFRAMES TimeFrame = 0; // Timeframe to use (current chart timeframe by default)
input int BarsToCheck = 1; // Number of bars to check (default: 1)
input bool AlertsOn = true; // Enable alerts
input bool PushAlertsOn = true; // Enable push notifications
// Buffers to store high and low values
double HighBuffer[];
double LowBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Indicator buffers mapping
SetIndexBuffer(0, HighBuffer);
SetIndexBuffer(1, LowBuffer);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit = BarsToCheck;
for (int i = 0; i < limit; i++)
{
int shift = i + 1;
if (TimeFrame != 0)
{
double high_value = iHigh(NULL, TimeFrame, shift);
double low_value = iLow(NULL, TimeFrame, shift);
// Drawing horizontal lines for high and low
string highLine = "High_" + IntegerToString(i);
string lowLine = "Low_" + IntegerToString(i);
if (ObjectFind(0, highLine) == -1)
{
ObjectCreate(0, highLine, OBJ_HLINE, 0, time[shift], high_value);
ObjectSetInteger(0, highLine, OBJPROP_COLOR, clrRed);
ObjectSetInteger(0, highLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, highLine, OBJPROP_TEXT, "High");
}
if (ObjectFind(0, lowLine) == -1)
{
ObjectCreate(0, lowLine, OBJ_HLINE, 0, time[shift], low_value);
ObjectSetInteger(0, lowLine, OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, lowLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, lowLine, OBJPROP_TEXT, "Low");
}
// Check for price breakout and alert
if (close[0] > high_value)
SendAlert("Break above high", high_value);
else if (close[0] < low_value)
SendAlert("Break below low", low_value);
}
else
{
HighBuffer = high[shift];
LowBuffer = low[shift];
// Drawing horizontal lines for high and low
string highLine = "High_" + IntegerToString(i);
string lowLine = "Low_" + IntegerToString(i);
if (ObjectFind(0, highLine) == -1)
{
ObjectCreate(0, highLine, OBJ_HLINE, 0, time[shift], high[shift]);
ObjectSetInteger(0, highLine, OBJPROP_COLOR, clrRed);
ObjectSetInteger(0, highLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, highLine, OBJPROP_TEXT, "High");
}
if (ObjectFind(0, lowLine) == -1)
{
ObjectCreate(0, lowLine, OBJ_HLINE, 0, time[shift], low[shift]);
ObjectSetInteger(0, lowLine, OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, lowLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, lowLine, OBJPROP_TEXT, "Low");
}
// Check for price breakout and alert
if (close[0] > high[shift])
SendAlert("Break above high", high[shift]);
else if (close[0] < low[shift])
SendAlert("Break below low", low[shift]);
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//| Function to send alerts and push notifications |
//+------------------------------------------------------------------+
void SendAlert(string message, double level)
{
string alert_message = StringFormat("%s at level %.5f", message, level);
if (AlertsOn)
Alert(alert_message);
if (PushAlertsOn)
SendNotification(alert_message);
}
//+------------------------------------------------------------------+
the code need to be fixed and compiled as I have failed to fix syntax errors and compile it.
Best Regards
an MQL5 indicator that identifies the high and low of a candlestick, draws horizontal lines with text labels for the high and low, and triggers an alert when the price breaks above the high or below the low. This indicator also includes a multi-timeframe option
//+------------------------------------------------------------------+
//| HighLow.mq5|
//| Copyright 2024, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2024, Your Name"
#property link "https://yourwebsite.com"
#property version "1.00"
#property indicator_chart_window
// Input parameters
input ENUM_TIMEFRAMES TimeFrame = 0; // Timeframe to use (current chart timeframe by default)
input int BarsToCheck = 1; // Number of bars to check (default: 1)
input bool AlertsOn = true; // Enable alerts
input bool PushAlertsOn = true; // Enable push notifications
// Buffers to store high and low values
double HighBuffer[];
double LowBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Indicator buffers mapping
SetIndexBuffer(0, HighBuffer);
SetIndexBuffer(1, LowBuffer);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit = BarsToCheck;
for (int i = 0; i < limit; i++)
{
int shift = i + 1;
if (TimeFrame != 0)
{
double high_value = iHigh(NULL, TimeFrame, shift);
double low_value = iLow(NULL, TimeFrame, shift);
// Drawing horizontal lines for high and low
string highLine = "High_" + IntegerToString(i);
string lowLine = "Low_" + IntegerToString(i);
if (ObjectFind(0, highLine) == -1)
{
ObjectCreate(0, highLine, OBJ_HLINE, 0, time[shift], high_value);
ObjectSetInteger(0, highLine, OBJPROP_COLOR, clrRed);
ObjectSetInteger(0, highLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, highLine, OBJPROP_TEXT, "High");
}
if (ObjectFind(0, lowLine) == -1)
{
ObjectCreate(0, lowLine, OBJ_HLINE, 0, time[shift], low_value);
ObjectSetInteger(0, lowLine, OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, lowLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, lowLine, OBJPROP_TEXT, "Low");
}
// Check for price breakout and alert
if (close[0] > high_value)
SendAlert("Break above high", high_value);
else if (close[0] < low_value)
SendAlert("Break below low", low_value);
}
else
{
HighBuffer = high[shift];
LowBuffer = low[shift];
// Drawing horizontal lines for high and low
string highLine = "High_" + IntegerToString(i);
string lowLine = "Low_" + IntegerToString(i);
if (ObjectFind(0, highLine) == -1)
{
ObjectCreate(0, highLine, OBJ_HLINE, 0, time[shift], high[shift]);
ObjectSetInteger(0, highLine, OBJPROP_COLOR, clrRed);
ObjectSetInteger(0, highLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, highLine, OBJPROP_TEXT, "High");
}
if (ObjectFind(0, lowLine) == -1)
{
ObjectCreate(0, lowLine, OBJ_HLINE, 0, time[shift], low[shift]);
ObjectSetInteger(0, lowLine, OBJPROP_COLOR, clrBlue);
ObjectSetInteger(0, lowLine, OBJPROP_WIDTH, 1);
ObjectSetString(0, lowLine, OBJPROP_TEXT, "Low");
}
// Check for price breakout and alert
if (close[0] > high[shift])
SendAlert("Break above high", high[shift]);
else if (close[0] < low[shift])
SendAlert("Break below low", low[shift]);
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//| Function to send alerts and push notifications |
//+------------------------------------------------------------------+
void SendAlert(string message, double level)
{
string alert_message = StringFormat("%s at level %.5f", message, level);
if (AlertsOn)
Alert(alert_message);
if (PushAlertsOn)
SendNotification(alert_message);
}
//+------------------------------------------------------------------+
the code need to be fixed and compiled as I have failed to fix syntax errors and compile it.
Best Regards