I would like to change my EA to use for Binary Options strategy testing - running back test to see if it achieve 56% or more - maybe even optimize strategy until the desitred results are achieved.
The
idea seemed simple - Open a trade on a new candle and close on a new
candle - this way you could test the ea for 1 minute, 5 minute, 30 minute
and even on 1 hour timeframes.
I tried different things but I am not a programmer :(
Currently I am looking at 1800 seconds (30 minutes) to pass - then the trade should close - a trade just opens and never closes :(
When I open a trade I capture the time:
TimeTradeOpened = OrderOpenTime();
I want to close the trade after xamount of trades has passed:
if(TimeCurrent() - TimeTradeOpened >= 1800){BuyOrder=SIGNAL_CLOSEBUY;} //Close trade after 30 minutes
I would love to use candle open and close - I have copied (stolen) this code from an EA but I am too stupid to adapt the code to my EA:(
//+------------------------------------------------------------------+ //Function: Check if it is a new candle //+------------------------------------------------------------------+ bool isNewCandle() { bool res=false; if (myBars!=Bars) { myBars=Bars; res=true; }
return(res);
}
if(isNewCandle()) { signal=signal(); }
Maybe one of you guys could investigate and correct my code or show me a better (plain) code to use? Please?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I would like to change my EA to use for Binary Options strategy testing - running back test to see if it achieve 56% or more - maybe even optimize strategy until the desitred results are achieved.
The idea seemed simple - Open a trade on a new candle and close on a new candle - this way you could test the ea for 1 minute, 5 minute, 30 minute and even on 1 hour timeframes.
I tried different things but I am not a programmer :(
Currently I am looking at 1800 seconds (30 minutes) to pass - then the trade should close - a trade just opens and never closes :(
When I open a trade I capture the time:
TimeTradeOpened = OrderOpenTime();
I want to close the trade after xamount of trades has passed:
if(TimeCurrent() - TimeTradeOpened >= 1800){BuyOrder=SIGNAL_CLOSEBUY;} //Close trade after 30 minutes
I would love to use candle open and close - I have copied (stolen) this code from an EA but I am too stupid to adapt the code to my EA:(
//+------------------------------------------------------------------+
//Function: Check if it is a new candle
//+------------------------------------------------------------------+
bool isNewCandle()
{
bool res=false;
if (myBars!=Bars)
{
myBars=Bars;
res=true;
}
return(res);
}
if(isNewCandle())
{
signal=signal();
}
Maybe one of you guys could investigate and correct my code or show me a better (plain) code to use? Please?
See attached