พอดีหัดทำ ea พอtestออกมาเทรดฝั่ง buy ทางเดียวครับแก้ยังไงดี
extern double Lots = 0.01;
extern int Slippage = 3;
extern int TP = 10;
extern int SL = 100;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int Total;
int Ticket;
double Buy1_1 = iMA(NULL,0, 5, 0, MODE_EMA,PRICE_CLOSE,0);
double Buy1_2 = iMA(NULL,0, 10, 0, MODE_EMA,PRICE_CLOSE,0);
double Buy2_1 = iMA(NULL,0, 10, 0, MODE_EMA,PRICE_CLOSE,0);
double Buy2_2 = iMA(NULL,0, 20, 0, MODE_SMA,PRICE_CLOSE,0);
double Buy3_1 = iRSI(NULL,0, 14, PRICE_CLOSE,0);
double Buy3_2 = 50;
double Buy4_1 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_PLUSDI,0);
double Buy4_2 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_MINUSDI,0);
double Buy5_1 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_MAIN,0);
double Buy5_2 = 25;
double Sell1_1 = iMA(NULL,0, 5, 0, MODE_EMA,PRICE_CLOSE,0);
double Sell1_2 = iMA(NULL,0, 10, 0, MODE_EMA,PRICE_CLOSE,0);
double Sell2_1 = iMA(NULL,0, 10, 0, MODE_EMA,PRICE_CLOSE,0);
double Sell2_2 = iMA(NULL,0, 20, 0, MODE_SMA,PRICE_CLOSE,0);
double Sell3_1 = iRSI(NULL,0, 14, PRICE_CLOSE,0);
double Sell3_2 = 50;
double Sell4_1 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_PLUSDI,0);
double Sell4_2 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_MINUSDI,0);
double Sell5_1 = iADX(NULL,0, 14, PRICE_CLOSE,MODE_MAIN,0);
double Sell5_2 = 25;
//----
Total=OrdersTotal();
if(Total<1)
{
if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2)
{
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask,Slippage,Bid-Point*SL,Ask+Point*TP,"firstea",0,0,Green);
OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES);
}
if (Sell1_1 < Sell1_2 && Sell2_1 < Sell2_2 && Sell3_1 < Sell3_2 && Sell4_1 < Sell4_2 && Sell5_1 > Sell5_2)
{
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid,Slippage,Ask-Point*SL,Bid+Point*TP,"firstea",0,0,Red);
OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+