Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Basic within-bar statistics #443216
07/11/14 04:06
07/11/14 04:06
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
I understand that BarPeriod sets the sampling rate of the price curve, and run will be executed exactly once for each fully formed bar.

FR1:
In run(), allow access to the individual ticks comprising the bar. For example, if BarPeriod is 60, populate an array of TICKs with one element for each minute that comprises the bar. The reason is to allow custom within-bar statistics.

Short of that,
FR2:
You already compute some basic within-bar statistics for me. For example,
priceHigh() is essentially the max(highs) of all ticks comprising the bar
priceLow() is min(Low)
price is average(something) (By the way, this is underspecified. what is averaged, the O, H, L, or C of each tick?)
MedPrice() is median(something)
TypPrice() is (High + Low + Close)/3
WCLPrice() is also underspecified

These are all operating on within-Bar values. I propose the following additions.
within-bar stddev
variance
percentile or at least 1st and 3rd quantile
bool highFirst, returns true if the highest high came before the lowest low in the bar. else false
var highDelayWithinBar returns proportion of time within the bar that passed before the highest high was reached. i.e. 0.0 if open == high, 1.0 if close == high.
lowDelayWithinBar
and anything else you can think of

Re: Basic within-bar statistics [Re: GPEngine] #443220
07/11/14 06:18
07/11/14 06:18
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
You can do that already: when you set TICKS, g->asset->pTicks[i] is a pointer to a list of TICK pointers within bar i. You can then use this list for computing the moments and other statistics within the bar. Use the Moment function, not the StdDev function.

In live trading though, ticks are not stored in an array, so you'd need to update the statistics in a TMF in real time.

Re: Basic within-bar statistics [Re: jcl] #443235
07/11/14 14:02
07/11/14 14:02
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Oh, neat.

Do you have a code example of updating the statistics in a TMF in real time?

Re: Basic within-bar statistics [Re: GPEngine] #443239
07/11/14 14:37
07/11/14 14:37
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
No, this task did not come up so far. priceClose() in a TMF is the last price tick; whenever it changes, store its sum, the sum of its squares, and increase a counter. From these 3 values you can then calculate the mean, variance, stddev and so on.

Re: Basic within-bar statistics [Re: jcl] #443241
07/11/14 14:46
07/11/14 14:46
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
in price() what is averaged? The Close of each tick?
same question for MedPrice() and WCLPrice()

Re: Basic within-bar statistics [Re: GPEngine] #443243
07/11/14 14:52
07/11/14 14:52
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Indicators don't use ticks. I don't know what WCLPrice() does - you'd need to look into its source. All docs that I got are in the manual, so I have no more info than you about the TA-Lib indicators.

price() is the average of (H+L)/2 of all ticks. It's not identical to the average of the Close.



Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1