Download MetaTrader 5
To add comments, please log in or register
MQL5 library has more than 1500 apps already. Contribute your own one!
pascalboy
238
pascalboy 2014.04.18 14:50 
extern bool macdzirve,macddip,RSIzirve,RSIdip,CCIzirve,CCIdip;

int start()
{
double macd=iMACD(Symbol(),0,12,26,9,0,0,0)*10000;
double RSI=iRSI(Symbol(),0,14,0,0);
double CCI=iCCI(Symbol(),0,100,0,0);

if(macd>20)
{
macdzirve=1;
macddip=0;
}

if(macd<-20)
{
macdzirve=0;
macddip=1;
}

if(RSI>60)
{
RSIzirve=1;
RSIdip=0;
}

if(RSI<40)
{
RSIzirve=0;
RSIdip=1;
}

if(CCI>170)
{
CCIzirve=1;
CCIdip=0;
}

if(CCI<-170)
{
CCIdip=1;
CCIzirve=0;
}

double ZIRVEPUANI,DIPPUANI;


ZIRVEPUANI=macdzirve+CCIzirve+RSIzirve;
DIPPUANI =macddip+CCIdip+RSIdip;



if(OrdersTotal()==0&&DIPPUANI>=2)
{
int ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,0,0,0);
}

if(OrdersTotal()==0&&ZIRVEPUANI>=2)
{
ticket=OrderSend(Symbol(),OP_SELL,1,Bid,3,0,0,0,0,0);
}





for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{


ticket=OrderTicket();
int type=OrderType();

}
}

















if(type==OP_BUY&&OrdersTotal()>=1&&ZIRVEPUANI>=2)
{

OrderClose(ticket,1,Bid,3,0);

}

if(type==OP_SELL&&OrdersTotal()>=1&&DIPPUANI>=2)
{

OrderClose(ticket,1,Ask,3,0);

}

ZIRVEPUANI=0;
DIPPUANI=0;
macddip=0;
macdzirve=0;
RSIdip=0;
RSIzirve=0;
CCIdip=0;
CCIzirve=0;

return;
}

Hello again,

it always closes orders,

at spread levels.

Why?

/
To add comments, please log in or register