I made a small test indicator and it doesn't always work how it should. Sometimes an alert pops up but more often it doesn't. Is there something I forgot?
Edit: Obviously it only works when I click on the corners or directly in the middle where the little squares are when the rectangle is selected.
#property strict#property indicator_chart_window//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- indicator buffers mapping//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//---//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+//| ChartEvent function |//+------------------------------------------------------------------+voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam)
{
//---if (id==CHARTEVENT_OBJECT_CLICK) {
if (ObjectType(sparam)==OBJ_RECTANGLE) {
Alert("Click on ", sparam);
}
}
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi coders,
I made a small test indicator and it doesn't always work how it should. Sometimes an alert pops up but more often it doesn't. Is there something I forgot?
Edit: Obviously it only works when I click on the corners or directly in the middle where the little squares are when the rectangle is selected.