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

Spectar Lot Size From Stop and Daily Loss Room - MetaTrader 5용 스크립트

조회수:
67
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Many daily loss breaches come from position size, not from the entry idea. The same lot on a 3 dollar stop and on a 15 dollar stop on gold carries very different risk. This script works the size backwards: from the cash you accept to lose on one trade and the distance to your stop.

Lot size from stop and daily loss room: result on the chart

It reads the tick value and tick size of the current symbol, so the result is correct for gold, currency pairs and indices without manual contract math. The lot is rounded down to the broker volume step, and the script warns when the result is below the broker minimum.

Inputs

  • InpRiskCash - cash you accept to lose on this trade, in account currency.
  • InpStopPoints - stop distance in points.
  • InpSlipPoints - extra points you allow for slippage; they are added to the stop.
  • InpDailyLimit - your own daily loss limit; when above zero, the script shows how many full losses of this size fit inside it.

Output

Loss per 1.00 lot at this stop, the lot size rounded down, the loss if the stop is hit, and the number of full losses that fit your daily limit. The result is shown on the chart (Comment) and in the Experts log.

How the calculation works

The script reads SYMBOL_TRADE_TICK_VALUE and SYMBOL_TRADE_TICK_SIZE for the chart symbol. From them it computes the money value of one point for 1.00 lot, multiplies it by the stop distance plus the slippage allowance, and gets the loss per 1.00 lot at that stop. Dividing the cash you accept to lose by this figure gives the raw lot size, which is then rounded down to SYMBOL_VOLUME_STEP and checked against SYMBOL_VOLUME_MIN and SYMBOL_VOLUME_MAX.

loss per 1.00 lot(stop points + slippage points) x point / tick size x tick value
lot sizecash at risk / loss per 1.00 lot, rounded down to the volume step
losses that fit the daily limitdaily limit / loss at the rounded lot, rounded down

Example on gold (XAUUSD)

On a typical gold contract of 100 ounces, one dollar of price movement is worth about 100 units of account currency per 1.00 lot. With a 5 dollar stop (500 points on a two-digit quote), a 50 point slippage allowance and 250 of cash at risk, the loss per 1.00 lot is about 550, so the script suggests 0.45 lots, rounded down from 0.4545. With a daily limit of 1,000, two such full losses fit, and the third would cross it. Contract sizes differ between brokers, which is why the script reads them from the symbol instead of assuming them.

How to use it

  1. Attach the script to the chart of the symbol you plan to trade.
  2. Enter the cash you accept to lose on the trade, the stop distance in points and, if you want, a slippage allowance and your own daily limit.
  3. Read the result in the chart comment or in the Experts tab, then place the order yourself with the size shown.

Notes

The script uses the current tick value, which can change with the exchange rate when the account currency differs from the profit currency of the symbol. Run it again shortly before you enter. It does not know your open positions or today's closed result; the daily figure it shows is simply how many losses of this size fit inside the limit you typed.

The script is read-only: it opens, modifies or closes nothing. Every number is typed by you. A gap or slippage at your broker can carry a loss past any stop.

Intraday Volatility Profile Intraday Volatility Profile

Typical range of each time of day (median of the previous N days) versus the actual range of the bar. Shows when the market really moves. No look-ahead, no repainting. M1 to H1.

Rollover Cost Table - swap mode from the symbol, triple-swap day from the broker Rollover Cost Table - swap mode from the symbol, triple-swap day from the broker

An MQL5 indicator that draws a table on the chart with one row per open position and shows what one more night of holding it costs, in the deposit currency where the symbol's swap mode allows it. The swap mode and the two rates come from the symbol's own specification, and so does the triple-swap weekday; no rate is typed into the code. Where the symbol charges in points, a horizon column turns that night into the number of normal nights needed to repay one round turn, and a figure the terminal cannot supply is a dash with a reason, never a zero.

PassRecorder PassRecorder

A library for MetaTrader 5 that writes every pass of an optimization to a SQLite file: result, test statistics, your own metrics and the inputs of the pass. A demo Expert Advisor optimizes the Rosenbrock function in the mode "Math calculations".

Spectar Prop Challenge Dashboard Spectar Prop Challenge Dashboard

Read-only panel with the numbers a prop-style challenge is judged on: today's result from server midnight (closed plus floating), room to your daily loss limit, static or trailing overall floor, profit target and trading days.