Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Twitter ü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

Can I trade right now - session, session end and quote check in one call - MetaTrader 5 için kütüphane

Lukas Szyry
Lukas Szyry
Gold Trading Specialist | XAUUSD Expert Advisors
MetaTrader 5 için altın (XAUUSD) üzerine kural tabanlı Expert Advisor'lar geliştiriyorum. Odak noktam uzun vadeli hesap büyümesi için sağlam sistemler: martingale yok, grid yok, zararda maliyet düşürme yok.
Görüntülemeler:
81
Yayınlandı:
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

Every EA i build needs this check before an order goes out, otherwise you get "market closed" errors in the journal or a trade opened 2 minutes before the daily close. So here it is as one small include.

LS_CanTradeNow(_Symbol, 15, 300, why) checks:

  • algo trading allowed in the terminal and for the program
  • symbol not disabled or close only
  • a trade session of the symbol is running now (server time, sessions over midnight and 24h sessions are handled)
  • the session does not end within the next x minutes (15 in the example)
  • the last quote is not older than x seconds (300 in the example)

If the answer is false, why tells you the reason, for example "market closed (no trade session now)" or "session ends in 14 min (min 15)".

The quote check is there because some brokers close earlier before holidays than their session table says. When no quotes come in for a few minutes the market is treated as closed.

The other functions can be used alone:
LS_SessionOpen(sym) - true if a session is running
LS_MinutesToSessionEnd(sym) - minutes until the close, -1 if closed. A session that ends at 24:00 and goes on at 00:00 counts as one
LS_TickAgeSeconds(sym) - seconds since the last quote
LS_SessionsText(sym, day) - the sessions of a day as text, for example 01:05-23:50

All times are broker server time. TimeTradeServer() is used, so it also works on the weekend when no ticks come in. If a symbol has no session table at all the functions dont block.

The demo EA opens no trades. It prints the sessions of the week and then one line every time the answer changes. Run it in the strategy tester over a few days with a weekend and you see the daily close and the reopen in the journal (screenshot: XAUUSD, 19.-23.11.2026).

Trend or Chop? A Variance-Ratio Scoreboard That Shows Whether Your Symbol Trends or Mean-Reverts on Each Horizon Trend or Chop? A Variance-Ratio Scoreboard That Shows Whether Your Symbol Trends or Mean-Reverts on Each Horizon

Shows whether your symbol tends to trend or to mean-revert, and on which horizon. For five horizons (2, 4, 8, 16 and 32 bars by default) the indicator computes the variance ratio: the variance of multi-bar price changes divided by the variance of one-bar changes, scaled by the horizon. A ratio above 1 means that moves tend to continue, below 1 that they tend to reverse. The lines show the ratio over a rolling window, and a panel gives a scoreboard with ratio, z-score and verdict TREND, CHOP or NOISE for the recent window and for the whole history, plus one line to paste into a comment. It is a statistics tool and gives no trade signals.

PropFirm Consistency and Drawdown Monitor PropFirm Consistency and Drawdown Monitor

Read-only PropFirm daily drawdown, trailing total drawdown, and single-day consistency cap HUD monitor with four closed-bar iCustom buffers.

Same H4 and D1 candles on every broker - NY close candles from H1 Same H4 and D1 candles on every broker - NY close candles from H1

Builds H2 to D1 candles from H1 on the New York close clock, so your indicators see the same candles on every broker, no matter which server time it uses. Detects the server clock automatically.

Risk Lot Calculator Risk Lot Calculator

Calculates the lot size for a risk % and a stop distance on any symbol, using the broker's own profit calculation, so the result is exact for forex, gold, indices, stocks and crypto.