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

Trade Settings — Persist and Migrate Per-Trade Settings - MetaTrader 5용 라이브러리

Sayed Ali Ordibehesht
Sayed Ali Ordibehesht
EA PRO TEAM은 트레이더이자 소프트웨어 개발자인 Sayed Ali Ordibehesht가 설립한 독립 트레이딩 소프트웨어 브랜드입니다.
저희는 전문 MetaTrader 5 도구와 트레이더의 생산성을 높이는 솔루션을 개발하며, 리스크 관리, 거래 실행, 자동화 및 거래 성과 분석에 중점을 둡니다.
EA PRO Risk Panel은 정확한 계산, 실계좌에서의 안정성, 효율적인 워크플로 및 깔끔한 사용자 경험을 중심으로 설계된, 지속적으로 확장되는 소프트웨어 생태계의 첫 번째 제품입니다.
조회수:
126
평가:
(1)
게시됨:
\MQL5\Experts\TradeSettings\ \MQL5\Scripts\TradeSettings\
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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.

Volatility Regime Percentile Volatility Regime Percentile

Ranks the current ATR against its own recent history and colours each bar as a LOW, NORMAL or HIGH volatility regime, with a panel showing ATR in price and points, ATR vs its median and how long the regime has held.

Truncation Audit: Detecting Look-Ahead and Repainting in MQL5 Indicators. Truncation Audit: Detecting Look-Ahead and Repainting in MQL5 Indicators.

Part 3 of the indicator regression-testing series. Compares the value an indicator had when each bar closed with the value recomputed on the later history, flags every bar that changed (look-ahead or repainting), and measures how many future bars each value needed before it settled.