liuyun1aw5 发表于 2015-6-13 22:45:25

这是什么源码87662


这是什么东东?不懂啊!





//|                                                   穿均线交易.mq4 |

#property copyright "qiu"
#property link      "http://www.metaquotes.net"
extern double 幅度    =   10;
extern double 止盈    =   50;
extern double止损 = 50;
extern double 交易手数= 0.1;
extern int 均线周期= 34;
extern int buytisun = 200;//当多单盈利多少点后开启移动止损
extern int selltisun = 200; //当空单盈利多少点后开启移动止损
extern double 移动止损 = 0;
int init()
{
   return(0);
}
int deinit()
{
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                          |
//+------------------------------------------------------------------+
int start()
{
   double ma=iMA(NULL,0,均线周期,0,MODE_LWMA,PRICE_TYPICAL,0);
   double map=iMA(NULL,0,均线周期,0,MODE_LWMA,PRICE_TYPICAL,1);

   if(Close-10*Point>ma&&Open+10*Point<ma&&Close-Open>幅度*Point&&Open<map && Close<map)
      {
            if(buy(交易手数,止损,止盈,Symbol()+"buy",0)>0)       //buy
            // if(sell(交易手数,止损,止盈,Symbol()+"sell",0)>0)      //sell
               {
               selltisun=200;
               }

      }
if(Close+10*Point<ma&&Open-10*Point>ma&&Open-Close>幅度*Point&& Open>map && Close>map)
{

          if(sell(交易手数,止损,止盈,Symbol()+"sell",0)>0)      //sell
         //if(buy(交易手数,止损,止盈,Symbol()+"buy",0)>0)       //buy   
                {
                  buytisun=200;
                }

      }
for(int i=0;i<OrdersTotal();i++)
   {
       //if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
       if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         {
         if((OrderComment()==(Symbol()+"buy")))
         {
             if(((Bid-OrderOpenPrice())/Point)>=buytisun)
               {
               double buysl=OrderStopLoss();
                  if(OrderModify(OrderTicket(),OrderOpenPrice(),buysl+移动止损*Point,OrderTakeProfit(),0)==true)
                     {
                     buytisun=buytisun+移动止损;
                     }
               }
         }
          if((OrderComment()==(Symbol()+"sell")))
         {
             if(((OrderOpenPrice()-Ask)/Point)>=selltisun)
               {
               double sellsl=OrderStopLoss();
                  if(OrderModify(OrderTicket(),OrderOpenPrice(),sellsl-移动止损*Point,OrderTakeProfit(),0)==true)
                     {
                     selltisun=selltisun+移动止损;
                     }
               }
         }
         }
   }
   return(0);
   }
//+----------buy的函数封装-----------+
int buy(double lots, double sun,double ying,string comment,int magic)   
{

int kaiguan=0;
    for(int i=0;i<OrdersTotal();i++)
   {
       if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         {
         if((OrderComment()==comment)&&(OrderMagicNumber()==magic))
         {
             kaiguan=1;
         }
         }
   }   
   if(kaiguan==0)
   {
       int ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,300,0,0,comment,magic,0,Blue);
       if(ticket>0)
       {
         if(OrderSelect(ticket,SELECT_BY_TICKET)==true)
         {
             if((sun!=0)&&(ying!=0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-sun*MarketInfo(Symbol(),MODE_POINT),OrderOpenPrice()+ying*MarketInfo(Symbol(),MODE_POINT),0,Blue);
               }
             if((sun==0)&&(ying!=0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()+ying*MarketInfo(Symbol(),MODE_POINT),0,Blue);
               }
             if((sun!=0)&&(ying==0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-sun*MarketInfo(Symbol(),MODE_POINT),0,0,Blue);
               }

         }
       }
    return(ticket);   
   }
    else
    {
    return(0);
    }   
}   
//+-------sell的函数封装----------+   
int sell ( double lots, double sun,double ying,string comment,int magic)   
{

int kaiguan=0;
    for(int i=0;i<OrdersTotal();i++)
   {
       if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         {
         if((OrderComment()==comment)&&(OrderMagicNumber()==magic))
         {
             kaiguan=1;
         }
         }
   }   
   if(kaiguan==0)
   {
       int ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,300,0,0,comment,magic,0,Red);
       if(ticket>0)
       {
      if(OrderSelect(ticket,SELECT_BY_TICKET)==true)
      {
             if((sun!=0)&&(ying!=0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+sun*MarketInfo(Symbol(),MODE_POINT),OrderOpenPrice()-ying*MarketInfo(Symbol(),MODE_POINT),0,White);
               }
             if((sun==0)&&(ying!=0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()-ying*MarketInfo(Symbol(),MODE_POINT),0,White);
               }
             if((sun!=0)&&(ying==0))
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+sun*MarketInfo(Symbol(),MODE_POINT),0,0,White);
               }
         }
      }
    return(ticket);
   }
    else
    {
    return(0);
    }   
}   

//+------------------------------------------------------------------+

g3dfxpro 发表于 2015-6-13 23:23:39

EA阿

waihui小白 发表于 2018-9-7 17:12:46

学习了,谢谢分享、、、

阿里 发表于 2020-1-29 15:41:41

有竞争才有进步嘛

金钱汇集 发表于 2020-6-17 11:44:12

:lol不错

bax03suj 发表于 2020-6-20 11:38:58

难得一见的好帖

唐嬿丰 发表于 2020-7-5 21:56:44

学习了,不错

ZFCw 发表于 2020-11-9 10:00:40

支持下

sdfsdfsdfsd 发表于 2020-11-23 19:04:18

{:1_179:}

FAfv2jwq 发表于 2020-11-25 20:31:45

顶下
页: [1] 2
查看完整版本: 这是什么源码87662