time difference betwen two prices - page 2

1578

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)
64

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
1402

You can try but if you are on 5 digits broker, the time differences would be in ms (milliseconds), not just in seconds.
16786

 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?
5316

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);
}
}```