Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 7 1 2 3 4 5 6 7
Re: Z5 [Re: Mangal] #435218
01/03/14 22:33
01/03/14 22:33

A
acidburn
Unregistered
acidburn
Unregistered
A



You should set Stop & TakeProfit before entering trade(s), not after, I believe. Also I would not create 2 series of priceClose() data, but only one. Finally, I'd name the series a little better, so it's easier to parse the algo for humans. Comes handy later when you have to debug some issue and your eyes hurt. So, here's how I'd do it:

Code:
function run()
{
	BarPeriod = 1440;

	vars Close = series(priceClose());
	vars Price = series(price());

	Stop = 30 * PIP;
	TakeProfit = 500 * PIP;

	if (Close[2] < Close[1] && Price[0] < Close[2])
		enterLong();

	if (Close[2] > Close[1] && Price[0] > Close[2])
		enterShort();
}



Of course, I can't verify if your strategy does what you want it to do. You could try optimizing it now (Stop & TakeProfit, probably). One problem I see is that it can be dormant for a very long periods of time (month or maybe even two without a single trade), so it would not be easy to trade it for real. But, it's a good start for learning Lite-C. wink

Re: Z5 [Re: ] #435316
01/06/14 09:04
01/06/14 09:04
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
For closing prices it's normally better to use the price at a certain hour. By default, 1-day bars go from midnight to midnight, so they don't align to a certain market.

Re: Z5 [Re: jcl] #435377
01/07/14 02:31
01/07/14 02:31
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
Probably 17:00 NY time, if it is a major pair, it will be best. I will include later on this correction.

Just continuing with the idea of the previous script. I will keep as A1,A2,A3 for the time being because it allows to make several trials changing the Close for the High or Low and so on as well as increasing to A4, A5, and so on.

As with the parameters set as above, If we ad and "Exit Time = 5" the Anual Return goes to 126%. Then, when optimizing it goes down to 110% and then when doing Walk Forward Analisis for 3 cycles it goes down to -23%.

Supose now I want to introduce some filter, as it is written below and make optimization:


function run()
{
BarPeriod = 1440;
set (PARAMETERS);
vars A1 = series(priceClose(2));
vars A2 = series(priceClose(1));
vars A3 = series(price(0));
var per = optimize(0.000, 0.001,0.01);
var Vlr;

Vlr = A1[0] * per;
printf("Result=%.f",Vlr);


if (A1[0] < A2[0] and A3[0] < A1[0]-Vlr) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();

Stop = optimize(30,20,100)*PIP;
TakeProfit = optimize(500,200,700)*PIP;
ExitTime = 5;

}


When doing this optimization it popes up "error 043:EURUSD: wrong parameter!". I assume something is wrong in the script but I can not figure out where it can be, since before trying to optimize it seems to be working fine.

Re: Z5 [Re: Mangal] #435568
01/09/14 09:20
01/09/14 09:20
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
I found that the "optimize(0.00,0.001,0.01);" is the responsible for this message.

So, setting it up to a fix value of 0.01 gives an Anual Return of 732%. But there must be something wrong because when generating the Results Charts, it doesn't show them properly .

The script now looks like:

function run()
{
BarPeriod = 1440;

set (PARAMETERS);
vars A1 = series(priceClose(2));
vars A2 = series(priceClose(1));
vars A3 = series(price(0));
var percentage = 0.01;
var Vlr;

Vlr = A1[0] * percentage;



if (A1[0] < A2[0] and A3[0] < A1[0]-Vlr) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();

Stop = optimize(30, 20, 200)*PIP;
TakeProfit = optimize(500, 150, 700)*PIP;
ExitTime = 5;

}

and its results:

A1,A2,A3 Ar62% run..
Error 055: EUR/USD 2014 price history missing
BackTest: A1,A2,A3 Ar62% EUR/USD 2009..2014
Read A1,A2,A3 Ar62%_EURUSD.par
Profit 61$ MI 1$ DD 2$ Capital 7$
Trades 3 Win 67% Avg +267.7p Bars 4
AR 732% PF 30.89 SR 1.13 UI 1.7% Error 291%


Any clue why when clicking to Results don't show the charts with diferente values for optimization?

And then when adding the Walk Forward Analysis, "NumWFOCycles = 3;" it doesn't give results either:


A1,A2,A3 Ar62% run..
Error 055: EUR/USD 2014 price history missing
Walk-Forward Test: A1,A2,A3 Ar62% EUR/USD 2009..2014
Read A1,A2,A3 Ar62%_EURUSD_1.par A1,A2,A3 Ar62%_EURUSD_2.par

Is it due to the small number of trades that can not generate any statistics for Walk Forward Analysis and then it gives this message?







Last edited by Mangal; 01/09/14 09:24.
Re: Z5 [Re: Mangal] #435573
01/09/14 10:08
01/09/14 10:08
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You can see that your system only enters 3 trades, so its results are random. The WFO version will most likely not enter a single trade, so the system does not produce a result.

For WFO you should aim for about 50..100 trades per cycle when you optimize 2 parameters.

For avoiding the warning about missing 2014 data, either download it from FXCM or put "EndDate = 2013;" in your script.

Re: Z5 [Re: jcl] #435701
01/11/14 09:21
01/11/14 09:21
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
Thank you jcl. When adding "EndDate = 2013" the number of trades increase to 5 instead of 3 when giving 2014 data missing. I assume this is not something to worry about, though common sense says number of trades should be the other way around, that is less number of trades when ending in 2013.

Regarding data download from FXCM (or Alpari), it is data from Metatrader in both cases?. Some analysts suggest that data from Metatrader has plenty of gaps and errors so it may not be so reliable for backtesting?

Re: Z5 [Re: Mangal] #437139
02/10/14 08:58
02/10/14 08:58
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
I have been cheking the historical data from metatrader and in principle it is the same data that appears on the screen in the charts which in turns when executing trades appears to be reliable. So, the problems that appear in backtesting in Metatrader, like testing same EA in the same period and giving completely different results, must be due to diferente reasons, like architecture of EA or other reasons as you were pointing out somewhere.

Re: Z5 [Re: Mangal] #437140
02/10/14 08:59
02/10/14 08:59
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
I got now this message from my VPS provider which mentions that Metatrader will undergo some changes and may require some update from EA's. Is this going to affect Zorro?

RE: Autoboot v3.0.36 Update Available & Important Information about MT4 v600+ Update

Please be advised Meta Quotes has released a new MT4 update that may cause your software, including CNS Autoboot and many EA's, to stop functioning until they are also updated.

We have released CNS Autoboot v3.0.60 to resolve the issue with CNS Autoboot. MT4 terminals should be expected to auto update at some point in the near future, and so we recommend all subscribers install the CNS Autoboot update as soon as possible to retain compatibility. A reboot may be required to install this update.

We also recommend that you contact your EA publishers now to receive their software update and any further specific instructions.

Re: Z5 [Re: Mangal] #437142
02/10/14 09:01
02/10/14 09:01
Joined: Sep 2013
Posts: 73
M
Mangal Offline OP
Junior Member
Mangal  Offline OP
Junior Member
M

Joined: Sep 2013
Posts: 73
By the way, so far so good with Zorro Z5 real money and inside the results of the backtest essays with Zorro. Four months now runing.

Re: Z5 [Re: Mangal] #437153
02/10/14 14:45
02/10/14 14:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It's probably correct that MT4 v600+ will cause many EAs to stop functioning, but as far as we see - we've tested it with v604 - the Zorro EA is not affected.

Page 4 of 7 1 2 3 4 5 6 7

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1