Download MetaTrader 5
To add comments, please log in or register
1000 paid orders are executed in Freelance service. Sign up!
nixtrix
17
nixtrix 2014.08.03 21:17 

Hello,

I was wondering if it is possible to detect a sudden move in price(lets say 5 pips) in a less than 1second time difference between the previous price.

An Example would be: At 4:10.12 the price was 1.6754 and at 4:10.125 the price is now 1.6759.

If i am unclear please let me know.


Thanks

qjol
3243
qjol 2014.08.03 22:57  

current price minus the previous price

against current time minus the previous time

for time you can use TimeCurrent, TimeLocal or GetTickCount

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.08.03 23:08  
nixtrix:

Hello,

I was wondering if it is possible to detect a sudden move in price(lets say 5 pips) in a less than 1second time difference between the previous price.

An Example would be: At 4:10.12 the price was 1.6754 and at 4:10.125 the price is now 1.6759.

If i am unclear please let me know. 

It can be unreliable as you will miss ticks with some Brokers when price is moving fast  . . .
nixtrix
17
nixtrix 2014.08.04 11:15  

Thank you for the replies.

I have another slight problem when trying to calculate the difference between the previous price and the current.

My code so far is:

   static double tickCurrent; 
   double tickPrevious = tickCurrent; 
   tickCurrent = Bid;   
   double diff = tickPrevious - tickCurrent;
   
   Print("Difference ", diff);

I am getting results such as: Difference -1.000000000006551e-005

Keith Watford
Moderator
7876
Keith Watford 2014.08.04 11:33  

Try

Print("Difference ", DoubleToStr(diff,Digits));
nixtrix
17
nixtrix 2014.08.04 11:41  
GumRai:

Try

 


Thanks GumRai! worked perfectly.

/
To add comments, please log in or register