
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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