First i am a newbie, so sorry if i am missing something, thanks if some answer is received
Easy strategy over QQQ eod *t6 data, open trade any day of week at market open and close any day at market close (just for testing propose)
after train best parameters are 1.54 to open and 4.32 to close the trade. I test then to get a +17% annual return
Then i can open the *.par and change the 1.54 to 4.00, and test again to get a +142%, i can change to 1.00 and return is 63%
What i am doing wrong? to me seem the train is not getting best values.
I attack the QQQ.t6 data here:
https://drive.google.com/file/d/1EunmN96XuVFCOmNWyxM7d62RDoU0ULlI/view?usp=drive_linkAnd copy the strategy bellow:
// Simple Zorro Lite-C bot:
TRADE *myTrade;
function run()
{
set(PARAMETERS,LOGFILE); // write a trade log so you can verify fills
BarPeriod = 1440; // 1440 minutes = daily bars (matches EOD data)
LookBack = 0; // no indicators, no warm-up period needed
StartDate = 20160101; // adjust to taste, or delete to use full history
EndDate = 20171231; // Dates need to match FFFFMMDD format if you put just FFFF not work
// in trest mode, just works to download data
//asset("IWM_eod"); // loads C:\Zorro\History\IWM_eod.t6
asset("QQQ"); // loads C:\Zorro\History\QQQ.t6
Spread = 0; // bid/ask spread in pips (or price units) — 0 = no spread cost
Slippage = 0; // slippage added to fill price — 0 = fill exactly at the modeled price
Commission = 0; // commission per lot/contract — 0 = no commission
RollLong = 0; // overnight long swap/rollover — 0 = no carry cost
RollShort = 0; // overnight short swap/rollover — 0 = no carry cost
// --- DIAGNOSTIC: print what Zorro sees on the days that matter ---
// if(dow(0) == (1) || dow(0) == 2 || dow(0) == 3 || dow(0) == 4 || dow(0) == 5)
// printf("\n%s dow=%i Open=%.3f Close=%.3f",
// strdate("%Y-%m-%d", 0), dow(0), priceOpen(), priceClose());
//setf(TrainMode,TRADES+PEAK); //Funciona por que en train da 1.00
var DiaPreOpen = optimize("Parametro DiaPreOpen",5,1,5,1);
int IntDiaPreOpen = (int)round(DiaPreOpen);
// (int) recast a still stored in the 8-byte
//floating-point format to a genuine integer, i tested without (int) and work
//var DiaSemana = optimize("Parametro DiaSemana",2,1,4,1);
// --- Entry: signal on Tuesday (2), fills at Wednesday's open ---
// Fill=3 delays the fill to the next price quote (next bar's open).
printf("\n DiaPreOpen=%.3f", DiaPreOpen); //Saldrá un float
printf("\n IntDiaPreOpen=%i", IntDiaPreOpen); // Saldrá un integer
if(dow(0) == IntDiaPreOpen && !myTrade) {
Fill = 3;
myTrade = enterLong();
}
// Fill=1 fills at the most recent quote instead of waiting for the next
// one, so with daily bars the close order fills at THIS bar's close
// (Thursday), not the following day's open.
var DiaClose = optimize("Parametro DiaClose",4,1,5,1);
int IntDiaClose = (int)round(DiaClose);
if(dow(0) == IntDiaClose && myTrade) {
Fill = 1;
exitTrade(myTrade);
// --- DIAGNOSTIC: confirm the exit landed on THIS (Thursday) bar
// and that no Stop/Trail line appears for this trade in the log.
printf("\n >> EXIT check: signaled %s (dow=%i) at Close=%.3f -- check trade log above for Stop/Trail lines",
strdate("%Y-%m-%d", 0), dow(0), priceClose());
myTrade = 0;
Fill = 3; // restore delayed fill for the next Tuesday entry
}
}