Gamestudio Links
Zorro Links
Newest Posts
Historical Data with the 64bit FXCM Plugin
by Martin_HH. 01/21/26 21:59
Buy A8 Pro Version
by Spirit. 01/21/26 21:37
ZorroGPT
by TipmyPip. 01/20/26 07:17
Bar missing bug?
by jcl. 01/19/26 10:47
400 free seamless texture pack downl. here !
by NeoDumont. 01/18/26 19:09
FXCM demo test failed
by qin. 01/13/26 13:53
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (qin, Angerbeer, Martin_HH, Spirit), 7,198 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Castromangos, Quantum, stephensdeborah, promfast, joe_kane
19193 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Populating an array of dynamic size on each run of run() #482425
02/04/21 09:08
02/04/21 09:08
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline OP
Newbie
strimp099  Offline OP
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
Greetings,

My intent is to populate an array with option strikes for daily run. However I receive a syntax error when attempting to create an array like this:

Code
var strikes[NumContracts];


presumably because arrays are static and cannot be redeclared. According to the manual, using malloc to allocate space dynamically is slow. So something like this:

Code
var strikes = malloc(NumContracts*sizeof(var));


Is not recommended

Is there a standard way to dynamically create arrays during each run?

Re: Populating an array of dynamic size on each run of run() [Re: strimp099] #482426
02/04/21 10:48
02/04/21 10:48
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline
Senior Member
Grat  Offline
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
may be series?

Re: Populating an array of dynamic size on each run of run() [Re: Grat] #482428
02/04/21 11:30
02/04/21 11:30
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline OP
Newbie
strimp099  Offline OP
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
I’m trying to create an array of strikes each day. Can I do that with a series?

Re: Populating an array of dynamic size on each run of run() [Re: strimp099] #482430
02/04/21 13:40
02/04/21 13:40
Joined: Feb 2017
Posts: 1,811
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,811
Chicago
Allocations are slow.

The trick is to use a fixed-size buffer and only use as many elements as you need per run.

Incidentally, the maximum number of contracts available at any given run is MAX_CONTRACTS, so use MAX_CONTRACTS for your number of fixed buffer elements.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1