Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

Risk Lot From Stop Line - indicator for MetaTrader 5

Views:
66
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Position size is the part of risk management that is easiest to get wrong by hand. The value of one point is different for every symbol: Forex pairs, gold, indices and CFDs all have their own contract size, tick value and volume step. This indicator does the calculation for you directly on the chart.

When the indicator starts, a dashed stop line appears one ATR below the price. Drag it to where your stop should be. The panel immediately shows the direction (stop below the price = buy, above = sell), the distance in points, the volume for your risk and the real risk after the volume is rounded to the broker's step.

Risk Lot From Stop Line on an XAUUSD H1 chart

Why the real risk is shown separately

The volume is always rounded DOWN to the volume step, so the risk never exceeds the plan. But on small accounts and wide stops the calculated volume can be smaller than the minimum volume. In that case the indicator shows the minimum volume and how much it really risks. If it is more than N times the planned risk (2 by default), the text turns red: the trade should be skipped or the stop moved. This situation is common on gold, where 0.01 lot with a 50 dollar stop already risks 50 dollars.

Input parameters

  • Risk, % of the base (default 1.0).
  • Base amount (default 0 = current balance). Set a fixed amount if you want the risk from a fixed base, not from the balance.
  • Warn if minimum volume risk > N x planned (default 2.0).
  • Stop line color, panel text color, panel corner, font size.

How the loss is calculated

The loss per 1.0 lot is taken from OrderCalcProfit, which uses the terminal's own calculation mode for the symbol. Before the account is connected OrderCalcProfit may return zero; then the indicator falls back to the tick value (SYMBOL_TRADE_TICK_VALUE_LOSS and SYMBOL_TRADE_TICK_SIZE). The entry price is the Ask for a buy and the Bid for a sell, so the spread is included.

The line is kept when you change the timeframe and removed together with the indicator. The indicator does not open trades.

HTF EMA No Lookahead HTF EMA No Lookahead

Higher-timeframe EMA (fast and slow) on a lower-timeframe chart, using only higher-timeframe bars that are already closed. Values never change after the bar closes.

Round Number Levels Session Grid Round Number Levels Session Grid

Round number levels for Gold (XAUUSD) and any symbol on MT5. Draws major and minor round levels around price plus Asia, London and New York session open lines, with an optional alert when a candle closes across a major level. Open source code.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.