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,
I am writing EA to trigger alert on price crossing the line, but it is not working, could you help ?
extern string MLine_Name = "MLine";
extern color MLine_Color = Goldenrod;
extern int MLine_Style = 1;
extern int MLine_Width = 2;
extern int AlertPipRange = 3;
extern bool Line_Alert = false;
string AlertWav = "alert.wav";
int init() {}
int start()
{
int counted_bars=IndicatorCounted();
ObjectCreate(MLine_Name, OBJ_HLINE, 0,Bid,Ask);
ObjectSet(MLine_Name,OBJPROP_COLOR,MLine_Color);
ObjectSet(MLine_Name,OBJPROP_STYLE,MLine_Style);
ObjectSet(MLine_Name,OBJPROP_WIDTH,MLine_Width);
double val=ObjectGetValueByShift(MLine_Name, 0);
if (Bid-AlertPipRange<= val && Bid+AlertPipRange>= val)
if (Line_Alert==true)
{
PlaySound("alert.wav");
}
}
int deinit() { }
thanks
kovas