← Назад к списку файлов

multik.mq5

Поиск по коду файла

#property version   "1.04"

input string            Symb0 = "EURUSD";
input  bool            Trade0 = true;
input int                Per0 = 50;
input ENUM_APPLIED_PRICE ApPrice0 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod0    = MODE_SMA;
input int             StLoss0 = 0;
input int           TkProfit0 = 0;
input double            Lots0 = 1;
input int           Slippage0 = 30;

input string            Symb1 = "USDCHF";
input  bool            Trade1 = false;
input int                Per1 = 100;
input ENUM_APPLIED_PRICE ApPrice1 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod1    = MODE_SMA;
input int             StLoss1 = 0;
input int           TkProfit1 = 0;
input double            Lots1 = 0.1;
input int           Slippage1 = 30;

input string            Symb2 = "USDJPY";
input  bool            Trade2 = false;
input int                Per2 = 100;
input ENUM_APPLIED_PRICE ApPrice2 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod2    = MODE_SMA;
input int             StLoss2 = 0;
input int           TkProfit2 = 0;
input double            Lots2 = 0.1;
input int           Slippage2 = 30;

input string            Symb3 = "USDCAD";
input  bool            Trade3 = false;
input int                Per3 = 100;
input ENUM_APPLIED_PRICE ApPrice3 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod3    = MODE_SMA;
input int             StLoss3 = 0;
input int           TkProfit3 = 0;
input double            Lots3 = 0.1;
input int           Slippage3 = 30;

input string            Symb4 = "AUDUSD";
input  bool            Trade4 = false;
input int                Per4 = 100;
input ENUM_APPLIED_PRICE ApPrice4 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod4    = MODE_SMA;
input int             StLoss4 = 0;
input int           TkProfit4 = 0;
input double            Lots4 = 0.1;
input int           Slippage4 = 30;

input string            Symb5 = "EURGBP";
input  bool            Trade5 = false;
input int                Per5 = 100;
input ENUM_APPLIED_PRICE ApPrice5 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod5    = MODE_SMA;
input int             StLoss5 = 0;
input int           TkProfit5 = 0;
input double            Lots5 = 0.1;
input int           Slippage5 = 30;

input string            Symb6 = "EURAUD";
input  bool            Trade6 = false;
input int                Per6 = 100;
input ENUM_APPLIED_PRICE ApPrice6 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod6    = MODE_SMA;
input int             StLoss6 = 0;
input int           TkProfit6 = 0;
input double            Lots6 = 0.1;
input int           Slippage6 = 30;

input string            Symb7 = "EURCHF";
input  bool            Trade7 = false;
input int                Per7 = 100;
input ENUM_APPLIED_PRICE ApPrice7 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod7    = MODE_SMA;
input int             StLoss7 = 0;
input int           TkProfit7 = 0;
input double            Lots7 = 0.1;
input int           Slippage7 = 30;

input string            Symb8 = "GBPCHF";
input  bool            Trade8 = false;
input int                Per8 = 100;
input ENUM_APPLIED_PRICE ApPrice8 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod8    = MODE_SMA;
input int             StLoss8 = 0;
input int           TkProfit8 = 0;
input double            Lots8 = 0.1;
input int           Slippage8 = 30;

input string            Symb9 = "GBPUSD";
input  bool            Trade9 = true;
input int                Per9 = 50;
input ENUM_APPLIED_PRICE ApPrice9 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod9    = MODE_SMA;
input int             StLoss9 = 0;
input int           TkProfit9 = 0;
input double            Lots9 = 1;
input int           Slippage9 = 30;

input string            Symb10 = "GBPJPY";
input  bool            Trade10 = false;
input int                Per10 = 100;
input ENUM_APPLIED_PRICE ApPrice10 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod10    = MODE_SMA;
input int             StLoss10 = 0;
input int           TkProfit10 = 0;
input double            Lots10 = 0.1;
input int           Slippage10 = 30;

input string            Symb11 = "EURJPY";
input  bool            Trade11 = false;
input int                Per11 = 100;
input ENUM_APPLIED_PRICE ApPrice11 = PRICE_CLOSE;
input ENUM_MA_METHOD MaMethod11    = MODE_SMA;
input int             StLoss11 = 0;
input int           TkProfit11 = 0;
input double            Lots11 = 0.1;
input int           Slippage11 = 30;

