Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, AndrewAMD, TipmyPip, Quad), 889 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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