Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Akow, AndrewAMD, Quad), 733 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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