I have experimented with the binary options script from the financial hacker blog. Below is the code that I use:
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.