Reading sudden movement in price

 

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

 

current price minus the previous price

against current time minus the previous time

for time you can use TimeCurrent, TimeLocal or GetTickCount

 
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  . . .
 

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

 

Try

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

Try

 


Thanks GumRai! worked perfectly.

Reason: