Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, howardR), 472 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
minutesWithin() or who to know time elapsed inside a bar #472629
05/08/18 22:47
05/08/18 22:47
Joined: Nov 2017
Posts: 34
C
Cheulmen Offline OP
Newbie
Cheulmen  Offline OP
Newbie
C

Joined: Nov 2017
Posts: 34
Hi, I'm trying to know, while I'm using tick(), how many minutes has been since the bar started. Probably what I need is minutesWithin(), but I'm not using it correctly, I think. If I have BarPeriod=2, and I call minutesWithin from inside a tick() function , I should get (AFAIK) only values of 0, 1 or 2 as much. But I get the following values, depending on the parameters:

printf("n %f", minutesWithin(0));
results in a range from 377.424653 to 1.522134

I don't understand this value of 377 (as I'm using Barperiod=2 it shouldn't be higher than that).

I want just to calculate inside a tmf() or a tick() if in the next minute is going to run() a new bar. So for example I want, If I have a BarPeriod=120, and a tick is called repeated times during that bar, knowing if it is the minute 119 inside that bar.

I guess that minutesAgo() could be of help also, but I don't get how to use it.

Re: minutesWithin() or who to know time elapsed inside a bar [Re: Cheulmen] #472638
05/09/18 09:22
05/09/18 09:22
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Aside from minutesWithin(), you can also simply get the current time inside the tick() function, and subtract the time from one bar before.

For obvious reasons, no matter how small your bar period, minutesWithin() can, and often will, return ranges of up to about 3000 minutes. BarPeriod=2 gives only the MINIMUM length of a bar.

Re: minutesWithin() or who to know time elapsed inside a bar [Re: jcl] #472642
05/09/18 16:36
05/09/18 16:36
Joined: Nov 2017
Posts: 34
C
Cheulmen Offline OP
Newbie
Cheulmen  Offline OP
Newbie
C

Joined: Nov 2017
Posts: 34
Do you mean saying that BarPeriod=2 gives the minimum length, that it could be bigger because the use of TimeFrame?

Re: minutesWithin() or who to know time elapsed inside a bar [Re: Cheulmen] #472643
05/09/18 19:38
05/09/18 19:38
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
A bar is at least as long as the time between 2 price ticks.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1