Save last price in a variable and compare it to the new price.
if (LastPrice < Ask) { Alert(...); }
Save last price in a variable and compare it to the new price.
THX, but I'll have to do that at every tick wich is basicaly imposible since there's a tick every seconds or less.
I want to be alerted everytime the value of "Bid" goes Up or Down no matter the price, a bit similar to this program(with a predefined price):
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double
Level,
Price;
Level=1.28337;
Price=Bid;
//-------------------------------------------------------------------+
if(Price>Level)
{
Alert("en haut");
}
else
{
if(Price<Level)
{
Alert("en bas");
}
}
//-------------------------------------------------------------------+
return(0);
}
//+------------------------------------------------------------------+
I want to be alerted everytime the value of "Bid" goes Up or Down no matter the price.
I don't see why it is impossible
double LastPrice; void init() { LastPrice = Bid; } start () { if (LastPrice < Bid) Alert("Price going up"); else if (LastPrice > Bid) Alert("Price going down"); LastPrice = Bid; return(0); }
I don't see why it is impossible
I tried it:
double LastPrice;
void init()
{
LastPrice = Bid;
}
//+------------------------------------------------------------------+
start ();
{
if (LastPrice < Bid)
Alert("Price going up");
else if (LastPrice > Bid)
Alert("Price going down");
LastPrice = Bid;
return(0);
}
//+------------------------------------------------------------------+
But it doesn't work, MetaEditor says:
'start' function not defined
'start' expression on global scope not allowed
I don't see why it is impossible
Don't mind, I changed some things and it works.
Thanks a lot, I love you.
But it doesn't work, MetaEditor says:
'start' function not defined
'start' expression on global scope not allowed
Ohh thats because i forgot to write the type of it, if you just added "int" before "start()" it would fix it.
Anyway, good luck!
Thx, what does "void" stands for?
Because in the e-book there are several functions with "void" and a name but "void" itself isn't explained.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
What is the augmentation symbol?
I can get an alert if " A>1.999" by using the sign ">".
But what sign should I use if the only thing I want is to get an alert if the value of "A" increases?