Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
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,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
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,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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