bool TradeSignalCounter(int Number,
                        string Symbol_,
                        bool Trade,
                        int period,
                        ENUM_APPLIED_PRICE ApPrice,
                        ENUM_MA_METHOD MaMethod,
                        bool &UpSignal[],
                        bool &DnSignal[],
                        bool &UpStop[],
                        bool &DnStop[])
  {

   if(!Trade)return(true);

   static int Size_=0;

   static int Handle[];

   static int Recount[],MinBars[];
   double SMA[4],dsma1,dsma2;

   if(Number+1>Size_) // ???? ? ???? ????????????? ?????? ?? ?????? ??????
     {
      Size_=Number+1; // ??? ????? ?????? ???? ? ???? ??????

      ArrayResize(Handle,Size_);
      ArrayResize(Recount,Size_);
      ArrayResize(MinBars,Size_);

      ArrayInitialize(Handle,0);
      ArrayInitialize(Recount,0);
      ArrayInitialize(MinBars,0);

      MinBars[Number]=3*period;

      DnSignal[Number] = false;
      UpSignal[Number] = false;
      DnStop  [Number] = false;
      UpStop  [Number] = false;

      ArraySetAsSeries(SMA,true);

      Handle[Number]=iMA(Symbol_,0,period,0,MODE_SMA,ApPrice);
     }

   if(Bars(Symbol_,0)<MinBars[Number])return(true);

   if(IsNewBar(Number,Symbol_,0) || Recount[Number]) // ???? ? ???? ?? ????? ???? ??? ??? ????????? ??????????? ??????
     {
      DnSignal[Number] = false;
      UpSignal[Number] = false;
      DnStop  [Number] = false;
      UpStop  [Number] = false;

      if(CopyBuffer(Handle[Number],0,0,4,SMA)<0)
        {
         Recount[Number]=true; // ??? ??? ?????? ?? ????????, ?? ??????? ????????? 

         return(false); // ??????? ?? ??????? TradeSignalCounter() ??? ????????? ???????? ????????
        }

      Recount[Number]=false; // ????? ?? ???????????? ? ???? ???? ?? ????????? ????? ????

      dsma2 = NormalizeDouble(SMA[2] - SMA[3], _Digits);      // MA ?? ??????? 2-3
      dsma1 = NormalizeDouble(SMA[1] - SMA[2], _Digits);      // MA ?? ??????? 1-2

      if(dsma2 > 0 && dsma1 > 0) DnSignal[Number] = true;    // ??????? ???? MA ?? ??????? 1-2 ? 2-3 ???????
      if(dsma2 < 0 && dsma1 < 0) UpSignal[Number] = true;    // ???????? ???? MA ?? ??????? 1-2 ? 2-3 ??????

      if(dsma1 < 0) DnStop[Number] = true;                   // ????? ???? ???? MA ?? ??????? 1-2 ??????
      if(dsma1 > 0) UpStop[Number] = true;                   // ????? ???? ???? MA ?? ??????? 1-2 ???????
     }

   return(true);
  }

bool TradePerformer(int    Number,
                    string Symbol_,
                    bool   Trade,
                    int    StLoss,
                    int    TkProfit,
                    double Lots,
                    int    Slippage,
                    bool  &UpSignal[],
                    bool  &DnSignal[],
                    bool  &UpStop[],
                    bool  &DnStop[])
  {

   if(!Trade)return(true);

   if(UpStop[Number])BuyPositionClose(Symbol_,Slippage);
   if(DnStop[Number])SellPositionClose(Symbol_,Slippage);

   if(UpSignal[Number])
      if(BuyPositionOpen(Symbol_,Slippage,Lots,StLoss,TkProfit))
         UpSignal[Number]=false; //?? ???? ???? ?????? ????? ????????? ??????? ?? ?????!

   if(DnSignal[Number])
      if(SellPositionOpen(Symbol_,Slippage,Lots,StLoss,TkProfit))
         DnSignal[Number]=false; //?? ???? ???? ?????? ????? ????????? ??????? ?? ?????!

   return(true);
  }

bool BuyPositionOpen(const string symbol,
                     ulong deviation,
                     double volume,
                     int StopLoss,
                     int Takeprofit)
  {

   MqlTradeRequest request;
   MqlTradeResult result;
   ZeroMemory(request);
   ZeroMemory(result);

   if(!PositionSelect(symbol))
     {

      request.type   = ORDER_TYPE_BUY;
      request.price  = SymbolInfoDouble(symbol, SYMBOL_ASK);
      request.action = TRADE_ACTION_DEAL;
      request.symbol = symbol;
      request.volume = Money_M();
      request.sl = 0;
      request.tp = 0;
      request.deviation=(deviation==ULONG_MAX) ? deviation : deviation;
      request.type_filling=ORDER_FILLING_FOK;

      string word="";
      StringConcatenate(word,
                        "<<< ============ BuyPositionOpen():   ????????? Buy ??????? ?? ",
                        symbol," ============ >>>");
      Print(word);

      if(!OrderSend(request,result) || result.deal==0)
        {
         Print(ResultRetcodeDescription(result.retcode));
         return(false);
        }
     }

   return(true);
  }

bool SellPositionOpen(const string symbol,
                      ulong deviation,
                      double volume,
                      int StopLoss,
                      int Takeprofit)
  {

   MqlTradeRequest request;
   MqlTradeResult result;
   ZeroMemory(request);
   ZeroMemory(result);

   if(!PositionSelect(symbol))
     {

      request.type   = ORDER_TYPE_SELL;
      request.price  = SymbolInfoDouble(symbol, SYMBOL_BID);
      request.action = TRADE_ACTION_DEAL;
      request.symbol = symbol;
      request.volume = Money_M();
      request.sl = 0;
      request.tp

Показано первые 50% кода (символов: 13439)

Как получить полную версию?

Введите ваш email и нажмите кнопку, чтобы перейти к оплате.