Price alert on line cross

 

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

 

ObjectCreate(MLine_Name, OBJ_HLINE, 0,Bid,Ask); - wrong!

 
Roger wrote >>

ObjectCreate(MLine_Name, OBJ_HLINE, 0,Bid,Ask); - wrong!


hi Roger,

what is wrong in thi part?

thanks
aurimas

 

You have to use time and price as coordinates, not price and price.

 
Roger wrote >>

You have to use time and price as coordinates, not price and price.


thank you very much, it is weekend now and i cant test it, i hope no more mistakes i made...
 

still not working :(

 
kovas6 wrote >>

still not working :(


Hi
if you want EA that sends you email or sms when price touches any kind of line you define it on chart.
let me know if that what you want.

Anthony

 

Anthony, yes

 
kovas6 wrote >>

Anthony, yes


write your email

 

i wrote in a PM

 
kovas6 wrote >>

i wrote in a PM


sent you email
Reason: