ตามนี้เลย
//+------------------------------------------------------------------+
//| ea.mq4 |
//| Copyright ฉ 2010, MetaQuotes Software Corp.- ea |
//| http://www.candylink.tk/ea/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ฉ 2010, MetaQuotes Software Corp.- ea"
#property link "http://www.candylink.tk/ea/"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double sar ,rsi13 ,ma6 ,macdmain ,macdsignal;
int total; //
int ticket; //
int order1;
sar=iSAR(NULL,0,0.02,0.2,0);
rsi13=iRSI(NULL,0,13,PRICE_CLOSE,0);
ma6=iMA(NULL,0,6,8,MODE_SMMA,PRICE_MEDIAN,0);
macdmain=iMACD(NULL,0,12,26,6,PRICE_CLOSE,MODE_MAIN,0);
macdsignal=iMACD(NULL,0,12,26,6,PRICE_CLOSE,MODE_SIGNAL,0);
total=OrdersTotal();
if(total<1)
{
if(Ask>ma6)
{
if(rsi13>50){
if(Ask>sar){
if(macdmain>macdsignal){
ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-Point*500,Ask+Point*10,"firstea",0,0,Green);
order1=OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
}
}
}
}
if(total>1){
if(Bid<ma6){
OrderClose(OrderTicket(),OrderLots(),Bid,3,Green);
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
คือผม ต้องการให้ เมื่อเส้น MA6 มากกว่า ราคา bid ให้ปิด order เลย
(ea ตัวนี้ เปิด Buy อย่างเดียว นะครับ)
เพิ่งหัดเขียน นะครับ