Gamestudio Links
Zorro Links
Newest Posts
The Black Book
by SteveG. 06/06/20 14:01
Indicator coding
by danatrader. 06/06/20 11:53
New AUM
by Aku_Aku. 06/06/20 10:10
Reading a TXT file on server
by Truth. 06/05/20 18:22
Oanda instruments
by Morris. 06/05/20 10:24
MT4/5 - wrong M1 time
by Grat. 06/05/20 08:34
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
8 registered members (AndrewAMD, SteveG, Mio, 3run, Iglarion, danatrader, Grat, 1 invisible), 473 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Frank_Shieh, PBSeven, Hardi01, Giuseppe, AdamWu
18461 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: 39
Köln
S
StefanCGN Offline OP
Newbie
StefanCGN  Offline OP
Newbie
S

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

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

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

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

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

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

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