Download MetaTrader 5

Reading sudden movement in price

To add comments, please log in or register
nixtrix
20
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.


Thanks

qjol
3243
qjol  

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
18021
Simon Gniadkowski  
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
20
nixtrix  

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
10637
Keith Watford  

Try

Print("Difference ", DoubleToStr(diff,Digits));
nixtrix
20
nixtrix  
GumRai:

Try

 


Thanks GumRai! worked perfectly.

To add comments, please log in or register