|
Hi
I have now solved this problem. I could compile the EA and tried to backtest it. But unfortunately it does not buy or sell anything !
Apart from this it seems to work, this is the journal:
14:16:18 EL1 inputs: Lots=0.1; Timeframe=240;
14:16:18 ELine GBPUSD,H4: removed
14:16:18 2005.11.14 00:00 ELine GBPUSD,H4: loaded successfully
And this is the EA Code:
//+------------------------------------------------------------------+
//| T1.mq4
//|
//|
//+------------------------------------------------------------------+
extern double Lots = 0.1;
extern int Timeframe = 240;
string strDirCurrent="none";
string strDirPrevious="none";
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
// check for current direction
if(iCustom(NULL,Timeframe,"ELine",0,0)>iCustom(NUL L,Timeframe,"ELine",1,0))
strDirCurrent="long";
if(iCustom(NULL,Timeframe,"ELine",0,0)<iCustom(NUL L,Timeframe,"ELine",1,0))
strDirCurrent="short";
// compare to previous direction and open a position if there was a change
if(strDirCurrent=="long" && strDirPrevious=="short")
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,50,200,"EABuy Order",16384,0,Green);
if(strDirCurrent=="short" && strDirPrevious=="long")
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,50,200,"EASe llOrder",16384,0,Red);
strDirPrevious=strDirCurrent;
}
// the end.
Any help is very much welcome !!
Thanks
Eric
|