Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 923 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Binary Options Bugs #462797
10/29/16 12:10
10/29/16 12:10
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
I have experimented with the binary options script from the financial hacker blog. Below is the code that I use:

Code:
var objective()
{
	return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}

function run()
{
	//assetList("AssetsFix.csv");
	//assetList("AssetsBinary.csv");
	
	BarPeriod = 5;
	LookBack = 100;
	NumWFOCycles = 20;
	NumCores = -1;
	
	set(BINARY);
	WinPayout = 75;
	LossPayout = 0;

	set(PARAMETERS);
	int TimePeriod = optimize(20,10,100);
	var Threshold = 0.01*(HH(TimePeriod)-LL(TimePeriod));
	
	while (asset(loop("EUR/USD")))
	{
		if(NumOpenLong+NumOpenShort == 0) 
		{
			LifeTime = 1;
			if(HH(TimePeriod) - priceClose() < Threshold)
				enterShort();
			else if(priceClose() - LL(TimePeriod) < Threshold)
				enterLong();
		}
	}
}



When training and running it on EUR/USD with the provided Zorro 1.5 t6 history I get a total loss while the blog reports an AR of about 180%.

When training and running it on .bar history with Dukascopy data i got a different result. There I was profitable with a SR of 0.77. But doing multiple training runs did not always produce the same results! Once I only got a SR of 0.20!

Since the broker symbol is actually EUR/USD.bo i needed to create a different Assets file by copying the AssetsFix.csv file and changing the symbol names. I did that and noticed totally different results again.

Even uncommenting the line assetList("AssetsFix.csv"); after training changes the testing result substantially. And when training with the AssetsFix.csv the results are different once more. I thought the AssetsFix.csv is the default, so adding this line should not change the results.

I think also the while(asset(loop())) construct causes some problems. This is the only difference between the original code from the blog and the blog code gives different results when backtested.

Re: Binary Options Bugs [Re: trenki2] #462838
10/31/16 11:58
10/31/16 11:58
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The data format has no effect on the strategy. But the asset settings can affect the displayed "Annual Return" percentage, which is is the annual profit divided by the sum of drawdown and margin. Since there is no margin for binary options, the "annual return" is not a very useful parameter for a binary strategy. Useful parameters are the profit factor, sharpe ratio, or CAGR.

You must get no loss and no different results with different training runs, or something is wrong with your data or setup. Check your equity curve - it must look as in the attachment:


Attached Files
Binary_EURUSD.png (15 downloads)
Re: Binary Options Bugs [Re: jcl] #462845
10/31/16 17:03
10/31/16 17:03
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
I uninstalled Zorro S 1.50.6 and reinstalled it and took the history from the download page.

When i take the code from the financial hacker blog an train and test it I can confirm, that I get the same result as you posted in your screenshot.

But when I modify that script and add the while(asset(loop("EUR/USD"))) construct, train and test I get a different result! This behavior is reproducible:

This code
Code:
var objective()
{
	return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}


function run()
{
	BarPeriod = 5;
	LookBack = 100;
	NumWFOCycles = 20;
	NumCores = -1;
	
	set(BINARY);
	WinPayout = 75;
	LossPayout = 0;

	set(PARAMETERS);
	int TimePeriod = optimize(20,10,100);
	var Threshold = 0.01*(HH(TimePeriod)-LL(TimePeriod));

	while (asset(loop("EUR/USD")))
	{
		if(NumOpenLong+NumOpenShort == 0) 
		{
			LifeTime = 1;
			if(HH(TimePeriod) - priceClose() < Threshold)
				enterShort();
			else if(priceClose() - LL(TimePeriod) < Threshold)
				enterLong();
		}
	}
}



gives this result:

Code:
Walk-Forward Test: Test8 EUR/USD 2011..2016
[...]
Profit -5$  MI -0$  DD 16$  Capital 23$
Trades 493  Win 56.6%  Avg -0.1p  Bars 1
AR -5%  PF 0.98  SR -0.10  UI 74%  R2 0.00





When i now add the line assetList("AssetsFix.csv"); to the script and test again without training i get this code:

Code:
var objective()
{
	return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}


function run()
{
	assetList("AssetsFix.csv");
	
	BarPeriod = 5;
	LookBack = 100;
	NumWFOCycles = 20;
	NumCores = -1;
	
	set(BINARY);
	WinPayout = 75;
	LossPayout = 0;

	set(PARAMETERS);
	int TimePeriod = optimize(20,10,100);
	var Threshold = 0.01*(HH(TimePeriod)-LL(TimePeriod));

	while (asset(loop("EUR/USD")))
	{
		if(NumOpenLong+NumOpenShort == 0) 
		{
			LifeTime = 1;
			if(HH(TimePeriod) - priceClose() < Threshold)
				enterShort();
			else if(priceClose() - LL(TimePeriod) < Threshold)
				enterLong();
		}
	}
}



With the following result:

Code:
Walk-Forward Test: Test8 EUR/USD 2011..2016
Account AssetsFix.csv 
[...]
Profit -103$  MI -2$  DD 104$  Capital 96$
Trades 493  Win 45.2%  Avg -2.4p  Bars 1
AR -24%  PF 0.62  SR -2.10  UI 100%  R2 0.87






I have described the steps to reproduce this behavior in detail. You should be able to copy the exact above code and reproduce it yourself.

Zorro is freshly installed and the history comes directly from the Zorro homepage so that can't be the issue here.

Last edited by trenki2; 10/31/16 17:06.
Re: Binary Options Bugs [Re: trenki2] #462896
11/03/16 16:35
11/03/16 16:35
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Can someone test this and report their results?

Re: Binary Options Bugs [Re: trenki2] #462902
11/03/16 18:37
11/03/16 18:37
Joined: May 2016
Posts: 180
Prague
pcz Offline
Member
pcz  Offline
Member

Joined: May 2016
Posts: 180
Prague
Originally Posted By: trenki2
Can someone test this and report their results?


Just tried it very quicky and I get similar results to yours.

Re: Binary Options Bugs [Re: pcz] #462908
11/04/16 10:07
11/04/16 10:07
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Reinstalling Zorro normally won't help when something does not work. When you get different results, compare the logs. Then you'll normally quickly see the reason.

I suspect several reasons. First, you did not train the system. Since a portfolio strategy has different parameter files than a single-asset strategy, you must train it again when you made such a modification. Second, you did not trade with payout. The "AssetsFix" file is set up for normal trading with spread and commmission, so you must alter asset parameters for binary trading when you explicitly load it. And select the asset before modifying them, like this:

while (asset(loop("EUR/USD")))
{
...
WinPayout = 75;
LossPayout = 0;
Spread = Commission = 0;
...

I don't know if this is the whole problem, but anyway if this does not help, please post again and I'll look into it.

Re: Binary Options Bugs [Re: jcl] #462910
11/04/16 11:46
11/04/16 11:46
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Hi jcl,

I actually did train the system and got the results that i posted. I did exactly as I described above.

I now also tried to move the WinPayout and LossPayout variabeles inside the while loop as that makes sense but I still get the same result as in my previous post:


This code:
Code:
var objective()
{
	return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}


function run()
{
	//assetList("AssetsFix.csv");
	
	BarPeriod = 5;
	LookBack = 100;
	NumWFOCycles = 20;
	NumCores = -1;
	
	set(BINARY);
	set(PARAMETERS);
	int TimePeriod = optimize(20,10,100);
	var Threshold = 0.01*(HH(TimePeriod)-LL(TimePeriod));

	while (asset(loop("EUR/USD")))
	{
		WinPayout = 75;
		LossPayout = 0;
		
		if(NumOpenLong+NumOpenShort == 0) 
		{
			LifeTime = 1;
			if(HH(TimePeriod) - priceClose() < Threshold)
				enterShort();
			else if(priceClose() - LL(TimePeriod) < Threshold)
				enterLong();
		}
	}
}



Gives this result:
Code:
Walk-Forward Test: Binary EUR/USD 2011..2016
Profit -5$  MI -0$  DD 16$  Capital 23$
Trades 493  Win 56.6%  Avg -0.1p  Bars 1
AR -5%  PF 0.98  SR -0.10  UI 74%  R2 0.00



And there is still the weird issue when I uncomment and test with the assetList line, that the results become different again.

I then get these results:

Code:
Walk-Forward Test: Binary EUR/USD 2011..2016
Account AssetsFix.csv 
Profit -103$  MI -2$  DD 104$  Capital 96$
Trades 493  Win 45.2%  Avg -2.4p  Bars 1
AR -24%  PF 0.62  SR -2.10  UI 100%  R2 0.87


Re: Binary Options Bugs [Re: trenki2] #462911
11/04/16 11:49
11/04/16 11:49
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, I've just tried it, but found no problem after training it separately. I get always the equity curve that I posted above. But when explicitely loading "AssetFix" you must also set the spread and commission to zero:

Spread = Commission = 0;

Otherwise you're trading with the default spread and commission from "AssetsFix".

Re: Binary Options Bugs [Re: jcl] #462913
11/04/16 12:32
11/04/16 12:32
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
I have tested it on two different computers and get the same results. pcz was also getting similar results to me.

What are you doing differently?

I can copy paste the above code into a new script, hit the train button and then the test button and get my wrong results.

I can even make you a screen capture video showing it if you really want.

Re: Binary Options Bugs [Re: trenki2] #462915
11/04/16 14:56
11/04/16 14:56
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Testing on different computers will not help either - if something doesn't work, switching the computer won't fix it. So let's find out systematically what's different between your test and mine. First, compare the logs between the working and the not working version. Which differences do they have?

Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1