I'm pretty new to this coding game (being saying that for a while now!), and am having problems getting a binary options strategy to work using the MT4 bridge. Trading on a
demo account (not live yet), to experiment I used the example from
Binary Options: Scam or Opportunity , and modified the code as follows:
///////////////////////////////////////////////////////
// Binary trading system //////////////////////////////
///////////////////////////////////////////////////////
var objective()
{
return ((var)(NumWinLong+NumWinShort))/(NumLossLong+NumLossShort);
}
function run()
{
set(PARAMETERS|LOGFILE);
BarPeriod = 5;
LookBack = 100;
NumWFOCycles = 20;
NumCores = -2;
PlotHeight1 = 340;
PlotWidth = 800;
set(BINARY);
WinPayout = 80;
LossPayout = 0;
//
//set up trades
//
LifeTime = 1;
int Size = 5; //order size in $
int TimePeriod = optimize(45,10,100);
var Threshold = 0.1*(HH(TimePeriod)-LL(TimePeriod));
if(NumOpenLong+NumOpenShort == 0)
{
if((HH(TimePeriod) - priceClose()) < Threshold)
{
//enterShort();
brokerCommand(SET_ORDERTEXT,"BO exp:300");
enterShort(Size);
}
if((priceClose() - LL(TimePeriod)) < Threshold)
{
//enterLong();
brokerCommand(SET_ORDERTEXT,"BO exp:300");
enterLong(Size);
}
}
}
The strategy Trains, and Tests fine, but when Trading the system, it connects but hangs (infinite loop) after the "loading prices..." line, with the log as follows:
Binary_Q
Login MT4...
!Go Markets Pty Ltd connected
!MT4 time zone shift -3 at UTC 09.09. 07:50
Loading EUR/JPY prices.. 300 min, 500 bars added
I'm trading with Go Markets, and broker's symbol is "EURJPY.bo" in this case. Can anyone help?