I basically have posted the script already above but here it is again:

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


function run()
{
	set(LOGFILE);
	
	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;
		//Spread = 0;
		
		if(NumOpenLong+NumOpenShort == 0) 
		{
			LifeTime = 1;
			if(HH(TimePeriod) - priceClose() < Threshold)
				enterShort();
			else if(priceClose() - LL(TimePeriod) < Threshold)
				enterLong();
		}
	}
}



You can also uncomment the line with the Spread = 0 but the result is the same:

Code:
Walk-Forward Test: BinaryBug 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