Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by jcl. 04/20/24 08:52
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (7th_zorro, Aku_Aku, henrybane, flink, 1 invisible), 712 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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