How to test EA for binary options on mt4 strategy tester on one of these brokers :CoreLiquidityMarkets or Grand capital
it is not possible. But you can backtest if use virtual orders.
Hi,
I had a method to back test my binary option EA by using an expiry time to close the order after a time I specified. I did this using Order = SIGNAL_CLOSEBUY or SIGNAL_CLOSESELL.
You have to set the backtest spread to 1 so not a true 0 spread you would get with BO but it can give you an idea.
So..
Input Variables
extern int expirytimelong = 15;
extern int expirytimeshort = 15;
Variables
int timedifflong = expirytimelong * 60; // 60 = 1 mins
int timediffshort = expirytimeshort * 60; // 60 = 1 mins
Closing the Orders
if (TimeCurrent() - OrderOpenTime() > timedifflong) Order = SIGNAL_CLOSEBUY;
Hope this helps :-)
GoodBo
Does anyone know how to test EA for binary options on mt4 strategy tester with one of these brokers CoreLiquidityMarkets or Grand capital ( they have binary options based on mt4) ?
Thank you in advance :)
Add this to code. Set on single pair and set tester_close=true
////////////////////////////////////////////////////////////
void OnTick()
{
...
//tester
if(tester_close) tester_close_f();
...
}
////////////////////////////////////////////////////////////
void tester_close_f()
{
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderMagicNumber()==Magic)
{
if(OrderSymbol()==Symbol())
{
if(TimeCurrent()>=OrderOpenTime()+expir_time*60)
{
bool ticket_ex=false;
for (int j_ex = 0;j_ex < 26; j_ex++)
{
while(IsTradeContextBusy()) Sleep(200);
RefreshRates();
if(OrderType()==OP_BUY ) ticket_ex=OrderClose(OrderTicket(),OrderLots(),Bid,0,clrYellow);
else
if(OrderType()==OP_SELL) ticket_ex=OrderClose(OrderTicket(),OrderLots(),Ask,0,clrYellow);
else
ticket_ex=true;
if(ticket_ex==true)break;
}
}//time to close
}
}
}
}
}
it is not possible. But you can backtest if use virtual orders.
Your code is useless. have not resutl of trategy.
below is result if use virtual order and write to file.
It is a pity that you code programms to people.
Add this to code. Set on single pair and set tester_close=true
////////////////////////////////////////////////////////////
void OnTick()
{
...
//tester
if(tester_close) tester_close_f();
...
}
////////////////////////////////////////////////////////////
void tester_close_f()
{
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderMagicNumber()==Magic)
{
if(OrderSymbol()==Symbol())
{
if(TimeCurrent()>=OrderOpenTime()+expir_time*60)
{
bool ticket_ex=false;
for (int j_ex = 0;j_ex < 26; j_ex++)
{
while(IsTradeContextBusy()) Sleep(200);
RefreshRates();
if(OrderType()==OP_BUY ) ticket_ex=OrderClose(OrderTicket(),OrderLots(),Bid,0,clrYellow);
else
if(OrderType()==OP_SELL) ticket_ex=OrderClose(OrderTicket(),OrderLots(),Ask,0,clrYellow);
else
ticket_ex=true;
if(ticket_ex==true)break;
}
}//time to close
}
}
}
}
}
Your code is useless. have not resutl of trategy.
below is result if use virtual order and write to file.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Does anyone know how to test EA for binary options on mt4 strategy tester with one of these brokers CoreLiquidityMarkets or Grand capital ( they have binary options based on mt4) ?
Thank you in advance :)