Gamestudio Links
Zorro Links
Newest Posts
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
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, wandaluciaia, 1 invisible), 798 guests, and 6 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
Wrapping my head around series #486510
08/31/22 15:09
08/31/22 15:09
Joined: Aug 2022
Posts: 65
alun Offline OP
Junior Member
alun  Offline OP
Junior Member

Joined: Aug 2022
Posts: 65
Zorro has this poweful concept of series:

Code
vars Closes = series(priceC());


Just decomposing it in plain C:

Code
double* Closes = series(priceC());


`priceC()` returns `double` and series just delegates to some other function `series0` which I can't find in sources.

Code
inline vars series(var val=0,int size=0) { return series0(val,size); }


I'd like to understand what C black magic transforms the double val parameter into a series of values with the respect to actual function passed into `series` argument?

This could help to build a better intuition around that call.

Would appreciate if someone could explain it.

Thanks,
Alex



Last edited by alun; 08/31/22 15:10.
Re: Wrapping my head around series [Re: alun] #486512
08/31/22 15:25
08/31/22 15:25
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
run() is called many times, and series() can only be called inside run(). series() counts the number of times it was invoked, corresponding to a particular timeseries.

Read about run() and series() here:
https://zorro-project.com/manual/en/run.htm
https://zorro-project.com/manual/en/series.htm

Re: Wrapping my head around series [Re: alun] #486522
09/01/22 09:28
09/01/22 09:28
Joined: Aug 2022
Posts: 65
alun Offline OP
Junior Member
alun  Offline OP
Junior Member

Joined: Aug 2022
Posts: 65
Hi Andrew, thanks for the answer.

I think I understand now, so it just has some counter (the number of a time series) which is reset to 0 before each run.

Then run called for each bar including LoopBack.

And the series number is incremented each time series called again.

Since the order of calls to series(...) remains the same - it can feed a simple double value to a relevant time series array.

And finally return what it has collected so far for this time series.

That's smart!

Thanks for the clues again!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1