Hi Buckscoder,
thanks for the code. How can I place it into my EA?
Please help again.
Kind regards,
jimbofx7
//±-----------------------------------------------------------------+
//| OpenHedge EA.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| MetaTrader 4 Trading Platform / MetaQuotes Software Corp. |
//±-----------------------------------------------------------------+
#property copyright “Copyright © 2010, MetaQuotes Software Corp.”
#property link “http://www.metaquotes.net”
extern int Slippage=5;
extern int MagicNumber_1=1000;
extern int MagicNumber_2=2000;
double dXPoint=1;
//±-----------------------------------------------------------------+
//| expert initialization function |
//±-----------------------------------------------------------------+
int init()
{
if(Digits==3 || Digits==5)
{
dXPoint=10;
}
if(Digits==3 || Digits==5)
{
dXPoint=10;
int SLIPPAGE=SLIPPAGE*dXPoint;
}
return(0);
}
//±-----------------------------------------------------------------+
//| expert deinitialization function |
//±-----------------------------------------------------------------+
int deinit()
{
return(0);
}
//±-----------------------------------------------------------------+
//| expert start function |
//±-----------------------------------------------------------------+
int start()
{
if(iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,0)<iMA(NULL,0,20,8,MODE_SMMA,PRICE_MEDIAN,0))
{
OrderSend("EURUSD",OP_BUY,1,MarketInfo("EURUSD",MODE_ASK),2,NULL,NULL,"Magic Number 1000",MagicNumber_1,0,CLR_NONE);
Sleep(1000);
OrderSend("USDCHF",OP_BUY,1,MarketInfo("USDCHF",MODE_ASK),2,NULL,NULL,"Magic Number 1000",MagicNumber_1,0,CLR_NONE);
Sleep(1000);
OrderSend("EURUSD",OP_SELL,1,MarketInfo("EURUSD",MODE_BID),2,NULL,NULL,"Magic Number 2000",MagicNumber_2,0,CLR_NONE);
Sleep(1000);
OrderSend("USDCHF",OP_SELL,1,MarketInfo("USDCHF",MODE_BID),2,NULL,NULL,"Magic Number 2000",MagicNumber_2,0,CLR_NONE);
Sleep(1000);
//RefreshRates();
}
//------------- 2
if(iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,0)>iMA(NULL,0,20,8,MODE_SMMA,PRICE_MEDIAN,0))
{
OrderSend("EURUSD",OP_SELL,1,MarketInfo("EURUSD",MODE_BID),2,NULL,NULL,"Magic Number 1000",MagicNumber_1,0,CLR_NONE);
Sleep(1000);
OrderSend("USDCHF",OP_SELL,1,MarketInfo("USDCHF",MODE_BID),2,NULL,NULL,"Magic Number 1000",MagicNumber_1,0,CLR_NONE);
Sleep(1000);
OrderSend("EURUSD",OP_BUY,1,MarketInfo("EURUSD",MODE_ASK),2,NULL,NULL,"Magic Number 2000",MagicNumber_2,0,CLR_NONE);
Sleep(1000);
OrderSend("USDCHF",OP_BUY,1,MarketInfo("USDCHF",MODE_ASK),2,NULL,NULL,"Magic Number 2000",MagicNumber_2,0,CLR_NONE);
Sleep(1000);
}
return(0);
}
//±-----------------------------------------------------------------+