time difference betwen two prices

 

Hello guy, how can I catch the time between two prices ? That's how I am trying:

 

if(check == true && OrdersTotal()==0)
{
 
   static double firstPrice;
   static bool firstTest = false;
   static bool secondTest = false;
   
   if(firstTest == false)
   {
   firstPrice = Ask;
   //here I want to catch the first datetime
   firstTest = true;
   }
   
   if(secondTest == false)
   {
   if(Ask>firstPrice+unterschied*Point || Ask<firstPrice-unterschied*Point)
   {
   //here I want to catch the second datime
   }
   
   }
   
   

        
}//if(check == true && OrdersTotal()==0)
 

Sure!

1) Count ticks per minute and divide by 60 or (per 30 seconds or 10 seconds or ..)

2) Count ticks with the use of GetTickCount() (= millisecods).

 
thank you for the quick reply. I had the same idea to count the ticks per minute but how to do that ? 
 

sigh..

int nTicks, TicksPerSec;
datetime NewBar;

void OnTicks(){
   ...
   if ( NewBar != Time[0] ) {
       TicksPerSec = nTicks/(_Period*60);
       NewBar = Time[0];
       nTicks = 1;
   } else nTicks++;
   ...
}
(untested) something like this?
 
gooly: sigh..
That's why I say:
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Emphasis on "post your attempt."
 

@WHRoeder , your right. I updatet my first post! 

@gooly thank you for helping me at the first problem, it works  

 
#push please
 
GetTickCount() - look it up in the reference
 
if(check == true && OrdersTotal()==0)
{

   if(firstTest == false)
   {
   firstPrice = Ask;
   //here I want to catch the first datetime
  
   firstTest = true;
   }
   
   if(firstTest == true && mainTest == false)
   {
   m=GetTickCount();
   
   if(Ask>firstPrice+unterschied*Point || Ask<firstPrice-unterschied*Point)
   {
   showPrice = true;
   mainTest=true;

   }

   if(showPrice==true)
   {
   Alert("Time is" +m);
   }
 }
   
   

        
}//if(check == true && OrdersTotal()==0)
That is how I tried it but it doesent work ... I want that the Ea checks every tick the elapsed time betwen the firstPrice and the secondPrice which is the firstPrice-unterschied(difference) and the ea should return it to a variable.
I also tried it with m=TimeSeconds(TimeCurrent(); but it doesen't work 
 

sigh... :(

Just use and amend the example in the reference of GetTickCount()...

 
int test()
{
   int m = 0;
   static int start = GetTickCount();
   if(firstTest == false)
   {
   firstPrice = Ask;
  
   firstTest = true;
   }
   
      if(firstTest == true && mainTest == false)
      {
      m=GetTickCount()-start;
      }
            if(Ask>=firstPrice+unterschied*Point || Ask<=firstPrice-unterschied*Point)
            {
  
               showPrice = true;
               mainTest=true;
               
            }

   
   
   if(showPrice==true)
   {

   mainTest=false;
   showPrice = false;
   
   }
 
 
return(m);
 
}//int test()
That's my code now. The first value which this function returns is right but then it will add up the first value with the second etc. Does someone know how to fix it ?
Reason: