Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Nymphodora, Quad, TipmyPip, Imhotep), 852 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
The Cold Blood Index #455762
10/29/15 09:32
10/29/15 09:32
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I'm having a go at implementing jcl's Cold Blood Index from his Financial Hacker website. Its all pretty clear, other than storing the balance curve as a double array in a file to be called in the Cold Blood Index Script. Here is what I've tried:

Code:
//globals
var Daily;
int Day = 0;
...
//in the run function
// store daily results in an equity curve
string FileName = "Log\\SpreadCombosDaily1.txt";
static int LastDay = 0;
if(is(LOOKBACK))
  LastDay = Day = 0;
else if(LastDay != day()) {
  Daily = Equity;
  LastDay = day();
  file_append(FileName, &Daily);
}	

printf("\nDaily:%10.5f\n", Daily);

...



When I run this script, the file to store the balance curve is created, but nothing is written to it. I'm also unable to open it until I close the instance of Zorro that I used to create it.

The print function indicates that the correct values are being evaluated, so I think I have isolated my problem to the file_append function.

What am I doing wrong? What's the best way to write this data to a file to be called in a different script?

Re: The Cold Blood Index [Re: boatman] #455767
10/29/15 15:30
10/29/15 15:30
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The size is missing:
file_append(FileName, &Daily, sizeof(var));

If there is no size, file_append assumes that a string is appended, and if the string is empty, nothing is appended.

Re: The Cold Blood Index [Re: jcl] #455779
10/29/15 21:49
10/29/15 21:49
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Head slap! Of course the size needs to be specified. Thanks for pointing that out.

The size argument to the file_append function doesn't appear in the manual - can it be added please?

Re: The Cold Blood Index [Re: boatman] #464531
02/23/17 13:39
02/23/17 13:39
Joined: May 2016
Posts: 180
Prague
pcz Offline
Member
pcz  Offline
Member

Joined: May 2016
Posts: 180
Prague
Just a quick question, hope it's not too stupid:

The variables TradeDays, DrawDownDays and CurveLength contain number of days. Is it (in general) number of calendar days, number of business (i.e. trading) days or number of days when there's a change in equity?


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