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
3 registered members (Edgar_Herrera, VoroneTZ, Akow), 973 guests, and 4 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
Page 1 of 2 1 2
Windows 10 file_write error #480284
05/30/20 01:10
05/30/20 01:10
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
Hello,

I am getting an error for the last 4 lines of code below. I tried various ways to set the file path but with no luck. I appreciate any help. I know it's basics but I have been trying to get this working for hours with no luck.

Error 062: Can't open test-file_read_EURCHF.par


char name1[200] ;
name1 = "c:\\Zorro\\Strategy\\test1.txt";
string content="";
file_write (name1, content, 0);

Re: Windows 10 file_write error [Re: mayark] #480288
05/30/20 07:45
05/30/20 07:45
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Cant open par means you need to train the parameters.
Take away all the optimize stuff and it probably works.

Re: Windows 10 file_write error [Re: danatrader] #480296
05/30/20 13:43
05/30/20 13:43
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
Thanks for your reply. The Problem is, script works as soon as those four rows of code relates to file_read command are removed.

Rest of the code is from the run function from the below article.

https://financial-hacker.com/binary-options-scam-or-opportunity/


I want to capture the Buy/Sell signal in a fext file.

Last edited by mayark; 05/30/20 13:44.
Re: Windows 10 file_write error [Re: mayark] #480297
05/30/20 13:57
05/30/20 13:57
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Those lines of code and your error are still 100% unrelated to each other. If you can read the code you are describing, you can obviously see that it's not doing anything with the .par file.

If you're not sure what the code is, read the function descriptions in the manual until you understand. Bad things happen when you do not understand your code. wink

Also, the latest version of the Financial Hacker scripts (including all bug fixes) are actually in the zip files listed in the right-hand column. You should use those and not the code in the blog post.

Re: Windows 10 file_write error [Re: mayark] #480305
05/31/20 02:53
05/31/20 02:53
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
Thanks for your reply.

I have modified the script as follows. It's the full script. The error it's throwing now like this.

Error 062: Can't open (wb:22)


It doesn't create a new .txt file nor deletes the existing file with the below script. However, it seems to load the data and do other things except dealing with file functions.

Thanks.


Script starts here

====


var objective()
{
return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}

int m;
m =1;
int v = 0;
int endtime,starttime;






function run()
{



starttime=timer();


m = m+1;


if (m==1)
{
print("Timer");

timer();
v = timer();

print(v);
}

char name1[200] ;
name1 = "c:\\zorro\\strategy\\test1.txt";
string content="";
int length=0;

set(LOGFILE|TESTNOW);
BarPeriod = 5;
LookBack = 110;
NumWFOCycles = 20;
NumCores = -1;
PlotHeight1 = 340;
PlotWidth = 800;

set(BINARY);
WinPayout = 85;
LossPayout = 0;

LifeTime = 1;
int TimePeriod = optimize(20,10,100);
var Threshold = 0.008*(HH(TimePeriod)-LL(TimePeriod));


if(NumOpenLong+NumOpenShort == 0)
{
if(HH(TimePeriod) - priceClose() < Threshold)
{



printf(strf("\nDone Sell!--",m));


Sleep(3000);
if (file_length(name1)>0)
{
file_delete (name1);
}
file_write (name1, content, 0);



}
else if (priceClose() - LL(TimePeriod) < Threshold)
{





printf(strf("\nDone Buy!--",m));


Sleep(3000);
if (file_length(name1)>0)
{
file_delete (name1);
}
file_write (name1, content, 0);



}
}

}

Re: Windows 10 file_write error [Re: mayark] #480306
05/31/20 07:38
05/31/20 07:38
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
I assume you did try something like that

file_write("c:\\test.log", "123", 0);

it works as soon as you take that simple string out the following section.
Also deleting works fine.

if(NumOpenLong+NumOpenShort == 0)
{
if(HH(TimePeriod) - priceClose() < Threshold)
{


printf(strf("\nDone Sell!--",m));


Sleep(3000);
if (file_length(name1)>0)
{
file_delete (name1);
}
file_write (name1, content, 0);


}
else if (priceClose() - LL(TimePeriod) < Threshold)
{

printf(strf("\nDone Buy!--",m));


Sleep(3000);
if (file_length(name1)>0)
{
file_delete (name1);
}
file_write (name1, content, 0);

}



When you realize things work once you take away all the variations, I guess maybe one issue is


name1 = "c:\\zorro\\strategy\\test1.txt";

from the manual:

file_write (string name, string content, int length)
Stores the content of a string, series, or other data array in a file.

Last edited by danatrader; 05/31/20 07:39.
Re: Windows 10 file_write error [Re: mayark] #480328
06/01/20 10:03
06/01/20 10:03
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
Thank you for your answer.
It's still no go for me even with the text file just sits on the c drive or inside a folder. I tried to run the app as the admin user, but it wouldn't work.

Last edited by mayark; 06/01/20 10:04.
Re: Windows 10 file_write error [Re: mayark] #480329
06/01/20 10:48
06/01/20 10:48
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Did you define name1 = "c:\\zorro\\strategy\\test1.txt"; as a string?
Did you go iterative?

Looks to me, you want too much too fast.

Re: Windows 10 file_write error [Re: mayark] #480330
06/01/20 10:56
06/01/20 10:56
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
I downloaded the latest version of Zorro. But in the dropdown list I can't find the broker Fxcm. However it somehow found the account details including the password eventhough I specifically installed it a new directory. Strange.

Re: Windows 10 file_write error [Re: danatrader] #480331
06/01/20 11:01
06/01/20 11:01
Joined: Oct 2016
Posts: 23
NSW
M
mayark Offline OP
Newbie
mayark  Offline OP
Newbie
M

Joined: Oct 2016
Posts: 23
NSW
Hi Danatrader,

Absolutely not complaining and hopefully not asking too much. I tried many things over the last several days. Just downloaded the latest Zorro version but ran into a different issue as replied earlier.

Yes, I am going in circles but hopefully not asking too much as said earlier.

Ok, fixed the issue after changing as you suggested the variable name1 to string as well as changing the folder permissions and then running zorro app as the admin.
From memory, it was originally using the data type string then I changed it after seeing an example in the forum. I think I will carry on and will keep an eye out for an answer for my new issue with the broker id not appearing in the latest Zorro version's broker list.

Thank you Danatrader and others for your feedback.

Last edited by mayark; 06/01/20 11:09.
Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1