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
4 registered members (7th_zorro, Quad, VoroneTZ, 1 invisible), 623 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Output series data to CSV - dynamic length? #484323
10/09/21 13:38
10/09/21 13:38
Joined: Sep 2021
Posts: 8
EL PASO
P
pounceyzorro Offline OP
Newbie
pounceyzorro  Offline OP
Newbie
P

Joined: Sep 2021
Posts: 8
EL PASO
Hi,

Another noobie question...

I have coded up some specific series that I'd like to export to a CSV file; would have thought it to be pretty easy,
however, am not sure I am seeing the right output length's for the calculated series; I tried NumBars; it came out 0,
then Lookback, which was 80, etc... Am looking for something like the pseudocode below; I will adapt it to write to a
file, etc. The real issue is this: what should mySeriesLength be set to? Do I have to use a different function other
than run() to accompish this? It appeared that any output printf's in run() executed BEFORE the data was loaded,
series were calculated, etc.

vars myseries1=series(<function of interest>);
vars myseries2=series(<function of interest>);
...
for(i=0; i < mySeriesLength; i++)
{
printf("%f %f", myseries1[i],myseries2[i]);
}

Please advise,
TIA for your help,
Vode Norwood

Re: Output series data to CSV - dynamic length? [Re: pounceyzorro] #484325
10/09/21 15:28
10/09/21 15:28
Joined: Oct 2021
Posts: 4
C
Chiller Offline
Guest
Chiller  Offline
Guest
C

Joined: Oct 2021
Posts: 4
run is executed on every bar.
The first too times and the last time you can detect with the flags INITRUN, FIRSTRUN and EXITRUN.
e.g. if (!is(INITRUN)) will spare the initrun.
After the function run you still have an extra function thats called evaluate (and before main) these 2 are not repeated.

Last edited by Chiller; 10/09/21 18:19.
Re: Output series data to CSV - dynamic length? [Re: pounceyzorro] #484327
10/09/21 16:22
10/09/21 16:22
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
The length of a series is given in the series call, if none is given it's the lookback period.

Re: Output series data to CSV - dynamic length? [Re: Spirit] #484330
10/10/21 00:45
10/10/21 00:45
Joined: Sep 2021
Posts: 8
EL PASO
P
pounceyzorro Offline OP
Newbie
pounceyzorro  Offline OP
Newbie
P

Joined: Sep 2021
Posts: 8
EL PASO
Quick question: so, on each invocation of run(), the series values in, say, series[0] should give the current value that was calculated, independent of how many are being stored via the lookback period default length? Am assuming that the series acts like a queue, with data shifted from [0] to [1]...up through [lookback length -1] and the new data being placed in [0].

TIA for any responses,
Vode


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1