Guarda come scaricare robot di trading gratuitamente
Ci trovi su Facebook!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

SafeRequest - complete and check every MqlTradeRequest in one place - libreria per MetaTrader 5

Visualizzazioni:
48
Pubblicato:
\MQL5\Include\ \MQL5\Scripts\
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

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.