Gamestudio Links
Zorro Links
Newest Posts
how to plot a price curve and an indicator
by hola123. 04/04/20 18:47
deepsignal r run time error
by hola123. 04/04/20 18:17
Slowness after update
by Spirit. 04/04/20 11:46
Best Broker for US Resident?
by tradingest. 04/04/20 11:05
Ally Invest Can't Connect
by beo. 04/04/20 02:00
Clearing log window
by jbhunter. 04/04/20 00:58
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
11 registered members (kvm, Jerome8911, panz, 3run, HF_Psy, alibaba, hola123, hast29, AndrewAMD, Dooley), 660 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
beo, marsz, gonzalez21, Cobus, HF_Psy
18411 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
get string from R #478315
09/30/19 18:27
09/30/19 18:27
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
hi guys,
is there a way to get a string value from R? i tried every function like "ri" "rd" and "rv" with a character array but nothing appened.
I have to get an asset name from the Rterm.

Thanks, have a nice day

Re: get string from R [Re: maxwellreturn] #478316
09/30/19 18:38
09/30/19 18:38
Joined: Feb 2017
Posts: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
Chicago
In R, save strings to a file. Read the file from Zorro.

Re: get string from R [Re: AndrewAMD] #478328
10/03/19 21:37
10/03/19 21:37
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
Originally Posted by AndrewAMD
In R, save strings to a file. Read the file from Zorro.

thank you andrew, can you post an example of how i can store a string like this "EUR/USD,GBP/USD,EUR/JPY" from an external csv in a zorro string variable? thank you so much

Re: get string from R [Re: maxwellreturn] #478333
10/04/19 14:11
10/04/19 14:11
Joined: Feb 2017
Posts: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
Chicago
There are many R samples on the internet, and Zorro is very well-documented. Why not give it a try? laugh

If you want to make it easy, forget CSV's. Just put a single string in a temp file and load one at a time.
https://zorro-project.com/manual/en/str_.htm
https://zorro-project.com/manual/en/file_.htm

Re: get string from R [Re: maxwellreturn] #478363
10/09/19 12:47
10/09/19 12:47
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
thank you andrew, i ve tried to do what you suggest, but i think i get a bug.
this is mycode:
Code
        NumYears = 10;
	BarPeriod = 60;
	MaxLong = MaxShort = 1;
	LookBack = 500;
asset(file_content("C:\\Users\\utente\\Zorro\\Data\\best1.csv"));
vars Price = series(priceClose());
int per = 100;
var x = 2.5;
vars Trends1 = series(SMA(Price,per));
vars Trends2 = series(SMA(Price,per*x));
	
       if(crossOver(Trends1,Trends2))
       enterLong();
      if(crossUnder(Trends1,Trends2))
       enterShort();	


in the "best1.csv" there is only a line with written "GBP/AUD".
And i get this error:
Quote

Error 055: "GBP/AUD"
no history (2010 History\ "GBPAUD" , t6)
Error055: no bars generated


its like if it cant read the "/" in the file. Can someone explain why i get this wrong output?
Ps: i ve got the t6 file 2010 of GBP/AUD

Last edited by maxwellreturn; 10/09/19 12:48.
Re: get string from R [Re: maxwellreturn] #478364
10/09/19 13:13
10/09/19 13:13
Joined: Feb 2017
Posts: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
Chicago
Zorro eliminates the slash intentionally for things such as filenames, like t6 files. After all, you cannot have a slash in a filename.

I see no problems with this snippet. If you're still confused, post your entire script. It's more likely there's a problem with your history setup.

Re: get string from R [Re: AndrewAMD] #478367
10/09/19 14:10
10/09/19 14:10
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
Code
function run()
{
        NumYears = 10;
	BarPeriod = 60;
	MaxLong = MaxShort = 1;
	LookBack = 500;
asset(file_content("C:\\Users\\utente\\Zorro\\Data\\best1.csv"));
vars Price = series(priceClose());
int per = 100;
var x = 2.5;
vars Trends1 = series(SMA(Price,per));
vars Trends2 = series(SMA(Price,per*x));
	
       if(crossOver(Trends1,Trends2))
       enterLong();
      if(crossUnder(Trends1,Trends2))
       enterShort();	
		}


this is the entire code
this is what i get, you can see error message in zorro and other file you see is the csv file. I tried even without the "" but it give me the same error.
[img]https://ibb.co/5jQPxBt[/img]

Re: get string from R [Re: maxwellreturn] #478368
10/09/19 14:15
10/09/19 14:15
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
https://ibb.co/VHzkyDk
this is my history folder with the history of EUR/TRY (i said GBP/USD in the first post but i was wrong)
can be something relative to the name of t6 files? or is it a bug?

Re: get string from R [Re: maxwellreturn] #478369
10/09/19 15:36
10/09/19 15:36
Joined: Feb 2017
Posts: 905
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 905
Chicago
I bet your csv file uses quote characters! You cannot have any of that. Your file must be perfect.

Your file contents must be exactly seven characters: GBP/AUD

No quotes, no commas, no newline characters. It must be pure.

If you right-click on the file and click Properties, the file size must be seven bytes.

From R, one very good way to write the file would be to use the sink() method:
https://stackoverflow.com/a/2471806

Re: get string from R [Re: maxwellreturn] #478372
10/09/19 17:11
10/09/19 17:11
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline OP
Newbie
maxwellreturn  Offline OP
Newbie
M

Joined: Jul 2019
Posts: 26
wow thank you so much man, you were right the file was with quote characacters and it was 9 bytes. With sink function in R i get 7 bytes file thank you so much.

Page 1 of 2 1 2

Powered by UBB.threads™ PHP Forum Software 7.7.1