Gamestudio Links
Zorro Links
Newest Posts
Get a csv file into an array of structs, confused about lite-c
by easyX
6 minutes 32 seconds ago
Random walk vs Real price statistic
by kujo
Yesterday at 21:40
Inline functions in Lite-C
by MasterQ32
Yesterday at 21:04
Alpha Vantage API key - where to put?!
by veepsirtt
Yesterday at 10:26
Using standard C libraries with Zorro?
by Hredot
Yesterday at 02:51
AssetVars in Asset Lists
by Hredot
Yesterday at 02:50
How to count
by brax
02/17/18 20:15
AUM Magazine
Latest Screens
Forgotten Tales - Demo version
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Who's Online
21 registered (easyX, Hredot, kujo, alibaba, AndrewAMD, Kartoffel, DASFX, boatman, 4 invisible), 458 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
veepsirtt, trulala, elninio, Thwessen23, rmassip
17890 Registered Users
Topic Options
Rate This Topic
#470524 - 01/18/18 16:03 Bug in minutesWithin()?
Zheka Online
Member

Registered: 07/03/17
Posts: 175
As per manual,minutesWithin() is to return
Quote:
Total number of minutes from start to end of the bar with the given offset
It works as it should except for the first bar on Sunday.

Weekend=1, first available M1 "tick" on Sun is 2116 UTC.
Quote:
[1866: Fri 16-05-13 20:46] (122.80) Skiping.. minWithin= 5.0, skipBars= -2

[1867: Fri 16-05-13 20:51] (122.80)time= 1651
[1868: Fri 16-05-13 20:56] (122.82)time= 1656
[1869: Fri 16-05-13 21:01] (122.99)time= 1701

[1870: Sun 16-05-15 21:21] (122.85) Skiping.. minWithin= 2900.0, skipBars= -1

[1871: Sun 16-05-15 21:26] (122.86) Skiping.. minWithin= 5.0, skipBars= -1

2900 minutes is exactly the time to the end of the previous bar on Friday, not to open at 2116 on Sun.

Top
#470536 - 01/19/18 08:45 Re: Bug in minutesWithin()? [Re: Zheka]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26216
Loc: Frankfurt
A bar has a start and an end. When a bar ends, the next bar starts. Your weekend bar started Friday 21:01 and ended Sunday 21:21. Weekend bars are long and 2900 minutes are perfectly normal.

Top
#470539 - 01/19/18 13:18 Re: Bug in minutesWithin()? [Re: jcl]
Zheka Online
Member

Registered: 07/03/17
Posts: 175
>>When a bar ends, the next bar starts<<
That's not an "obvious assumption"; nor is it conventionally used. Anyway, now I know.

Out of curiosity and wanting to learn:
- a (potentially) big, 2900-min bar is clearly uncomparable to, eg. a 60-min bar. How do you conceptually view it and handle such irregularity in a price series?

E.g. I use sometimes an MA of the range, not average true range. And such an irregular bar would screw the calculation, especially a recursive one like ExMA.

Calculations that only use Close will not be affected, but things using High/Low will be.

- What will be the price() calculation for "weekend" bars?

Top
#470542 - 01/19/18 15:21 Re: Bug in minutesWithin()? [Re: Zheka]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26216
Loc: Frankfurt
price() is the mean price of the bar. Bar length irregularity is not evaluated in trading systems, except for special cases where tick density or sampling frequency is important.

Top
#470543 - 01/19/18 15:36 Re: Bug in minutesWithin()? [Re: jcl]
Zheka Online
Member

Registered: 07/03/17
Posts: 175
Ok, not length per se, but a range?

Top
#470544 - 01/19/18 15:40 Re: Bug in minutesWithin()? [Re: Zheka]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26216
Loc: Frankfurt
Depends on long term or short term, and for what you need the range. For a very short term range, such as 2 or 3 bars, tick density can indeed play a role.

Top


Moderator:  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net