Discusión sobre el artículo "Cómo crear un bot para Telegram en el lenguaje MQL5" - página 46

 
Jefferson Metha #:

En la esquina superior derecha hay un icono de lupa también conocido como el icono de búsqueda
haga clic izquierdo en él
a continuación, escriba
" Binance"
Pulse la tecla [ENTER] en su escritorio

entonces usted los conseguirá no hay necesidad de desplazarse hacia abajo.

usted bienvenido

Gracias, he localizado la biblioteca

 
CÓMO getfile a BOT para usuario descargar archivo
 
telegram bot inputFile

Cómo escribir esto

Mi Inglés no es bueno, lo siento gracias
 

Gran artículo. Funciona. Puedo hacerte una pregunta nubia. En los indicadores dice URL no permitido para WebRequest

¿Entiendo correctamente que WebRequest no funciona en los indicadores ?

Ya lo he entendido. Pausas sincrónicas. No funciona. Lástima.


	          
 
Valeriy Yastremskiy WebRequest en los indicadores

¿Entiendo correctamente que WebRequest no funciona en los indicadores?

No funciona

 
Vitaly Muzichenko #:

No funciona

Pero funciona en el tester)) SendNotification tendrá que. No es tan conveniente, y no funciona en el probador.

 

Ayuda por favor, estoy confundido. Como obtener programáticamente el id de tu chat en una variable global sabiendo el token de tu bot. Está claro que se puede preguntar a diferentes bots por su id, pero yo quiero hacerlo programáticamente.

Hay un bucle en la función ProcessMessage que obtiene el número que busco, pero suele devolver cero, y no lo recuerdo.

Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
  • 2022.02.10
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Otra pregunta. Sabiendo el token del bot, es posible obtener el ID del chat del usuario que creó este bot desde Telegram sin enviar un mensaje desde el bot. Obtenemos el nombre del bot por el token.
 
en mq5 lado "chat.m_new_one.message_text" recibe el mensaje que el usuario envía al bot directamente que es grande.
Sin embargo, ¿puede ser utilizado para recibir el mensaje que se envía al canal que el bot (el que se está comunicando con el EA mt5) es un miembro de?
 

Hola amigos, uso el siguiente código para enviar un mensaje a Telegram. Mi problema es que en vez de enviar el mensaje una vez, lo envía varias veces.

Por favor guíenme.

#include <Telegram\TelegramL.mqh>


input string InpChannelName="";//Nombre del canal
input string InpToken="";//Bot Token


CCustomBot bot;

datetime time_signal=0;
//int SendMessage(const cadena nombre_canal,
                //const cadena texto);




//+------------------------------------------------------------------+
//| Función de inicialización experta|
//+------------------------------------------------------------------+
int OnInit()
  {
   time_signal=0;

//--- set token
   bot.Token(InpToken);


//--- hecho
   return(INIT_SUCCEEDED);
  }
 
  datetime _opened_last_time = TimeCurrent() ;
  datetime _closed_last_time = TimeCurrent()  ;
  
 

//+------------------------------------------------------------------+
//| Función de desinicialización experta|
//+------------------------------------------------------------------+
void OnDeinit(const int reason)

{

}
     
  
//+------------------------------------------------------------------+
//| Función tick experto|
//+------------------------------------------------------------------+
void OnTick()
  {
  

   string message = "";
   int total=OrdersTotal();
 
       
   for(int pos=0;pos<total;pos++){  // Pedidos actuales -----------------------
     if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
     if(OrderOpenTime() <= _opened_last_time) continue;
     
     message += StringFormat("Order opened!\r\nType: %s\r\nSymbol: %s\r\nPrice: %s\r\nSL: %s\r\nTP: %s\r\nTime: %s\r\nTicket:.%s ",
     order_type(),
     OrderSymbol(),
     DoubleToStr(OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_DIGITS)),
     DoubleToStr(OrderStopLoss(),MarketInfo(OrderSymbol(),MODE_DIGITS)),
     DoubleToStr(OrderTakeProfit(),MarketInfo(OrderSymbol(),MODE_DIGITS)),
     TimeToStr(OrderOpenTime(),TIME_MINUTES),
     IntegerToString(OrderTicket())
          
      );
    
     int res=bot.SendMessage(InpChannelName,message);
     if(res!=0)
         Print("Error: ",GetErrorDescription(res));
     
     }
  
      
  
      bool is_closed = false;

                   
  total = OrdersHistoryTotal();
      
   for(int pos=0;pos<total;pos++){  // Historia pedidos-----------------------
      if(OrderSelect(pos,SELECT_BY_POS,MODE_HISTORY)==false) continue;
      if(OrderCloseTime() <= _closed_last_time) continue;
     printf(OrderCloseTime());
     is_closed = true;
     
     message += StringFormat("Order closed!\r\nTicket: %s\r\nSymbol: %s\r\nClosing Price: %s\r\nTime: %s",
     IntegerToString(OrderTicket()),
     OrderSymbol(),
     DoubleToStr(OrderClosePrice(),MarketInfo(OrderSymbol(),MODE_DIGITS)),
     TimeToStr(OrderCloseTime(),TIME_MINUTES),
     DoubleToStr(order_pips(),1)
     
    
     );
      
      int res=bot.SendMessage(InpChannelName,message);
     if(res!=0)
         Print("Error: ",GetErrorDescription(res));
      
     }
 
   }
   
   
double order_pips() {
   double pips;
   
   if(OrderType() == OP_BUY) {
      pips =  (OrderClosePrice()-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT);
   } else {
      pips =  (OrderOpenPrice()-OrderClosePrice())/MarketInfo(OrderSymbol(),MODE_POINT);
   }
   return pips/10;
}

string order_type_to_str(int type)
{
   return StringSubstr(EnumToString((ENUM_ORDER_TYPE)type), 11);
}
string order_type () {
   return order_type_to_str(OrderType());
   
   if(OrderType() == OP_BUY)        return "BUY";
   if(OrderType() == OP_SELL)       return "SELL";
   if(OrderType() == OP_BUYLIMIT)   return "BUY LIMIT";
   if(OrderType() == OP_SELLLIMIT)  return "SELL LIMIT";
   if(OrderType() == OP_BUYSTOP)    return "BUYSTOP";
   if(OrderType() == OP_SELLSTOP)   return "SELLSTOP";
   
   return "{err}";
}
   

   
//---