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

TrueCostReport - MetaTrader 5용 expert

Gianluca Gangemi
Gianluca Gangemi
MQL5 개발자로서 MetaTrader 5 자동화를 다룹니다: 전문가 자문(EA), 리스크 관리, 그리고 MT5에서 Python으로 이어지는 리서치 파이프라인.
제가 만드는 EA에는 서버 측 손절, 증거금 수준 보호, 노출 한도, 그리고 터미널이나 VPS 재시작 후의 상태 복구가 들어갑니다. 컴파일이 되는지가 아니라 시스템이 살아남는지를 결정하는 부분들입니다.
조회수:
135
평가:
(1)
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동


Cost is the one input to a trading system that is knowable exactly, and it is almost always estimated wrongly — always in the direction that flatters the strategy.

This Expert Advisor measures what one round trip actually costs on your broker and your symbol: the live spread sampled from ticks, the swap for both sides including the triple-charge day, and the commission read from your own closed deals. Then it puts the number your tools are probably using next to it.

It is strictly read-only. It never opens, closes or modifies a position.

 

The measurement it exists for

The usual source of a spread figure is the spread field of a price bar, because that is the one thing easy to reach from a script or a backtest. That field is a per-bar summary, not the quote at any instant.

Measured on XAUUSD: the live spread was 20 points across 60 consecutive readings while the M1 bar field had a median of 6. A factor of 3.3.

Anything built on that field inherits the error:

  • A spread filter set to "skip the entry if spread > 15" never fires, because the number it reads is a third of the truth. It lets through precisely the moments it exists to block.
  • A backtest charging that spread reports a system cheaper to run than the real one, and the gap grows with the number of trades — so it flatters high-frequency strategies most.

 

The half that most simulators do not charge at all

Swap. It is asymmetric — one side usually pays while the other collects — and one weekday is charged three times. On gold, per 0.01 lot per night, a real account gave −0.5842 long and +0.4098 short, with Wednesday tripled.

On a system that holds positions overnight this is not a detail. A basket of four legs each way costs roughly 1.9 a night simply to exist, which over a year exceeds most of the edges people are trying to capture. MT5's own Strategy Tester charges swap; a great many custom simulators do not, and their results are wrong by the whole of it.

 

Three things it does that a quick version would get wrong

  • It counts distinct quotes, not just ticks. A feed that repeats the same value hundreds of times has been decimated somewhere, and a median over those repeats describes the decimation rather than the market. If fewer than five distinct quotes are seen, it says so.
  • It refuses to measure a closed market. With the market shut the terminal keeps handing out the last tick it saw, so a sampling loop happily collects hundreds of identical readings of the frozen weekend quote — on the symbol this was written for, 50 points against a working-hours median of 20. The test uses the trap it documents: TimeCurrent() is the time of the last tick and freezes with the market, while TimeTradeServer() keeps running, so the gap between them is exactly how stale the quote is.
  • Commission comes from your deals, not from a symbol property. Commission is an account term, not a symbol one: two accounts on the same broker and the same symbol can pay differently, and there is no field to read it from. Zero is a legitimate answer on a spread-only account, and is reported as zero rather than as unknown.

 

Inputs

Input Meaning
InpSampleSeconds How long to sample the live spread. Longer is better on a quiet symbol.
InpLots Lot size to price the cost for.
InpBarsToCompare How many M1 bars to take the bar-field median from.
InpDealDays Days of your own deals to read the commission from.

On the swap mode. SYMBOL_SWAP_LONG and SYMBOL_SWAP_SHORT are quoted in whatever SYMBOL_SWAP_MODE says, and the modes are not interchangeable — reading a points value as if it were money produces a confident wrong number. Points and the deposit-currency modes are converted exactly; the interest and reopen modes depend on the position price and on the broker's year convention, so they are reported as not converted rather than guessed.

 

What it does not do

It does not model slippage, which cannot be measured without trading, and it says nothing about whether a strategy is viable. It measures the toll. What you carry over it is your business.

SuperTrend TV EA SuperTrend TV EA

An Expert Advisor that trades the SuperTrend TV indicator through iCustom on closed bars only, shipped with the audit that proves every trade matches a signal and no signal was missed

Any Indicator Alert - alerts, push notifications and multi-timeframe for any custom indicator, no source code needed Any Indicator Alert - alerts, push notifications and multi-timeframe for any custom indicator, no source code needed

Attach it to a chart, type the name of any custom indicator, and it alerts you on that indicator's own buffers - popup, sound, push notification to your phone, or email. It reads the indicator through iCustom, so no source is needed: a compiled .ex5 you downloaded is enough. It can also read that indicator from a higher timeframe, and it re-checks closed bars to tell you whether the indicator repaints or merely lags. It opens in EXPLORE mode, which lists every buffer the indicator has and what is in each one, because "which buffer holds the signal" is the question that stops most people using iCustom at all.

GDS Renko Donchian Demo EA GDS Renko Donchian Demo EA

A small educational Expert Advisor showing how a classic Donchian breakout can be applied directly to completed Renko bricks.

Prop Firm Rule Checker Prop Firm Rule Checker

Checks your trade history against common prop-firm challenge rules — profit target, max daily loss, max drawdown, consistency rule, and minimum trading days — with a clear PASS/FAIL report.