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?
@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 ?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello guy, how can I catch the time between two prices ? That's how I am trying: