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

SafeRequest - complete and check every MqlTradeRequest in one place - MetaTrader 5용 라이브러리

조회수:
48
게시됨:
\MQL5\Include\
SafeRequest.mqh (18.27 KB) 조회
\MQL5\Scripts\
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

MqlTradeRequest describes the complete state of a position, so fields left unassigned are still read: tp = 0.0 in a TRADE_ACTION_SLTP request removes the take profit, position = 0 on a hedging account opens a second position, type_filling = 0 means fill-or-kill. All of these return 10009.

SafeRequest puts the rules in one place so every call site sends the same complete request:

  • SRSetStops(ticket, sl, tp, result) : moves one level without disturbing the other. Pass SR_KEEP for a level that should stay as it is. Skips the request when nothing would change.
  • SRRoundToTick() : rounds to SYMBOL_TRADE_TICK_SIZE in the direction the caller states (stops away from the market, targets towards it).
  • SRMinStopDistance() : SYMBOL_TRADE_STOPS_LEVEL, or a spread-based distance when the broker reports zero.
  • SRIsFrozen() : skips changes while price is inside SYMBOL_TRADE_FREEZE_LEVEL.
  • SRFilling() : picks a filling mode the symbol actually offers.
  • SRWouldPass() : runs OrderCheck on the request before sending.
  • ScaleStateRead() : rebuilds a position's scale-out state from deal history after a restart or recompile.
  • SRClose() : closes a named position, so a hedging account never opens the opposite side.
  • SRVolume() : floors a volume to the symbol's step and clamps it to the min/max.

Files

  • SafeRequest.mqh — the include file (MQL5\Include).
  • SafeRequest_Verify.mq5 — script: checks every Market Watch symbol's stop distance and tick grid, writes MQL5\Files\SafeRequest\limits.csv. Sends nothing.
  • SafeRequest_ScaleState.mq5 — script: rebuilds each open position's partial-close state from deal history. Read-only.
    Verify_Output


      #include <SafeRequest.mqh>
      
      MqlTradeResult res;
      // move only the stop; the take profit is read from the position and kept
      SRSetStops(ticket, new_sl, SR_KEEP, res);

      PostQuantumCrypto: ML-KEM (Kyber) and ML-DSA (Dilithium) post-quantum encryption keys and signatures for MQL5 PostQuantumCrypto: ML-KEM (Kyber) and ML-DSA (Dilithium) post-quantum encryption keys and signatures for MQL5

      The NIST post-quantum standards in plain MQL5 with no DLL: ML-KEM to agree on a secret key, ML-DSA to sign and verify, and the SHA-3 and SHAKE functions they are built on. Every output matches NIST's official test vectors, OpenSSL and Go byte for byte.

      Broker Symbol Compatibility Scanner Broker Symbol Compatibility Scanner

      Scans the broker's complete MT5 symbol catalogue, resolves common prefixes, suffixes and aliases, checks trading specifications and exports a compatibility report to CSV.

      Accelerator Oscillator (AC) Accelerator Oscillator (AC)

      The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

      MACD Signals MACD Signals

      Indicator edition for new platform.