Oh yes there is....
//+------------------------------------------------------------------+ //| example.mq4 | //| Copyright © 2013, deVries | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2013, deVries" #property link "" double previousBid; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- previousBid=Bid; //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- if(Bid > previousBid) { Alert("up tick ",DoubleToStr(Bid,Digits)); } if(Bid < previousBid) { Alert("dn tick ",DoubleToStr(Bid,Digits)); } if(Bid == previousBid) { Alert("equal tick ",DoubleToStr(Bid,Digits)); } previousBid = Bid; //---- return(0); } //+------------------------------------------------------------------+
now compare
I would have coded it
double BidCurrent; int init(){ BidCurrent = Bid; ...} int start(){ double BidPrevious = BidCurrent; BidCurrent = Bid; // compare ...just a matter of style.
Thank you for your help it is working smooth :P
best regards,
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
Hello, I would like to know if there is a way to compare tick1 with the previous one tick0. And if there is one, could you help me with a point from where should I start to code this one?
Ex: Suppose every tick change every sec, at 00:00:00 will be tick0:1.3000 and at 00:00:01 tick1 will be 1.3001, and so on... I was thinking to set timer but not every tick will be every sec so this one will drop.
Thank you in advance,