Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 604 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Export technical indicators to CSV #473479
07/12/18 19:55
07/12/18 19:55
Joined: Sep 2017
Posts: 13
Y
Yop127 Offline OP
Newbie
Yop127  Offline OP
Newbie
Y

Joined: Sep 2017
Posts: 13
Hello all,
I am trying to do something extremely simple: create a CSV with Date, open, high, low, close, RSI columns. However, I am new to Zorro, and cannot quite manage it.
Here is what I have currently:

function run()
{
set(LOGFILE|PLOTNOW);
NumYears = 1;

vars Prices = series(price());
vars Closes = series(priceClose());


vars Price = series(price());
vars Closes = series(priceClose());
file_append("C:JC.csv",RSI(Closes,3,2,100));
}


This does not work. Any help would be deeply appreciated!
Thanks in advance

Re: Export technical indicators to CSV [Re: Yop127] #473483
07/13/18 09:29
07/13/18 09:29
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
This does indeed not work. The simplest way is print(TO_CSV,...) with a format string and all variables that you want to export.

Re: Export technical indicators to CSV [Re: jcl] #473490
07/13/18 15:46
07/13/18 15:46
Joined: Sep 2017
Posts: 13
Y
Yop127 Offline OP
Newbie
Yop127  Offline OP
Newbie
Y

Joined: Sep 2017
Posts: 13
In case someone else has the same issue, this piece of code does the trick.

Code:
function run()
{
	StartDate = 20100101;
	BarPeriod = 1440;

  vars Close = series(priceClose());
  vars SMA100 = series(SMA(Close,100));
  vars SMA30 = series(SMA(Close,30));

  
  string Format = "n%04i-%02i-%02i %02i:%02i, %.10f, %.10f";
	
	
file_append("JC2.csv",strf(Format,year(),month(),day(),hour(),minute(), Close[0], SMA30[0]));


Last edited by Yop127; 07/14/18 06:10.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1