¹«Ê½Ö¸±êƽ̨ ¹ÉƱָ±ê¹«Ê½Ô´Âë·ÖÏí µÇ¼ ×¢²á
¹«Ê½Ö¸±êƽ̨
δÀ´º¯Êý¼ì²â
Ê× Ò³ ½ð×êÖ¸±ê ͨ´ïÐŹ«Ê½ ´óÖǻ۹«Ê½ ͬ»¨Ë³¹«Ê½ ÎÄ»ª²Æ¾­¹«Ê½ ²ÙÅÌÊÖ¹«Ê½ ¶«²Æͨ¹«Ê½ ·Éºü¹«Ê½ ÆäËû¹«Ê½ ¹«Ê½½â´ð ¹ÉƱÈí¼þ ¹ÉƱ³Ø
µ±Ç°Î»Ö㺡ú ¹«Ê½Ö¸±êƽ̨ > ÆäËû¹«Ê½ > MT4¹«Ê½ > ÕýÎÄ ¡ú ÕýÎÄ

MT4¹«Ê½exp_Amstell-SL Ö¸±êÔ´Âë

·¢²¼Ê±¼ä£º2015/10/22 19:19:26  ä¯ÀÀ´ÎÊý£º

//+------------------------------------------------------------------+
 //|                                                  exp_Amstell.mq4 |
 //|                                   Copyright � 2009, Yuriy Tokman |
 //|                                            www.gszb.com |
 //+------------------------------------------------------------------+
 #property copyright "Copyright � 2009, Yuriy Tokman"
 #property link      ""


 extern int    TakeProfit       = 30;           
 extern int    StopLoss         = 30;         
 extern double Lots             = 0.01;    
 //+------------------------------------------------------------------+
 //| expert initialization function                                   |
 //+------------------------------------------------------------------+
 int init()
   {
 //----
   
 //----
    return(0);
   }
 //+------------------------------------------------------------------+
 //| expert deinitialization function                                 |
 //+------------------------------------------------------------------+
 int deinit()
   {
 //----
   
 //----
    return(0);
   }
 //+------------------------------------------------------------------+
 //| expert start function                                            |
 //+------------------------------------------------------------------+
 int start()
   {
   int Magic=0;
  
 for(int cnt=0;cnt<OrdersTotal();cnt++)// Ïåðåáèðàåì âñ� îðäåðà
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);//îðäå� âûáèðàåò�ÿ ñðåä� îòêðûòûõ � îòëîæåííûõ îðäåðî�
      if( OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)// Ñîâïàäàå� ëè ñèìâîë îðäåðà( Çäåñ� ïî íàäîáíîñòè åù� ìàãè� ìîæí� ïðîâåðèò�)
         {
          if(OrderType()==OP_BUY)//Îòáèðàåì ïîçèöè� áà�
           {
             if(Bid-OrderOpenPrice()>TakeProfit*Point || OrderOpenPrice()-Ask>StopLoss*Point)//
               {
                OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); //çàêðûâàå� îðäå�
               return(0); // âûõîäè�
              }//StopLoss
            }
           if(OrderType()==OP_SELL)//Îòáèðàåì ïîçèöè� ñåëë
           {
             if(OrderOpenPrice()-Ask>TakeProfit*Point || Bid-OrderOpenPrice()>StopLoss*Point)//
               {
                OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); //çàêðûâàå� îðäå�
               return(0); // âûõîäè�
              }
            }
          }
       }
 //----
 int buy = 0, sell = 0;
 //----
    if(!ExistPositions(NULL,OP_BUY))buy=1;
    else if(PriceOpenLastPos(NULL,OP_BUY)-Ask>10*Point)buy=1;
   
    if(!ExistPositions(NULL,OP_SELL))sell=1;
    else if(Bid-PriceOpenLastPos(NULL,OP_SELL)>10*Point)sell=1;  
 //----
     if(buy==1)
     OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"",0,0,Green);
    
     if(sell==1)
     OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"",0,0,Red);
 //----
    return(0);
   }
 bool ExistPositions(string sy="", int op=-1, int mn=-1, datetime ot=0) {
   int i, k=OrdersTotal();

  if (sy=="0") sy=Symbol();
   for (i=0; i<k; i++) {
     if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
       if (OrderSymbol()==sy || sy=="") {
         if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
           if (op<0 || OrderType()==op) {
             if (mn<0 || OrderMagicNumber()==mn) {
               if (ot<=OrderOpenTime()) return(True);
             }
           }
         }
       }
     }
   }
   return(False);
 }
 double PriceOpenLastPos(string sy="", int op=-1, int mn=-1) {
   datetime t;
   double   r=0;
   int      i, k=OrdersTotal();

  if (sy=="0") sy=Symbol();
   for (i=0; i<k; i++) {
     if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
       if (OrderSymbol()==sy || sy=="") {
         if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
           if (op<0 || OrderType()==op) {
             if (mn<0 || OrderMagicNumber()==mn) {
               if (t<OrderOpenTime()) {
                 t=OrderOpenTime();
                 r=OrderOpenPrice();
               }
             }
           }
         }
       }
     }
   }
   return(r);
 }

 


MT4¹«Ê½exp_Amstell-SL Ö¸±êÔ´Âë

×ÊÔ´ÏÂÔØÁ´½Ó   ×ÊÔ´´óС£ºunknow

ÊÖ»úÒƶ¯°æ - ¹ØÓÚÎÒÃÇ - ÁªÏµÎÒÃÇ - ¹ã¸æºÏ×÷ - ÏÂÔØÉùÃ÷ - ÍøÕ¾°ïÖú - ÓÑÇéÁ´½Ó - ÍøÕ¾µØͼ - TOP
ÏæICP±¸09016573ºÅ ÔöÖµµçÐÅÒµÎñ¾­ÓªICPÐí¿ÉÖ¤£ºÏæB2-20210269 Ï湫Íø°²±¸43108102000039ºÅ
Copyright © GSZB.COM ,All Rights Reserved.
¹ÉƱ¹«Ê½,¹ÉƱָ±ê,¹ÉƱÈí¼þ,¹ÉƱ֪ʶ