Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Copies of function #470668
01/29/18 12:45
01/29/18 12:45
Joined: Jul 2017
Posts: 785
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 785
Hi, everybody,

Let's say, there is a portfolio of 20+ market-systems which use only 4 algo functions but with different parameters (assets,TF,etc).

I read/store all params in a array of structs- one field of which is a pointer to the algo function, - and switch to the relevant set in a loop of algos.

The problem is with static vars - which of course get changed with every call to the same function- even though it is a different component.

Is there an elegant way in Lite-C to achieve what I want without having to create multiple clones of same algo functions?

Re: Copies of function [Re: Zheka] #470669
01/29/18 12:51
01/29/18 12:51
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
Maybe I misunderstand the question, but isn't this what AlgoVars are for?
http://zorro-project.com/manual/en/algovar.htm

Re: Copies of function [Re: Dalla] #470672
01/29/18 14:34
01/29/18 14:34
Joined: Jul 2017
Posts: 785
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 785
That's not the problem.
If there is an algo function tradeTrend() and e.g. I build frames in it by "skipping" bars, then when the same tradeTrend()function is called in a different component (i.e. with different params),
then the static var "skipped" bars gets changed as well. And so messes up frame construction in the first "instance".

Re: Copies of function [Re: Zheka] #470690
01/30/18 16:31
01/30/18 16:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I would give the same answer as Dalla. Use no static var for skipped bars, but an algovar. Then it's individual per algo.

Alternatively, you can use a static series for storing those variables.

Re: Copies of function [Re: jcl] #470700
01/31/18 11:42
01/31/18 11:42
Joined: Jul 2017
Posts: 785
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 785
Ok, will probably use both. Thank you.


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