Download MetaTrader 5
To add comments, please log in or register
Do you have Linux? Find out how to install MetaTrader on it!
JC
1399
JC 2014.10.23 07:39  
albo111:
thank you for the quick reply. I had the same idea to count the ticks per minute but how to do that ? 
Ticks per minute is basically Volume[n]. MT4 can register a tick without a price change, but in essence the number of ticks in the current minute is simply iVolume(NULL, PERIOD_M1, 0)
FaatP94
64
FaatP94 2014.10.23 12:55  
jjc:
Ticks per minute is basically Volume[n]. MT4 can register a tick without a price change, but in essence the number of ticks in the current minute is simply iVolume(NULL, PERIOD_M1, 0)
thanks for your reply but I changed the topic. Actually I want to know how to catch the time between two prices. For example : 

I have the firstPrice = 1.355 and the secondPrice is the firstPrice - || + the differce (unterschied in german) and then I want to catch the time between this to prices 
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.23 15:07  
You can try but if you are on 5 digits broker, the time differences would be in ms (milliseconds), not just in seconds.
whroeder1
13966
whroeder1 2014.10.23 16:41  
albo111: I want to know how to catch the time between two prices. For example :  I have the firstPrice = 1.355 and the secondPrice is the firstPrice - || + the differce (unterschied in german) and then I want to catch the time between this to prices
Save the TimeCurrent() when you capture both prices. What's the problem?
Ernst Van Der Merwe
4475
Ernst Van Der Merwe 2014.10.24 07:03  
albo111:
thanks for your reply but I changed the topic. Actually I want to know how to catch the time between two prices. For example : 

I have the firstPrice = 1.355 and the secondPrice is the firstPrice - || + the differce (unterschied in german) and then I want to catch the time between this to prices 

A shot in the dark...

   int i;
   int pips=5;
   double factor;
   if(_Digits==2 || _Digits==3) factor=100;
   else                         factor=10000;
   static datetime time_then=TimeCurrent();
   static double price_then=Close[0];
   datetime time_now;
   double price_now = Close[0];
   int price_change = factor*(price_now-price_then);
   if(price_change==pips || price_change==-pips)
     {
      time_now=TimeCurrent();
      Alert(_Symbol," time elapsed for last ",(string)pips," pip price change ",TimeToString(time_now-time_then,TIME_SECONDS));
      time_then=TimeCurrent();
      price_then=Close[0];
     }

   pips = 20;
   if(_Digits==2 || _Digits==3) factor=0.01;
   else                         factor=0.0001;
   for(i=5001;i>=0;i--)
     {
      double price_1=iClose(NULL,PERIOD_M1,5000);
      datetime time_1=iTime(NULL,PERIOD_M1,5000);
      double price_2 = price_1+pips*factor;
      double price_3 = price_1-pips*factor;
      double price_4 = iClose(NULL,PERIOD_M1,i);
      datetime time_2;
      if(price_4>=price_2 || price_4<=price_3)
        {
         time_2=iTime(NULL,PERIOD_M1,i);
         Print(_Symbol," time elapsed for last ",(string)pips," pip price change ",TimeToString(time_2-time_1,TIME_MINUTES));
         time_1=iTime(NULL,PERIOD_M1,i);
         price_1=iClose(NULL,PERIOD_M1,i);
        }
     }
/ /12
To add comments, please log in or register