거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

MQTTFive — MQTT 5.0 클라이언트 라이브러리 - MetaTrader 5용 라이브러리

Sergey Chekh
Sergey Chekh
👋 Hi there! I write robots, systems, and other stuff in Python and MQL5.
📊 My workday is a marathon of creating neural networks and algorithmic trading robots, which I make trade through MetaTrader. I teach them to play the market just like I taught my dog to balance a treat on his nose.
| Korean English Русский 中文 Español Deutsch 日本語 Português Français Italiano Türkçe
조회수:
12
평가:
(1)
게시됨:
\MQL5\Include\MQTTFive\
MQTTTypes.mqh (10.13 KB) 조회
MQTTCodec.mqh (15.02 KB) 조회
MQTTClient.mqh (20.94 KB) 조회
\MQL5\Scripts\
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

MQTTFive — MQL5용 MQTT 5.0 클라이언트

MetaTrader 5의 Expert Advisors 및 스크립트를 MQTT 브로커(Mosquitto, EMQX, HiveMQ)에 연결하기 위한 라이브러리(#include)입니다. 이를 통해 시세 및 신호를 게시하고, 외부 시스템으로부터 명령을 수신하며, Expert Advisors의 상태를 모니터링할 수 있습니다.

DLL 없이 순수 MQL5로 구현되었으며, 자체 소켓 API를 사용합니다. MQTT v5.0 프로토콜을 지원합니다.

기능

  • QoS 0, 1, 2 지원 및 전송되지 않은 메시지의 자동 재전송
  • CONNECT/CONNACK 속성: 세션 유효 기간, 수신 가능한 패킷의 최대 수, 주제 별명의 최대 수.
  • 게시 지연이 있는 유언
  • 주제 별칭 – 중복 주제에 대한 트래픽 감소.
  • 흐름 제어 — 수신 가능한 데이터의 최대 용량 할당량 관리.
  • 구독 옵션: no_local, retain_as_published, retain_handling
  • TLS/SSL, 바이너리 페이로드, UTF-8


arch

설치

  1. 아카이브에 포함된 5개의 파일을 MQL5/Include/MQTTFive/ 폴더로 복사하십시오.
  2. 코드 내: #include <MQTTFive/MQTTClient.mqh>

예시 - 가격 게시

#include <MQTTFive/MQTTClient.mqh>

void OnStart ()
  {
   MQTTClient client;
   MQTTConnectParams params;
   params.Init();
   params.client_id = "price_pub" ;

   if (client.Connect( "127.0.0.1" , 1883 , params))
     {
       double bid = SymbolInfoDouble ( _Symbol , SYMBOL_BID );
      client.Publish( "mt5/price/" + _Symbol , DoubleToString (bid, _Digits ), 0 );
      client.Disconnect();
     }
  }

예시 - 신호 구독

MQTTClient *mqtt;

void OnSignal( string &topic, uchar &payload[], uint payload_len)
  {
   string msg = CharArrayToString (payload, 0 , ( int )payload_len, CP_UTF8 );
   Print ( "Signal: " , topic, " = " , msg);
  }

void OnStart ()
  {
   mqtt = new MQTTClient();
   mqtt.SetCallback(OnSignal);
   MQTTConnectParams params;
   params.Init();
   params.client_id = "signal_sub" ;
   mqtt.Connect( "127.0.0.1" , 1883 , params);
   mqtt.Subscribe( "trade/signal/#" , 1 );
   while (! IsStopped ())
     {
      mqtt.Loop();
       Sleep ( 100 );
     }
   mqtt.Disconnect();
   delete mqtt;
  }



주요 메서드

Connect(host, port, params, useTLS) 브로커에 연결
Disconnect() 올바르게 종료하기
ForceDisconnect() TCP 연결 끊기 (윌 실행)
Publish(topic, payload, qos, retain) 메시지 게시
Subscribe(topic, qos) 이 토픽 구독하기
Unsubscribe(topic) 구독 취소
Loop() 패킷 처리, 연결 유지, 재시도
SetCallback(func) 수신 메시지에 대한 콜백 함수

요구 사항

  • MetaTrader 5 (빌드 3390+)
  • MQTT 브로커 5.0 (Mosquitto >= 5.0, EMQX, HiveMQ)

문서: github.com/chekh/MQTTFive

라이선스: MIT

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/73373

Consecutive Bars (with history) indicator for MT5 Consecutive Bars (with history) indicator for MT5

An oscillator that shows 2 line studies: 1 for consecutive up bars, and 1 for consecutive down bars.

Multi-Timeframe Candle Map Multi-Timeframe Candle Map

An educational MT5 panel that maps the live price vertically inside four developing candles and summarizes location alignment, dispersion, candle direction and time remaining.

Prop Firm Risk Dashboard - daily loss and drawdown monitor Prop Firm Risk Dashboard - daily loss and drawdown monitor

A read-only on-chart panel that tracks your account against a daily-loss limit and a max-drawdown limit, with color-coded OK / WARNING / DANGER status. Monitoring only - it does not place, modify or close any orders.

ShowMinMaxDayLevels ShowMinMaxDayLevels

The indicator displays high and low levels of a day (specified by the input parameter value) on any timeframe.