Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,806
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,806
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