Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
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
1 registered members (SBGuy), 712 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
export asset to .txt file #477067
05/15/19 01:28
05/15/19 01:28
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
Hello all, Is it possible to export assets(USDJPY, EURUSD, CADJPY...etc) to .txt file using zorro script? if it is possible give me some advice. To export assets to .txt file manually is needs more time.

Re: export asset to .txt file [Re: tuuPaul] #477068
05/15/19 04:47
05/15/19 04:47
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
Also it needs to automatically export assets in time frequency

Re: export asset to .txt file [Re: tuuPaul] #477070
05/15/19 05:36
05/15/19 05:36
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
There is a command print(TO_CSV...) for this.

Re: export asset to .txt file [Re: Petra] #477071
05/15/19 09:29
05/15/19 09:29
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
is it really true?

Re: export asset to .txt file [Re: tuuPaul] #477072
05/15/19 09:54
05/15/19 09:54
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Yes.

Re: export asset to .txt file [Re: Petra] #477074
05/15/19 12:06
05/15/19 12:06
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
this script works but in file-export_USDJPY.csv there is no price only many string of 'une'. How to get price value?

function run(){
StartDate = 20160101;
EndDate = 20161231;
TimeFrame = 1;
vars une = series(priceClose());
print(TO_CSV,"une",une);
plot("une",une,NEW,BLUE);
}

Re: export asset to .txt file [Re: tuuPaul] #477078
05/15/19 15:35
05/15/19 15:35
Joined: May 2018
Posts: 134
S
SBGuy Online
Member
SBGuy  Online
Member
S

Joined: May 2018
Posts: 134
Dude... it's:

print(TO_CSV,"%f",une[0])

It adds a new CSV line at every run()

You can't just print a vars variable directly.

Re: export asset to .txt file [Re: SBGuy] #477079
05/15/19 16:02
05/15/19 16:02
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
Also i want to print dates with time. This price is timeframe of 1hour time. How?

Re: export asset to .txt file [Re: tuuPaul] #477081
05/15/19 16:51
05/15/19 16:51
Joined: May 2018
Posts: 134
S
SBGuy Online
Member
SBGuy  Online
Member
S

Joined: May 2018
Posts: 134
One of these functions should get what you want.

https://zorro-project.com/manual/en/month.htm

Off the top of my head, this will probably work

wdateBar(Bar)

play around with them.

Re: export asset to .txt file [Re: SBGuy] #477085
05/16/19 02:24
05/16/19 02:24
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
i tried to rewrite under your advice. Script is below but there is an error not work. What is the problem?

function run()
{
asset("EUR/JPY");
StartDate = 20160101;
EndDate = 20161231;
TimeFrame = 1;
vars une = series(priceClose());
printf(TO_CSV,"nDate: %s",strdate(YMDH,0));
print(TO_CSV,"une=%.3f",une[0])
}

Re: export asset to .txt file [Re: SBGuy] #477087
05/16/19 04:44
05/16/19 04:44
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
First row in .csv file is 0 price. I don not understand it.

Re: export asset to .txt file [Re: tuuPaul] #477089
05/16/19 06:55
05/16/19 06:55
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
You must enter first the start and end dates and then the asset and not the other way around. Thd error messages are all explained in the manual.

Re: export asset to .txt file [Re: Spirit] #477090
05/16/19 07:01
05/16/19 07:01
Joined: May 2018
Posts: 65
T
tuuPaul Offline OP
Junior Member
tuuPaul  Offline OP
Junior Member
T

Joined: May 2018
Posts: 65
i followed your instruction but there is nothing change.

Re: export asset to .txt file [Re: tuuPaul] #477115
05/17/19 14:21
05/17/19 14:21
Joined: Dec 2014
Posts: 206
Germany
Smon Offline
Member
Smon  Offline
Member

Joined: Dec 2014
Posts: 206
Germany
I would do it like this:

Code:
WriteFormat = "n%.5f,%.5f,%.5f,%.5f,%.5f,%.5f,%.5f,%.5f"
//this needs to match your variables!
//each %.5f means a var with 5 Digits, %d would mean an integer

sprintf(FileName,"Data\blabla%s.csv",strx(Asset,"/","")); // remove slash from forex pairs

if(is(INITRUN)
{
file_delete(FileName); //if you want to delete old files
file_write(FileName,"this,that,somethingelse,....",0);    //Header
}
file_append(FileName,strf(WriteFormat,v1,v2,v3...);
//v1, v2 are the variables you want to write


Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1