新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 1538

 
你能告诉我如何取款吗?
 
昨天发出的请求,已经过去了24个多小时,没有任何消息。
 
ivlyeva.tatyana6:
我昨天发了一个请求,一天多过去了,没有动静。

1.去最近的自动取款机,插入卡,输入密码...

2.去最近的银行,进行眼神交流,然后按照情况...

3.去市场。3)去市场。到银行去。提取资金(你可以提取所有的资金,而不仅仅是你自己的资金......) ...

4.如果你必须从MMM取钱,那么即使是坦克也不会帮助你!如果你必须从MMM取钱,那么即使是坦克也不会帮助你。

而且说真的,你不能这样做!

 
//+------------------------------------------------------------------+
//|                                                  MACD Sample.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
input double TakeProfit    =3160;
input double Lots          =0.5;
input double TrailingStop  =1040;
input int OpenLevel =22;
input int CloseLevel=77;
input int    Period =85;
input int    Period1 =57;
int LastBars=0;
extern int Magic = 110725;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick(void)
  {
   
 
   int    cnt,ticket,total;
//---
// initial data checks
// it is important to make sure that the expert works with a normal
// chart and the user did not make any mistakes setting external 
// variables (Lots, StopLoss, TakeProfit, 
// TrailingStop) in our case, we check TakeProfit
// on a chart of less than 100 bars
//---
//--- Trade only if new bar has arrived
   if(LastBars!=Bars) LastBars=Bars;
   else return(0);
   if(Bars<100)
     {
      Print("bars less than 100");
      return;
     }
   if(TakeProfit<10)
     {
      Print("TakeProfit less than 10");
      return;
     }
//--- to simplify the coding and speed up access data are put into internal variables
   
   total=OrdersTotal();
   if(total<1)
     {
      //--- no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ",AccountFreeMargin());
         return;
        }
      //--- check for long position (BUY) possibility
     if(iRSI(NULL,0,OpenLevel,PRICE_LOW,Period)>iRSI(NULL,0,CloseLevel,PRICE_HIGH,Period1)) 
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-TakeProfit*Point,Bid+TakeProfit*Point,"USDCADH4",Magic,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
               Print("BUY order opened : ",OrderOpenPrice());
           }
         else
            Print("Error opening BUY order : ",GetLastError());
         return;
        }
      //--- check for short position (SELL) possibility
      if(iRSI(NULL,0,OpenLevel,PRICE_LOW,Period1)<iRSI(NULL,0,CloseLevel,PRICE_HIGH,Period)) 
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+TakeProfit*Point,Ask-TakeProfit*Point,"USDCADH4",Magic,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
               Print("SELL order opened : ",OrderOpenPrice());
           }
         else
            Print("Error opening SELL order : ",GetLastError());
        }
      //--- exit from the "no opened orders" block
      return;
     }
//--- it is important to enter the market correctly, but it is more important to exit it correctly...   
   for(cnt=0;cnt<total;cnt++)
     {
      if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         //--- long position is opened
         if(OrderType()==OP_BUY)
           {
            //--- should it be closed?
              if(iRSI(NULL,0,OpenLevel,PRICE_LOW,Period1)<iRSI(NULL,0,CloseLevel,PRICE_HIGH,Period)) 
              {
               //--- close order and exit
               if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet))
                  Print("OrderClose error ",GetLastError());
               return;
              }
            //--- check for trailing stop
            if(TrailingStop>0)
              {
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     //--- modify order and exit
                     if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green))
                        Print("OrderModify error ",GetLastError());
                     return;
                    }
                 }
              }
           }
         else // go to short position
           {
            //--- should it be closed?
           if(iRSI(NULL,0,OpenLevel,PRICE_LOW,Period)>iRSI(NULL,0,CloseLevel,PRICE_HIGH,Period1)) 
              {
               //--- close order and exit
               if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet))
                  Print("OrderClose error ",GetLastError());
               return;
              }
            //--- check for trailing stop
            if(TrailingStop>0)
              {
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     //--- modify order and exit
                     if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red))
                        Print("OrderModify error ",GetLastError());
                     return;
                    }
                 }
              }
           }
        }
     }
//---
  }
//+------------------------------------------------------------------+

你好,请帮助我理解......如果有其他人的交易,专家顾问会关闭其他人的交易或不打开自己的交易。

 
darirunu1:

你好,请帮助我理解......如果有其他人的交易,专家顾问会关闭其他人的交易或不打开自己的交易。

你寻找订单的魔术师在哪里?
 

如果上面写的是,专家顾问关闭手动开启的交易。

如果我这样说的话

 if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==Symbol()&& OrderMagicNumber()==Magic)  // check for symbol

如果有任何手动开启的交易,那么专家顾问将不会关闭其他交易,但如果有任何手动开启的交易,它将不会开启自己的交易。

 
darirunu1:

如果上面写的是,专家顾问关闭手动开启的交易。

如果我这样说的话

如果有任何手动开启的交易,那么专家顾问将不会关闭其他交易,但如果有任何手动开启的交易,它将不会开启自己的交易。

打开时也需要通过向导选择
 
MakarFX:
我还需要选择开幕时的神奇数字
 ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+TakeProfit*Point,Ask-TakeProfit*Point,"USDCADH4",Magic,0,Red);

这是什么?开口表示。问题是,当你使用几个专家顾问时,没有任何问题。 问题只发生在账户中手动开仓的时候。

只要账户上有手动开启的交易,专家顾问就会停止工作。

只要我在代码中删除这个,total=OrdersTotal()。

如果(total<1)

EAs直接上场,但开出大量的交易

 
darirunu1:

这是什么?开口表示。问题是,当你使用几个EA时,没有任何问题。 问题只发生在账户中手动开仓的时候。

只要账户上有手动开启的交易,专家顾问就会停止工作。

只要我在代码中删除这个,total=OrdersTotal()。

如果(total<1)

EAs直接上场,但开出很多交易。

这就是我所说的 - OrdersTotal()是针对所有订单的,你需要一个EA订单

   if(CountOrders("", -1,  Magic)<1)
     {
     открытие ордеров
     }
//+----------------------------------------------------------------------------+
//| Подсчет ордеров                                                            |
//+----------------------------------------------------------------------------+
//| -1 - Все типы ордеров                                                      |
//|  0 - ордера типа BUY                                                       |
//|  1 - ордера типа SELL                                                      |
//|  2 - ордера типа BUYLIMIT                                                  |
//|  3 - ордера типа SELLLIMIT                                                 |
//|  4 - ордера типа BUYSTOP                                                   |
//|  5 - ордера типа SELLSTOP                                                  |
//+----------------------------------------------------------------------------+
int CountOrders(string symb="", int or_ty=-1, int magiс=-1) 
  {
   int cnt=0;
   if(symb=="0") symb=_Symbol;
   for(int pos=OrdersTotal()-1;pos>=0;pos--)
     {
      if(OrderSelect(pos,SELECT_BY_POS)==true)
        {
         if((OrderSymbol()==symb || symb=="")&&(or_ty<0 || or_ty==OrderType()))
           {
            if(magiс<0 || OrderMagicNumber()==magiс) cnt++;
           }
        }
     }
   return(cnt);
  }
 
MakarFX:

这就是我所说的,OrdersTotal()是所有的订单,你想让EA订单

if(CountOrders("", -1,  Magic)<1)
     {

这是在代替

total=OrdersTotal()。

if(total<1)还是把这一条也留下?

原因: