Gamestudio Links
Zorro Links
Newest Posts
New Zorro version 2.20
by AndrewAMD. 11/15/19 03:34
What are you working on?
by jumpman. 11/14/19 16:17
A9
by preacherX. 11/14/19 15:28
Idx calculated every tick
by jcl. 11/14/19 15:25
IG plugin initial release
by Dalla. 11/13/19 19:07
Login 0 IG ..
by Dalla. 11/13/19 19:03
Moving Average crossover
by gra9. 11/13/19 10:43
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
6 registered members (Iglarion, kvm, AndrewAMD, Dooley, 3run, 1 invisible), 675 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LaszloK, gra9, Dev_ill, Ryu, andrews825
18329 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: 17
Köln
S
StefanCGN Offline OP
Newbie
StefanCGN  Offline OP
Newbie
S

Joined: Jul 2019
Posts: 17
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: 17
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 17
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: 789
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 789
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: 17
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 17
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: 789
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 789
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: 17
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 17
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: 789
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 789
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.


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