Questions des débutants MQL5 MT5 MetaTrader 5 - page 862

 
Konstantin Erin:
si(OrdersTotal() < OrdersMax) OrderSend(...) ; sinon Alert("Le nombre requis d'ordres ouverts") ;

Merci !

 
Pouvez-vous me dire où se trouve l'indicateur de volume et où je peux trouver des volumes de volume ? !
 
int TotalGridBuyOrders=0;
   Print(__FUNCTION__);
   for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
   if(m_order.SelectByIndex(i))     // selects the pending order by index for further access to its properties
         if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()== ORDER_TYPE_BUY_STOP)
           TotalGridBuyOrders++;
    Print("Количество buy ордеров grid ", TotalGridBuyOrders);
           if (TotalGridBuyOrders>=1)
           {
           grid_buy_price_memory=m_order.PriceOpen();        
           Print("Цена ближайшего buy grid ордера: ", grid_buy_price_memory);
           
          
int TotalGridSellOrders=0;
   Print(__FUNCTION__);
   for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
   if(m_order.SelectByIndex(i))     // selects the pending order by index for further access to its properties
         if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()== ORDER_TYPE_SELL_STOP)
           TotalGridSellOrders++;
    Print("Количество sell ордеров grid ", TotalGridSellOrders);
           if (TotalGridSellOrders>=1)   
            {
           grid_sell_price_memory=m_order.PriceOpen();    
           Print("Цена ближайшего sell grid ордера: ", grid_sell_price_memory);

Pourquoi la dernière impression affiche-t-elle le prix deORDER_TYPE_BUY_STOP?

et non deORDER_TYPE_SELL_STOP

Où se trouve l'erreur ?

 
ilyav:

Pourquoi la dernière impression affiche-t-elle le prix deORDER_TYPE_BUY_STOP?

et non deORDER_TYPE_SELL_STOP

Où est l'erreur ?

Utilisez le styler (Ctrl + ,) et vous verrez vos erreurs...

 
Vladimir Karputov:

Utilisez le styler (Ctrl + ,) et vous verrez vos erreurs...

Je n'ai pas d'erreur de compilation.

Ce code doit sortir en Print le prix des ordres d'achat et de vente.

Le prix de l'ordre d'achat est émis correctement mais l'ordre de vente émet le prix de l'ordre d'achat !

 
ilyav:

Je n'ai pas d'erreur de compilation.

Ce code doit sortir en Print le prix des ordres d'achat et de vente.

Le prix d'un ordre d'achat est correct, mais le prix d'un ordre de vente est correct !

À ce stade, le conseil est le même : utilisez le stylo - vous verrez les erreurs.

... et seulement alors je vous montrerai où est votre erreur.
Стилизатор - Работа с исходным кодом - MetaTrader 5
Стилизатор - Работа с исходным кодом - MetaTrader 5
  • www.metatrader5.com
Данная функция предназначена для оформления исходного кода в соответствии с рекомендуемым стандартом. Это позволяет сделать код более читаемым, выглядящем профессионально. Грамотно оформленный код гораздо проще анализировать в последующем как его автору, так и другим пользователям. Для того чтобы запустить стилизатор, необходимо выполнить...
 
Vladimir Karputov:

Pour l'instant, le conseil reste le même : utilisez un stylisateur - vous verrez les erreurs visuellement.

... Et seulement après ça, je vous montrerai où est votre erreur.
int TotalGridBuyOrders=0;
         Print(__FUNCTION__);
         for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
            if(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
               if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()==ORDER_TYPE_BUY_STOP)
                  TotalGridBuyOrders++;
         Print("Количество buy ордеров grid ",TotalGridBuyOrders);
         if(TotalGridBuyOrders>=1)
           {
            grid_buy_price_memory=m_order.PriceOpen();
            Print("Цена ближайшего buy grid ордера: ",grid_buy_price_memory);

            int TotalGridSellOrders=0;
            Print(__FUNCTION__);
            for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
               if(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
                  if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()==ORDER_TYPE_SELL_STOP)
                     TotalGridSellOrders++;
            Print("Количество sell ордеров grid ",TotalGridSellOrders);
            if(TotalGridSellOrders>=1)
              {
               grid_sell_price_memory=m_order.PriceOpen();
               Print("Цена ближайшего sell grid ордера: ",grid_sell_price_memory);

Le voici avec le styler. Mais je ne vois pas l'erreur. C'est pourquoi je demande dans ce fil de discussion

Questions des débutants en MQL5

 
ilyav:

Voici celui avec le stylisateur. Mais je ne vois pas l'erreur. C'est pourquoi je demande dans ce fil de discussion

Questions des débutants en MQL5

Le styler a clairement montré que votre code contient des problèmes avec les parenthèses fermantes. Tu dois le réparer.

 

Merde, quelqu'un ici peut aider ?

Si le styliste vous a clairement montré quelque chose - ne pourriez-vous pas me dire où le support devrait être ?

Parce que ça ne m'a pas montré clairement quelque chose.

J'ai besoin du prix du stop d'achat le plus proche et du stop de vente le plus proche. Comment faire pour que le code soit différent ?

 
ilyav:

Merde, quelqu'un ici peut aider ?

Si le styliste vous a clairement montré quelque chose - ne pourriez-vous pas me dire où le support devrait être ?

Parce que ça ne m'a pas montré clairement quelque chose.

J'ai besoin du prix du stop d'achat le plus proche et du stop de vente le plus proche. Comment faire pour que le code soit différent ?

J'ai mis en évidence les parenthèses où il manque des paires:

int TotalGridBuyOrders=0;
         Print(__FUNCTION__);
         for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
            if(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
               if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()==ORDER_TYPE_BUY_STOP)
                  TotalGridBuyOrders++;
         Print("Количество buy ордеров grid ",TotalGridBuyOrders);
         if(TotalGridBuyOrders>=1)
           {
            grid_buy_price_memory=m_order.PriceOpen();
            Print("Цена ближайшего buy grid ордера: ",grid_buy_price_memory);

            int TotalGridSellOrders=0;
            Print(__FUNCTION__);
            for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current orders
               if(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
                  if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic && m_order.OrderType()==ORDER_TYPE_SELL_STOP)
                     TotalGridSellOrders++;
            Print("Количество sell ордеров grid ",TotalGridSellOrders);
            if(TotalGridSellOrders>=1)
              {
               grid_sell_price_memory=m_order.PriceOpen();
               Print("Цена ближайшего sell grid ордера: ",grid_sell_price_memory);

L'endroit exact où placer les paires dépend de la logique de votre code.

Raison: