HI guys i was looking for it for a long time and i didn't find one horizontal line alert for MT5 that works on windown that is not the chart one
like rsi ,trix,stoch,cci, etc can someone help me with this?
this was the closest that i get but dosen't work for none chart windown (rsi,trix,stoch,cc,etc)
// iHLine_Alert.mq5 by astro //
#property indicator_chart_window
input string LineName="MyLine1";
input color LineColor=AliceBlue;
input int LineStyle=STYLE_SOLID;
input int AlertPipRange=1;
input string AlertWav="alert.wav";
MqlTick tick;
double adj = 1;
string obj_name;
int OnInit()
{
obj_name = LineName + GetTickCount();
SymbolInfoTick(_Symbol, tick);
ObjectCreate(0, obj_name, OBJ_HLINE, 0, 0, tick.bid);
ObjectSetInteger(0, obj_name, OBJPROP_STYLE, LineStyle);
ObjectSetInteger(0, obj_name, OBJPROP_COLOR, LineColor);
ObjectSetInteger(0, obj_name, OBJPROP_SELECTABLE, true);
if (_Digits == 5 || _Digits == 3) adj = 10;
return 0;
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
SymbolInfoTick(_Symbol, tick);
double val = ObjectGetDouble(0, obj_name, OBJPROP_PRICE);
if (tick.bid-AlertPipRange*_Point*adj <= val && tick.bid+AlertPipRange*_Point*adj >= val) PlaySound(AlertWav);
return 0;
}
void OnDeinit(const int reason)
{
ObjectDelete(0, obj_name);
}
like rsi ,trix,stoch,cci, etc can someone help me with this?
this was the closest that i get but dosen't work for none chart windown (rsi,trix,stoch,cc,etc)
// iHLine_Alert.mq5 by astro //
#property indicator_chart_window
input string LineName="MyLine1";
input color LineColor=AliceBlue;
input int LineStyle=STYLE_SOLID;
input int AlertPipRange=1;
input string AlertWav="alert.wav";
MqlTick tick;
double adj = 1;
string obj_name;
int OnInit()
{
obj_name = LineName + GetTickCount();
SymbolInfoTick(_Symbol, tick);
ObjectCreate(0, obj_name, OBJ_HLINE, 0, 0, tick.bid);
ObjectSetInteger(0, obj_name, OBJPROP_STYLE, LineStyle);
ObjectSetInteger(0, obj_name, OBJPROP_COLOR, LineColor);
ObjectSetInteger(0, obj_name, OBJPROP_SELECTABLE, true);
if (_Digits == 5 || _Digits == 3) adj = 10;
return 0;
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
SymbolInfoTick(_Symbol, tick);
double val = ObjectGetDouble(0, obj_name, OBJPROP_PRICE);
if (tick.bid-AlertPipRange*_Point*adj <= val && tick.bid+AlertPipRange*_Point*adj >= val) PlaySound(AlertWav);
return 0;
}
void OnDeinit(const int reason)
{
ObjectDelete(0, obj_name);
}