
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.
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.
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.
//+------------------------------------------------------------------+
//| 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.
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 .
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
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
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)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.