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
5 registered members (Quad, AndrewAMD, Imhotep, TipmyPip, Edgar_Herrera), 809 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
Pls help: No bars generated from EOD history #477462
06/30/19 09:42
06/30/19 09:42
Joined: Jun 2019
Posts: 6
J
JesseL Offline OP
Newbie
JesseL  Offline OP
Newbie
J

Joined: Jun 2019
Posts: 6
Hello,

I've just started using Zorro. Got a problem testing strategy using stock daily bars. Can someone help? Thanks!

I converted a stock daily historical data CSV file to EOD history in t6. The CSV is attached. It has GOOGL daily bar from 2014-2019 like this:
Quote

Date,Open,High,Low,Close,Adj Close,Volume
2014-06-30,586.760010,587.710022,583.289978,584.669983,584.669983,1478900
2014-07-01,587.650024,593.659973,586.289978,591.489990,591.489990,1643200
2014-07-02,592.260010,594.150024,589.109985,590.780029,590.780029,1195800
2014-07-03,591.700012,594.250000,589.000000,593.080017,593.080017,898900
2014-07-07,593.510010,595.650024,587.940002,590.760010,590.760010,1336700
2014-07-08,586.369995,587.969971,574.000000,578.400024,578.400024,2125200
2014-07-09,578.950012,584.099976,577.000000,583.359985,583.359985,1372800
2014-07-10,573.000000,585.250000,572.099976,580.039978,580.039978,1436200
2014-07-11,581.000000,588.229980,580.580017,586.650024,586.650024,1511600
2014-07-14,590.599976,594.859985,586.690002,594.260010,594.260010,1951600
2014-07-15,595.150024,595.299988,585.309998,593.059998,593.059998,1673800
2014-07-16,596.890015,597.000000,590.250000,590.619995,590.619995,1440800
2014-07-17,588.969971,589.500000,576.849976,580.820007,580.820007,2935300
2014-07-18,603.010010,606.700012,590.919983,605.109985,605.109985,4871600
2014-07-21,601.349976,604.159973,594.450012,598.440002,598.440002,2237900
2014-07-22,599.700012,608.890015,599.260010,603.570007,603.570007,1881600
2014-07-23,602.049988,607.049988,601.349976,605.190002,605.190002,1106000
2014-07-24,605.530029,608.909973,601.000000,603.010010,603.010010,1355000
2014-07-25,599.250000,601.000000,595.750000,598.080017,598.080017,1360000
2014-07-28,597.750000,601.099976,592.590027,599.020020,599.020020,1358100
2014-07-29,597.700012,598.489990,592.169983,593.950012,593.950012,1366600
2014-07-30,595.809998,598.450012,592.700012,595.440002,595.440002,1215100
....


The script converting data is:
Code
string InName = "GOOGL.csv";
string OutName = "GOOGL_d.t6";
string Format = "%Y-%m-%d,f3,f1,f2,,f4,f6";

function main()
{
   //Verbose = 7;
	int Records = dataParse(1,Format,InName);
	printf("\n%d lines read",Records);
    if(Records) dataSave(1,OutName);

}


I have also made my own AssetsList file.
Code
Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission,Symbol
GOOGL,1000,1.0,0,0,1,1,1000,2,1,-0.005,GOOGL


My backtesting script:
Code

function run()
{
    if(is(INITRUN)) 
    {
        assetList("AssetsStock");
        History = "_d.t6";
        asset("GOOGL");
        StartDate = 2017;
        EndDate = 2018;
        BarPeriod = 60*24;
        LookBack = 600;
        //TimeFrame = 1; 
        //TradesPerBar = 1;
   }

	Verbose = 2;
	set(LOGFILE|PLOTNOW); // log all trades

	vars Prices = series(priceClose());
        vars fastema = series(EMA(Prices,50));
        vars slowema = series(EMA(Prices,80));
        if(fastema[0]>slowema[0]) enterLong();
        if(fastema[0]<slowema[0]) exitLong();

	
	PlotWidth = 800;
	PlotHeight1 = 300;
}


It looks the data can be loaded correctly, but Zorro always complains no bar generated:
Quote

stock_trend compiling...........
Error 016: Date range 2019-06-28 00:00:00 - 2014-06-30 00:00:00
Error 055: No bars generated
Error 047: No bars to plot!

Attached Files
GOOGL.csv (15 downloads)
Last edited by JesseL; 06/30/19 10:06.
Re: Pls help: No bars generated from EOD history [Re: JesseL] #477466
06/30/19 16:20
06/30/19 16:20
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Your csv is oldest to newest, but Zorro uses data from newest to oldest. Change your format string to indicate the reverse order.

Re: Pls help: No bars generated from EOD history [Re: AndrewAMD] #477467
06/30/19 20:14
06/30/19 20:14
Joined: Jun 2019
Posts: 6
J
JesseL Offline OP
Newbie
JesseL  Offline OP
Newbie
J

Joined: Jun 2019
Posts: 6
Thank you! Using dataSort after dataParse solved the problem. I didn't find how to indicate the order in format string. Please suggest if you know it.

Re: Pls help: No bars generated from EOD history [Re: JesseL] #477468
06/30/19 22:48
06/30/19 22:48
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
That works too. I was referring to adding a + sign to the front of the string, to indicate ascending order.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1