Gamestudio Links
Zorro Links
Newest Posts
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
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 468 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Accessing time series in TMF #478082
09/04/19 09:59
09/04/19 09:59
Joined: Jul 2019
Posts: 49
Köln
S
StefanCGN Offline OP
Newbie
StefanCGN  Offline OP
Newbie
S

Joined: Jul 2019
Posts: 49
Köln
Hi all,

I am trying to develop a TMF, that wants to use filtered price data, but I am not able to access this data inside a TMF.
Does anybody have an example, where / how to declare the series variables, that it works?

Thanks in advance!

Last edited by StefanCGN; 09/04/19 12:52.
Re: Accessing time series in TMF [Re: StefanCGN] #478450
10/23/19 19:54
10/23/19 19:54
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
hi, I am having the same issue, I am unable to pass a whole series into a TMF.
The half-way solution right now that I know of is to use Asset Variables for the TMF.
The problem with this hacky solution is that AssetVar only goes up to [7], which I'm sure in our case we need more than 7 potential
variables to pass to the TMF

#define VARIABLE AssetVar[0] // no semi-colon
#define VARIABLE1 AssetVar[1]

function run()
{
vars your_series = series(some_fuction);
VARIABLE = your_series[0];
VARIABLE1 = your_series[1];
}

Re: Accessing time series in TMF [Re: StefanCGN] #478454
10/23/19 20:16
10/23/19 20:16
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
If you really need the series in a TMF, generate the series in run(). Note that series returns a vars - this is actually a pointer to a var array (or a double array). Hold on to the pointer and use it to access the time series from any function. You should assume the pointer expires every time run() is invoked.

Re: Accessing time series in TMF [Re: AndrewAMD] #478470
10/24/19 22:26
10/24/19 22:26
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
Originally Posted by AndrewAMD
If you really need the series in a TMF, generate the series in run(). Note that series returns a vars - this is actually a pointer to a var array (or a double array). Hold on to the pointer and use it to access the time series from any function. You should assume the pointer expires every time run() is invoked.


could you please give an example of this?

Re: Accessing time series in TMF [Re: StefanCGN] #478471
10/24/19 22:43
10/24/19 22:43
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Make a global vars. During run(), set the vars to a series() call. Then access the global vars anywhere.

Why not give it a try? laugh

Re: Accessing time series in TMF [Re: StefanCGN] #478475
10/25/19 18:11
10/25/19 18:11
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
here is my interpretation:

vars Close; // unintialized vars GLOBAL

function run()
{
Close = series(priceClose()); // series that generate within run()
}

the way this would work is the series is running within run() but sends the series data over to a global vars.
But what is the outcome of " the pointer expires every time run() is invoked."?

Does it mean Close is only capable of accessing [0] since the pointer is expired each iteration of run() ?

Re: Accessing time series in TMF [Re: StefanCGN] #478476
10/25/19 18:30
10/25/19 18:30
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Originally Posted by felixfx
Does it mean Close is only capable of accessing [0] since the pointer is expired each iteration of run() ?
No, you still have the whole series.

This is what I meant:

1) run () invoked
2) save to global vars
3) run() invocation is complete
4) access the vars from tick()
5) access the vars from TMF
6) access the vars from tick()
7) access the vars from TMF
8) run () invoked
9) Now your vars has expired, you need to set it to the global vars again
10) run() invocation is complete

If you try to dereference an invalid (or "expired") pointer, your script will exhibit undefined behavior. By that, I mean your vars expires. Don't use an expired vars.


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