Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Indicateurs

Trade Cost Meter - indicateur pour MetaTrader 5

Vues:
64
Note:
(1)
Publié:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

Every trade pays the spread and often a commission. On a daily chart this is nothing, but on low timeframes the stop is small, and the same costs can take a large part of the risk of every trade. A strategy that looks fine before costs can lose money after them. This indicator shows the numbers for the current symbol directly on the chart.

It measures the spread (now, average and maximum over the last ticks), adds the commission you enter, shows the swap for one night and the day of the triple swap, and calculates the cost of a round trip for 1 lot. Then, for every timeframe from M1 to D1, it compares this cost with a typical stop of N x ATR and shows which share of the risk (R) the costs take.

Trade Cost Meter on XAUUSD H1

How to read it

  • Green: costs take less than 3% of R (by default). The timeframe is cheap to trade.
  • Orange: between 3% and 10% of R. Costs are noticeable; the strategy needs a real edge to pay them.
  • Red: more than 10% of R. A large part of every trade goes to the broker.

Example from the picture (XAUUSD, demo account, spread 0.15): with a stop of 1.5 ATR the costs take 6.2% of R on M1, 2.4% on M5 and only 0.5% on H1. On a wider spread or with a commission the numbers on low timeframes grow quickly.

Input parameters

  • Commission per 1 lot per side, in account currency (0 if your account has no commission). Brokers show it in the account conditions.
  • Stop distance, x ATR (default 1.5) and ATR period (default 14): the typical stop used for the estimate.
  • Ticks for the average and maximum spread (default 5000).
  • Red and green thresholds in % of R.
  • Panel corner.

Notes

  • Spread and swap are converted to money with the symbol's tick value, so the panel works for Forex, metals, indices and CFDs. Swaps in interest modes are shown as an approximation.
  • Comparing two account types of the same broker (with and without commission) is a typical use: enter the commission and look at the round-trip cost.
  • The panel refreshes every 5 seconds, also when there are no ticks. The indicator does not trade.
LotFromRisk: position size from risk, stop and commission LotFromRisk: position size from risk, stop and commission

An include file for calculating the size of a position to be opened. It turns a risk figure (percent of the balance, percent of the equity or money), a stop and a commission per lot into a lot size whose loss at the stop never goes over that risk. The lot is always rounded down to the volume step and a risk below the minimum volume returns 0 lots with a reason.

Dashboard Panel Dashboard Panel

A clean information card for your EA or indicator: rows, progress bars and a status pill on one anti-aliased CCanvas bitmap, light or dark to match the chart, and foldable with a click.

Break-even and Trailing Stop Manager Break-even and Trailing Stop Manager

Moves the stop loss to break-even (with locked profit) and trails it by a fixed distance or an ATR multiple. Never opens or closes trades, the stop loss only moves forward.

Equity Guard Equity Guard

Closes all positions, deletes pending orders and blocks new trades when the daily loss, drawdown-from-peak or daily profit target is reached. Works with manual trading and any other EA. State survives terminal restart.