Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Facebook üzerinde bulun!
Fan sayfamıza katılın
Kodu ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Kodu beğendiniz mi? MetaTrader 5 terminalinde deneyin
Kütüphaneler

Trade Settings — Persist and Migrate Per-Trade Settings - MetaTrader 5 için kütüphane

Sayed Ali Ordibehesht
Sayed Ali Ordibehesht
EA PRO TEAM, trader ve yazılım geliştiricisi Sayed Ali Ordibehesht tarafından kurulan bağımsız bir alım satım yazılımı markasıdır.
Görüntülemeler:
38
Yayınlandı:
\MQL5\Experts\TradeSettings\ \MQL5\Scripts\TradeSettings\
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

Trade Settings isolated ticket 0 save and reload output

Template record (ticket 0) is saved with points=200.00 and mode=1, then loaded back with the same values using the public TradeSettings API.

Overview

An EA or manual trading panel may need separate settings for each order or position, such as a distance and a mode. Trade Settings stores custom values separately for each ticket, alongside its position identifier, pending/position state and base volume. It supports double, ulong and price-unit quantities; a saved quantity is converted when the current price unit changes.

Lifecycle behavior

Ticket zero is kept as a separate template. After the initial scan, the library can create a record for a newly observed trade and follow a pending order into a position when the source is verified. Cleanup waits for connection, absence and history checks. Incomplete records, invalid aliases and ambiguous histories are retained and reported rather than silently receiving defaults or being treated as proof of closure.

Usage example

//+------------------------------------------------------------------+
//| ShowTicket: print saved settings for a ticket                    |
//+------------------------------------------------------------------+
void ShowTicket(CTradeSettings &settings,const ulong ticket)
  {
   TSResult locked=settings.Lock();
   if(locked==TS_BUSY)
      return;
   if(locked!=TS_OK)
     {
      Print(settings.LastError());
      return;
     }
   TSRecord record;
   TSResult status=settings.Load(ticket,record);
   if(status==TS_OK)
      PrintFormat("distance=%.2f, mode=%I64u",
                  record.values[0].number,record.values[1].integer);
   else if(status==TS_MISSING)
      Print("No settings record for ticket ",ticket);
   else
      Print(settings.LastError());
   if(settings.Unlock()!=TS_OK)
      Print(settings.LastError());
  }

Retry a busy lock on a later timer. Acquire the lock before Load , Has , Save , Scan or Cleanup , and always release it after the operation.

Installation and files

Open File > Open Data Folder in MetaTrader 5 and extract TradeSettings-Source.zip into that data folder. Compile the EA and self-test script in MetaEditor and refresh Navigator. Attach TradeSettings\TradeSettingsDemo to a demo chart. The EA observes trades and does not send trade requests. Run TradeSettings\TradeSettingsSelfTest and check Experts for RESULT failures=0 .

  • TradeSettings.mqh — standalone library; no DLL or external library dependency.
  • TradeSettingsDemo.mq5 — polling example EA for observing saved settings.
  • TradeSettingsSelfTest.mq5 — offline checks for hashes, key limits, ulong words, unit conversion, incomplete records and identity-alias states.
  • TradeSettings-Source.zip — complete MQL5 installation layout with the demo, self-test, headers and guides.
  • README.md and TEST_GUIDE.md — integration and runtime test instructions, included in the archive.

Tested scope and limitations

On an ePlanet hedging demo, a pending order filled with the same ticket. Timeframe change, normal terminal restart, partial close and API-level cleanup after a full close were observed. The self-test and two-chart library lock handover were also run in an MT5 demo terminal.

Untested: transition to a different ticket, reconnection as an independent scenario, and netting account behavior. The different-ticket and history-based paths are implemented but not validated by these live-demo tests.

Storage uses terminal Global Variables in the same terminal data folder. It is not transferred automatically to another computer, installation or VPS. MetaTrader removes Global Variables after four weeks without access; regular access may extend that period. History uncertainty can prevent migration or cleanup. The library does not merge multiple netting entry orders, and it does not guarantee a multi-key transaction or recovery from forced termination or power loss.

Building a Confluence Signal Engine in MQL5: Leading Triggers, Confirmation Filters and a Live Dashboard Building a Confluence Signal Engine in MQL5: Leading Triggers, Confirmation Filters and a Live Dashboard

Free source code included: a DST-aware Market Sessions + PVSRA vector-candle indicator, 5 preset files and a printable confluence cheat sheet.

Trend Strength Meter Using ADX in a Compact Dashboard Trend Strength Meter Using ADX in a Compact Dashboard

A compact on-chart dashboard that shows the trend strength of up to four timeframes using the ADX: value, strength bar, strength class and +DI/-DI direction, plus a summary row with the average ADX and the agreement of the directions.

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.