Download MetaTrader 5
To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
Forex-ID10T
23
Forex-ID10T 2014.08.17 01:20 

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
Files:
Alain Verleyen
Moderator
30635
Alain Verleyen 2014.08.17 12:02  
/
To add comments, please log in or register