3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
mayark
OP
Newbie
|
OP
Newbie
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,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
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. 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
mayark
OP
Newbie
|
OP
Newbie
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
danatrader
Senior Member
|
Senior Member
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
mayark
OP
Newbie
|
OP
Newbie
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: danatrader]
#480331
06/01/20 11:01
06/01/20 11:01
|
Joined: Oct 2016
Posts: 23 NSW
mayark
OP
Newbie
|
OP
Newbie
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.
|
|
|
|