Edgoro

Algorithmic trading glossary

64 terms from algorithmic trading, backtesting, risk, Pine Script, MetaTrader 5, crypto derivatives and prop firms. Each one starts with a plain definition, then the formula when there is one, a worked example and the page to read next.

A

Average true range (ATR)

Indicators

Average true range (ATR) is a volatility indicator: the average of the true range over a set number of bars, usually 14. A bar's true range is the largest of its high minus its low and the distances from the previous close to the high and to the low, so gaps count.

FormulaTR = max(high − low, |high − previous close|, |low − previous close|); ATR = average of TR over n bars (Wilder's smoothing on most platforms)

ExampleA bar with a high of 105, a low of 100 and a previous close of 98 has a true range of max(5, 7, 2) = 7. With a 14-period ATR of 6.5, a stop at 2 × ATR sits 13 points from the entry.

B

Backtest

Backtesting

A backtest is a simulation of a trading strategy's rules on historical market data, used to estimate how those rules would have performed. Its result depends as much on the assumptions (costs, fills, data quality) as on the strategy, and it describes the past, not the future.

ExampleA strategy that makes 300 round trips in a backtest at a cost of 0.22% per round trip pays 300 × 0.22% = 66% of its position size in fees and slippage over the test, before any edge counts.

Bar close confirmation

Pine Script

Bar close confirmation means acting on a signal only once the bar that produced it has closed, so the signal can no longer change. In Pine Script, barstate.isconfirmed is true on a bar's final update, and TradingView alerts set to “Once Per Bar Close” fire only then.

ExampleOn a 15-minute chart of a market that trades around the clock, a bar-close alert can fire at most 24 × 4 = 96 times a day, each one up to 15 minutes after the move that caused it began.

C

Contract for difference (CFD)

Forex and CFDs

A contract for difference (CFD) is a leveraged derivative that pays the difference between the opening and closing price of an underlying asset, without owning the asset. The result is the price change times the position size, and the broker usually charges a spread and overnight financing.

FormulaProfit or loss = (exit price − entry price) × size × value per point (the other way round for a short)

ExampleBuying 2 index CFDs worth $1 per point at 18,000 and selling them at 18,150 makes (18,150 − 18,000) × 2 × $1 = $300, before the spread and financing.

NoteEuropean regulators found that 74–89% of retail CFD accounts typically lose money (ESMA, 2018).

Contract size

Forex and CFDs

Contract size is the quantity of the underlying asset in one lot of a symbol, set by the broker. In MetaTrader 5 it is SYMBOL_TRADE_CONTRACT_SIZE: 100,000 units of the base currency for a standard forex lot, and often 100 troy ounces for gold, though brokers differ.

ExampleWith a gold contract size of 100 oz, 0.5 lots is 50 oz, so a $2 move in the gold price changes the position's value by 50 × $2 = $100.

D

Daily loss limit

Prop firms

A daily loss limit is a prop firm rule that caps how much an account may lose in one trading day, usually including open (floating) losses. Firms measure it from the initial balance or from the day's starting balance or equity, and the day resets at a fixed server time.

FormulaLowest allowed equity today = day's reference level − limit % × (initial balance, or the reference level itself)

ExampleOn a $100,000 account with a 5% limit measured from the initial balance, a day that starts at $102,000 has a floor of $102,000 − $5,000 = $97,000. A $2,000 closed loss plus a $3,100 open loss takes equity to $96,900 and breaks the rule.

Data snooping

Backtesting

Data snooping is the bias that comes from testing many strategies or settings on the same data and keeping the best one: some will look significant by chance alone. The more variants are tried, the higher the bar a result must clear before it counts as evidence.

FormulaChance of at least one false positive = 1 − (1 − α)^N, for N independent tests at significance level α

ExampleTest 20 independent strategies that have no edge at the 5% significance level, and the chance that at least one looks significant is 1 − 0.95^20 = 64%.

Deflated Sharpe ratio

Performance

The deflated Sharpe ratio (Bailey and López de Prado, 2014) is the probability that a strategy's true Sharpe ratio is above the best Sharpe ratio expected from luck alone, given how many variants were tried, how long the backtest is, and the skew and fat tails of its returns. It corrects a backtest for selection bias.

FormulaDSR = Φ((SR − SR₀) × √(T − 1) ÷ √(1 − skew × SR + (kurtosis − 1) ÷ 4 × SR²)), with per-period Sharpe ratios and SR₀ the expected best Sharpe of N trials without skill

ExampleA Bitcoin moving-average setting with a Sharpe ratio of 0.94, picked from 25 tries on 2,130 daily returns (skew 0.74, kurtosis 13.1), faces a luck Sharpe of 0.83 and gets a deflated Sharpe ratio of 61%: it can't be told apart from luck at the 95% level.

Dollar-cost averaging (DCA)

Strategies

Dollar-cost averaging (DCA) is buying a fixed amount of money's worth of an asset at regular intervals, whatever the price. The same amount buys more units when the price is low, so the average cost per unit is at or below the simple average of the purchase prices.

FormulaAverage cost = total amount spent ÷ total units bought

Example$100 of bitcoin at $50,000 buys 0.002 BTC and $100 at $40,000 buys 0.0025 BTC: the average cost is $200 ÷ 0.0045 = $44,444.44, below the simple average of $45,000.

NoteCrypto bots also call “DCA” adding to a losing position at set price steps (safety orders), which is averaging down rather than buying on a schedule.

E

Expectancy

Performance

Expectancy is the average amount a strategy is expected to make or lose per trade, combining how often it wins with how much it wins and loses. A positive expectancy after costs is the minimum condition for a strategy to make money over many trades.

FormulaExpectancy = win rate × average win − loss rate × average loss

ExampleA strategy that wins 40% of the time, makes $300 on average when it wins and loses $150 when it loses has an expectancy of 0.4 × $300 − 0.6 × $150 = $30 per trade.

Expert Advisor (EA)

MetaTrader 5

An Expert Advisor (EA) is a program written in MQL5 (MQL4 on MetaTrader 4) that runs on a chart in MetaTrader and can analyse prices and open, modify and close trades automatically. It reacts to events such as OnTick(), which runs on every new price of its symbol.

ExampleAn EA that acts only when a new 1-hour bar opens makes at most 24 decisions a day on a market that trades around the clock, however many ticks arrive in between.

F

Fill or Kill (FOK) and Immediate or Cancel (IOC)

Execution

Fill or Kill (FOK) and Immediate or Cancel (IOC) are order filling policies: FOK executes the full volume at once or cancels the whole order, while IOC fills whatever volume is available immediately and cancels the rest. In MetaTrader 5 the symbol sets which policies are allowed, and asking for another one returns error 10030.

ExampleA 5-lot buy arrives when only 3 lots are available at the price: with FOK nothing is filled; with IOC 3 lots are filled and the remaining 5 − 3 = 2 lots are cancelled.

Funding rate

Crypto derivatives

The funding rate is a periodic payment between the long and short holders of a perpetual futures contract that keeps its price close to the spot price: when the rate is positive, longs pay shorts, and when it is negative, shorts pay longs. Most exchanges settle it every 8 hours, some contracts every 4 hours or every hour.

FormulaFunding payment = position notional × funding rate, at each settlement

ExampleA $10,000 long at a funding rate of 0.01% every 8 hours pays $10,000 × 0.01% = $1 per settlement, $3 a day, or $1,095 over 365 days if the rate stays there.

G

Grid trading

Strategies

Grid trading is a strategy that places buy and sell limit orders at fixed intervals inside a price range, buying as the price falls and selling as it rises. It earns on swings inside the range, but a long grid ends up fully invested if the price falls through the bottom and fully in cash if the price rises through the top.

FormulaGeometric grid: line k = lower × (upper ÷ lower)^(k ÷ grids); spacing = (upper ÷ lower)^(1 ÷ grids) − 1

ExampleA geometric grid from 90 to 110 with 20 grids spaces its lines (110 ÷ 90)^(1/20) − 1 = 1.01% apart. With a 0.1% fee on each fill, a completed grid nets about 1.01% − 0.2% = 0.81% of the capital it used.

H

Hedging and netting accounts

MetaTrader 5

Hedging and netting are the two position-accounting modes of MetaTrader 5 accounts. A hedging account can hold several positions on one symbol, including opposite ones; a netting account holds one position per symbol, so an opposite order reduces, closes or reverses it.

ExampleBuy 1.0 lot of EURUSD, then sell 0.4 lots: a netting account shows one long position of 1.0 − 0.4 = 0.6 lots; a hedging account shows two positions, 1.0 lot long and 0.4 lots short, with the same 0.6-lot net exposure.

I

Isolated and cross margin

Crypto derivatives

Isolated margin limits the collateral of a futures position to the margin assigned to it, so a liquidation can only take that amount. Cross margin lets positions draw on the whole available balance of the account, which pushes liquidation further away but puts the entire balance at risk.

ExampleWith $1,000 isolated on a position in a $5,000 account, a liquidation costs at most that $1,000 (plus fees); on cross margin the same position can lose up to the full $5,000 before it is closed.

K

Kelly criterion

Risk

The Kelly criterion gives the fraction of capital to risk on each bet that maximises long-run growth when the win rate and payoff are known. Traders usually treat it as an upper bound and apply half or quarter Kelly, because real win rates and payoffs are only estimates.

Formulaf* = W − (1 − W) ÷ b, with W the win rate and b the average win ÷ average loss

ExampleA 50% win rate with wins 1.5 times the size of losses gives f* = 0.5 − 0.5 ÷ 1.5 = 0.1667: full Kelly risks 16.7% per trade and half Kelly 8.3%.

L

Leverage

Risk

Leverage is the ratio between the size of a position and the money backing it. Account leverage (for example 1:30) is the maximum a broker allows; effective leverage, the position's notional value divided by account equity, measures the risk actually taken.

FormulaEffective leverage = total position notional ÷ equity

ExampleOne standard lot of EURUSD at 1.0850 is worth €100,000 × 1.0850 = $108,500. Held in a $5,000 account, its effective leverage is 108,500 ÷ 5,000 = 21.7×.

NoteRetail CFD clients in the EU and the UK are limited to 30:1 on major currency pairs.

Liquidation price

Crypto derivatives

The liquidation price is the price at which an exchange forcibly closes a leveraged futures position because its margin has fallen to the maintenance margin requirement. Exchanges check it against the mark price, not the last trade, and the higher the leverage, the closer it sits to the entry price.

FormulaIsolated long ≈ entry × (1 − 1 ÷ leverage + maintenance rate); isolated short ≈ entry × (1 + 1 ÷ leverage − maintenance rate)

ExampleA 10× isolated long on bitcoin at $100,000 with a 0.5% maintenance margin rate is liquidated near $100,000 × (1 − 0.1 + 0.005) = $90,500, a fall of 9.5%.

Look-ahead bias

Backtesting

Look-ahead bias is a backtest error in which the simulated strategy uses information that would not have been available at the time of the trade, such as a bar's close before the bar has finished or a higher-timeframe value that is still forming. It makes results look far better than anything that can be traded.

ExampleIn Edgoro's crypto scalping study, a rule allowed to peek at the next candle won 98.4% of its trades; the same rule limited to information actually available won 49%.

Lot

Forex and CFDs

A lot is the standard unit of trade size on forex and CFD platforms. A standard lot is 100,000 units of the base currency, a mini lot 10,000 and a micro lot 1,000; for other symbols, the broker's contract size defines what one lot holds.

Example0.25 lots of EURUSD is 0.25 × 100,000 = €25,000, worth $27,125 at 1.0850, and it moves $2.50 per pip.

M

Magic number

MetaTrader 5

A magic number is an integer an MQL5 Expert Advisor attaches to every order it sends, so it can later recognise its own orders, deals and positions among everything on the account. Two EAs on the same account should use different magic numbers.

ExampleTwo EAs trade EURUSD on one hedging account, one with magic number 1001 and the other with 1002: each filters positions by its own number, so neither closes the other's trades.

Margin

Risk

Margin is the collateral a broker or exchange sets aside from an account to open and hold a leveraged position. It equals the position's notional value divided by the leverage; the rest of the equity is free margin.

FormulaRequired margin = notional ÷ leverage; free margin = equity − used margin

ExampleOne lot of EURUSD at 1.0850 ($108,500 notional) at 1:30 requires 108,500 ÷ 30 = $3,616.67 of margin, which leaves $1,383.33 of free margin in a $5,000 account.

Margin call

Risk

A margin call is the broker's warning that account equity has fallen close to the margin needed to keep positions open, measured by the margin level (equity ÷ used margin × 100%). The broker sets the threshold, often 100%, and usually blocks new positions below it.

FormulaMargin level = equity ÷ used margin × 100%

ExampleWith $3,616.67 of margin in use, equity of $5,000 gives a margin level of 5,000 ÷ 3,616.67 = 138%. At a 100% margin call level, the warning comes when equity falls to $3,616.67.

Martingale

Strategies

Martingale is a position-sizing method that multiplies the size of the next trade, usually by two, after each loss, so that one win recovers all the previous losses plus the first target. Losses grow geometrically during a losing streak, and a long enough streak empties the account.

FormulaSize at level k = starting size × multiplier^(k − 1)

ExampleStarting at 0.01 lots and doubling, the sixth trade is 0.32 lots, and six losses in a row add up to 0.01 + 0.02 + 0.04 + 0.08 + 0.16 + 0.32 = 0.63 lots. With a 20-pip stop at $10 per pip per lot, that is 0.63 × 20 × $10 = $126, 63 times the first trade's $2 risk.

Maximum drawdown

Performance

Maximum drawdown is the largest fall in an account's or a strategy's equity from a peak to a later trough, expressed as a percentage of the peak. Because losses compound, recovering from a drawdown takes a larger percentage gain than the loss.

FormulaMaximum drawdown = (peak − trough) ÷ peak; gain needed to recover = drawdown ÷ (1 − drawdown)

ExampleEquity that peaks at $12,000 and falls to $9,000 has a drawdown of 3,000 ÷ 12,000 = 25% and needs a gain of 0.25 ÷ 0.75 = 33.3% to get back to the peak. A 50% drawdown needs 100%.

Mean reversion

Strategies

Mean reversion is a family of strategies that bet a price will move back toward an average after stretching away from it, for example buying a close far below a moving average or a lower Bollinger Band. These strategies tend to win often and lose big when a stretch turns into a trend, so they need an exit for that case.

ExampleWith a 20-period average of 100 and a standard deviation of 2, the lower Bollinger Band (2 standard deviations) is 100 − 2 × 2 = 96: a close at 95.5 would be a mean-reversion buy signal, targeting a move back toward 100.

Monte Carlo simulation

Risk

A Monte Carlo simulation in trading generates thousands of possible equity curves by randomly resampling or reshuffling trade outcomes. It shows the range of results and drawdowns a strategy could produce, rather than the single path of one backtest.

ExampleIf 500 of 10,000 simulated paths of a strategy's next 200 trades reach a 30% drawdown, the estimated chance of a drawdown that deep is 500 ÷ 10,000 = 5%.

Moving average (SMA and EMA)

Indicators

A moving average smooths prices by averaging the last n values, recalculated on every bar. The simple moving average (SMA) weights each value equally; the exponential moving average (EMA) gives more weight to recent prices through a smoothing factor of 2 ÷ (n + 1).

FormulaSMA = sum of the last n closes ÷ n; EMA = α × close + (1 − α) × previous EMA, with α = 2 ÷ (n + 1)

ExampleCloses of 10, 11 and 12 give a 3-period SMA of 11. For a 10-period EMA, α = 2 ÷ 11 = 0.1818: if the previous EMA is 100 and the close is 111, the new EMA is 100 + 0.1818 × 11 = 102.

O

Opening range breakout (ORB)

Strategies

An opening range breakout (ORB) strategy marks the high and low of the first minutes of a session, often 5, 15 or 30 minutes, and trades a break above the high or below the low, usually with a stop on the other side or in the middle of the range.

ExampleIf the first 30 minutes after the open trade between 4,505 and 4,520, the range is 15 points. A long above 4,520 with a stop at the midpoint, 4,512.5, risks 7.5 points, and a 2R target sits at 4,520 + 15 = 4,535.

Out-of-sample testing

Backtesting

Out-of-sample testing measures a strategy on data that was held back while the strategy was designed and tuned (the in-sample data). Performance usually drops out of sample, and the size of the drop shows how much of the in-sample result came from fitting.

ExampleIn Edgoro's Bitcoin walk-forward test, the settings chosen in each training window averaged an in-sample Sharpe ratio of 1.44 and 0.22 on the next six months: only 0.22 ÷ 1.44 = 15% of the in-sample figure survived.

Overfitting

Backtesting

Overfitting, or curve fitting, is tuning a strategy so closely to past data that it captures noise rather than a repeatable pattern. An overfit strategy looks excellent on the data it was tuned on and disappoints on new data; the more rules, parameters and tries, the higher the risk.

ExampleBailey, Borwein, López de Prado and Zhu (2014) show that trying only 10 variants of a strategy with no real edge on one year of data is expected to produce a best in-sample Sharpe ratio of 1.57.

P

Perpetual futures

Crypto derivatives

A perpetual futures contract is a crypto derivative with no expiry date that tracks the spot price through a periodic funding payment between longs and shorts. Traders post margin and can use leverage, and a position stays open until it is closed or liquidated.

ExampleA long of 0.1 BTC on a perpetual at $100,000 has a notional value of $10,000. At 10× leverage it needs $1,000 of initial margin, and a 1% price move changes its value by $100, or 10% of that margin.

Pine Script

Pine Script

Pine Script is TradingView's programming language for indicators, strategies and libraries that run on TradingView charts. A script runs once per bar, from the oldest bar to the newest, then again on each real-time update; the current version is v6, declared with //@version=6.

ExampleOn a chart with 5,000 bars of history, a script's code runs 5,000 times when it loads, once per bar, before it starts updating on live prices.

Pip

Forex and CFDs

A pip is the conventional unit of price movement in forex: 0.0001 for most currency pairs and 0.01 for pairs quoted in Japanese yen. Brokers that quote an extra decimal show tenths of a pip, called pipettes.

ExampleEURUSD moving from 1.0850 to 1.0875 is a move of 0.0025 ÷ 0.0001 = 25 pips; USDJPY moving from 150.20 to 150.65 is 0.45 ÷ 0.01 = 45 pips.

Pip value

Forex and CFDs

Pip value is the money gained or lost when a position moves by one pip, in the account currency. When the pair's quote currency is the account currency it is the pip size times the units; otherwise it is converted at the current exchange rate.

FormulaPip value = pip size × units (÷ price when the account currency is the pair's base currency, as for USDJPY on a USD account)

ExampleOne standard lot of EURUSD (100,000 units) is worth 100,000 × 0.0001 = $10 per pip; one lot of USDJPY at 150.00 is worth 100,000 × 0.01 ÷ 150 = $6.67 per pip.

Point

MetaTrader 5

In MetaTrader 5, a point is the smallest price increment of a symbol (_Point in MQL5): 0.00001 on a five-digit EURUSD quote, so 10 points make one pip. On index CFDs, traders also say “point” for a move of 1.0 in the index.

ExampleEURUSD moving from 1.08505 to 1.08520 is 0.00015 ÷ 0.00001 = 15 points, or 1.5 pips; a stop of 200 points on that symbol is 20 pips.

Position sizing

Risk

Position sizing is choosing how large each trade is. The fixed fractional method sizes every trade so that hitting the stop-loss loses a set percentage of the account, which ties the size to the stop distance rather than to conviction.

FormulaSize = (account × risk %) ÷ (stop distance × value per unit of distance)

ExampleRisking 1% of a $10,000 account ($100) with a 50-pip stop on EURUSD, at $10 per pip per lot, gives 100 ÷ (50 × 10) = 0.2 lots.

Profit factor

Performance

Profit factor is a strategy's gross profit divided by its gross loss over a set of trades. A profit factor above 1 means the trades made money overall, and below 1 that they lost money; it says nothing about how many trades produced the result.

FormulaProfit factor = sum of winning trades ÷ |sum of losing trades|

ExampleWinning trades totalling $15,000 and losing trades totalling $10,000 give a profit factor of 15,000 ÷ 10,000 = 1.5 and a net profit of $5,000.

Prop firm challenge

Prop firms

A prop firm challenge is a paid evaluation in which a trader must reach a profit target on a demo or simulated account without breaking loss limits and other rules, in exchange for access to a larger funded account with a profit split. Only the target is about making money; the other rules limit how much and how fast the account may lose.

ExampleA $100,000 challenge with a 10% target, a 5% daily loss limit and a 10% maximum loss asks for $10,000 of profit without ever losing $5,000 in a day or $10,000 in total.

R

Relative Strength Index (RSI)

Indicators

The Relative Strength Index (RSI), developed by J. Welles Wilder, is a momentum oscillator that compares the size of recent gains with recent losses on a scale of 0 to 100, usually over 14 bars. Readings above 70 are often called overbought and below 30 oversold, though in strong trends RSI can stay there for a long time.

FormulaRSI = 100 − 100 ÷ (1 + RS), with RS = average gain ÷ average loss over n bars

ExampleAn average gain of 1.2 and an average loss of 0.8 give RS = 1.5 and RSI = 100 − 100 ÷ 2.5 = 60.

Repainting

Pine Script

Repainting is when an indicator or strategy shows signals on historical bars that it would not have shown in real time, because it used values that were still changing or not yet known. A repainting script looks better on the chart and in backtests than it behaves live.

ExampleOn a 15-minute chart, each 1-hour bar spans 60 ÷ 15 = 4 chart bars, and its value keeps changing until the last of them closes. A script that reads the hourly close before then can flash signals that later vanish, while the history shows only the final value.

request.security()

Pine Script

request.security() is the Pine Script function that fetches data from another symbol or timeframe, such as a daily moving average on an hourly chart. Used naively on a higher timeframe, it returns values that are still forming in real time, a common cause of repainting.

FormulaNon-repainting pattern: request.security(syminfo.tickerid, "D", close[1], lookahead = barmerge.lookahead_on)

ExampleOn a 1-hour chart of a market that trades around the clock, one daily bar spans 24 chart bars. With close[1] and lookahead_on, all 24 of them see the previous day's confirmed close, both in history and live.

Risk of ruin

Risk

Risk of ruin is the probability that a run of losses takes an account down to a level where trading has to stop, given the strategy's win rate, its payoff and the amount risked per trade. It rises steeply as the risk per trade increases.

FormulaFor even-money bets of a fixed amount: risk of ruin = (loss rate ÷ win rate)^units, where units = capital ÷ amount risked per bet

ExampleWith a 55% win rate on 1:1 trades, risking a fixed 10% of the starting capital (10 units) gives (0.45 ÷ 0.55)^10 = 13.4% risk of ruin; risking 5% (20 units) cuts it to 1.8%.

Risk/reward ratio

Risk

The risk/reward ratio compares how much a trade stands to lose at its stop-loss with how much it stands to gain at its target. It sets the win rate needed to break even: the larger the reward relative to the risk, the lower that win rate.

FormulaBreak-even win rate = risk ÷ (risk + reward), before costs; (risk + cost) ÷ (risk + reward) after costs

ExampleA 50-pip stop with a 100-pip target is 1:2 and breaks even at 50 ÷ 150 = 33.3% winners; with 2 pips of round-trip cost, the break-even rises to (50 + 2) ÷ 150 = 34.7%.

R-multiple

Performance

An R-multiple expresses a trade's result as a multiple of its initial risk (R), the amount that would have been lost at the stop-loss. It lets trades of different sizes and markets be compared, and a strategy's expectancy can be stated in R.

FormulaR-multiple = trade profit or loss ÷ initial risk

ExampleA trade that risked $200 and made $500 is +2.5R; one that hit its stop and lost $200 plus $20 of slippage is −1.1R.

Round-trip cost

Execution

Round-trip cost is everything a trade pays to get in and out: commissions or exchange fees on both fills, the spread and slippage. It is paid on every trade, win or lose, so it weighs most on strategies that trade often or aim for small moves.

FormulaRound trip (in % of price) = 2 × (fee per side + slippage per side), plus the spread where the fill price doesn't already include it

ExampleA 0.10% exchange fee and 0.01% of slippage on each side cost 2 × (0.10% + 0.01%) = 0.22% per round trip, so 5 trades a day cost about 1.1% of the position every day.

S

Scalping

Strategies

Scalping is a trading style that aims for many small profits from very short holding periods, from seconds to a few minutes. Because each target is small, trading costs take a large share of every trade, and a scalping strategy needs moves big enough to cover them.

ExampleIn Edgoro's 1-minute crypto study, even a bot with perfect foresight of the next candle averaged 0.066% per trade, against a retail round-trip cost of 0.22%: it would lose 0.22% − 0.066% = 0.154% per trade.

Sharpe ratio

Performance

The Sharpe ratio measures return per unit of volatility: the average return above the risk-free rate divided by the standard deviation of returns, usually annualised. It lets strategies with different risk levels be compared, but it treats upside and downside swings alike and is inflated by selection and short samples.

FormulaAnnualised Sharpe = (mean periodic return − risk-free rate) ÷ standard deviation of periodic returns × √(periods per year)

ExampleMonthly returns averaging 1% with a standard deviation of 4% and a risk-free rate of zero give an annualised Sharpe ratio of 1 ÷ 4 × √12 = 0.87.

NoteThe Sortino ratio uses only the downside deviation in the denominator, so upside volatility isn't penalised.

Slippage

Execution

Slippage is the difference between the price a trade was expected to fill at and the price it actually filled at. It happens with market and stop orders when the price moves or liquidity is thin, and in fast markets it is usually against the trader.

ExampleA buy stop at 1.1000 on EURUSD that fills at 1.1003 slips 3 pips; on 2 standard lots at $10 per pip per lot, that costs 3 × 2 × $10 = $60.

Spread

Execution

The spread is the difference between the ask (the price you buy at) and the bid (the price you sell at). Every position starts with a loss equal to the spread, so it is a cost on every round trip, and it widens around news and at session opens.

FormulaSpread = ask − bid

ExampleEURUSD quoted at 1.08500 bid and 1.08512 ask has a spread of 0.00012, or 1.2 pips: $12 per round trip on one standard lot.

Stop-loss

Execution

A stop-loss is an order that closes a position when the price reaches a set level, to cap the loss on a trade. It usually becomes a market order when triggered, so it can fill worse than its level in a gap or a fast market.

ExampleA long at 1.0850 with a stop-loss at 1.0820 risks 30 pips; on 0.5 lots at $10 per pip per lot, that is 30 × 0.5 × $10 = $150 before slippage.

Stop out

Risk

A stop out is the broker's automatic closing of positions when the margin level falls to the stop-out level, usually starting with the position that has the largest loss, so the account doesn't go negative. Providers must close out EU retail CFD positions by the time equity falls to 50% of the required margin (ESMA, 2018).

FormulaStop-out equity = used margin × stop-out level

ExampleWith $3,616.67 of margin in use and a 50% stop-out level, positions are closed when equity reaches $1,808.33: from $5,000 of equity, a loss of $3,191.67, about 319 pips on one lot of EURUSD.

Stops level

MetaTrader 5

The stops level is the minimum distance, in points, that a MetaTrader 5 broker requires between the current price and a new stop-loss, take-profit or pending order (SYMBOL_TRADE_STOPS_LEVEL). Orders placed closer are refused with error 10016, invalid stops.

ExampleWith a stops level of 30 points on a five-digit EURUSD quote, the minimum distance is 30 × 0.00001 = 0.00030, or 3 pips: a stop-loss 2 pips from the price is refused.

Survivorship bias

Backtesting

Survivorship bias is testing a strategy only on assets that still exist or still matter today, leaving out those that were delisted, went bankrupt or faded away. The missing assets are often the worst performers, so results look better than what a trader could have achieved at the time.

ExampleIf 100 coins were in a crypto index in 2021 and 40 have since been delisted or collapsed, a backtest on the 60 still listed today ignores 40 ÷ 100 = 40% of the coins a trader could actually have picked.

Swap (rollover)

Forex and CFDs

A swap, or rollover, is the overnight financing charge or credit applied to forex and CFD positions held past the broker's daily rollover time. It reflects the interest-rate difference between the two currencies plus the broker's markup, and many brokers apply three days' swap on one weekday, often Wednesday, to cover the weekend.

ExampleHolding 2 lots for one week (five rollovers, one of them triple) at a swap of −$7.50 per lot per night costs 2 × $7.50 × 7 = $105.

T

Tick size and tick value

Forex and CFDs

Tick size is the smallest price change a contract can make, and tick value is what one tick is worth for one contract or lot, in the account currency. In MetaTrader 5 they are SYMBOL_TRADE_TICK_SIZE and SYMBOL_TRADE_TICK_VALUE, and risk-based lot sizing should use them rather than assume a pip value.

FormulaProfit or loss = (price change ÷ tick size) × tick value × contracts

ExampleThe CME E-mini S&P 500 future has a tick size of 0.25 index points worth $12.50, so a 10-point move is 40 ticks, or 40 × $12.50 = $500 per contract.

Trailing and static drawdown

Prop firms

A static drawdown limit fixes an account's lowest allowed level at the start, for example 10% below the starting balance. A trailing drawdown limit moves up with the highest balance or equity reached, so open profit that is later given back can still have raised the floor.

ExampleOn a $100,000 account, a 10% static limit keeps the floor at $90,000. A 6% trailing limit starts at $94,000 and, once equity has peaked at $104,000, sits at $104,000 − $6,000 = $98,000.

Trailing stop

Execution

A trailing stop is a stop-loss that follows the price at a set distance as a trade moves in its favour and never moves back. It locks in part of an open profit while letting the trade run.

ExampleA long from 1.1000 with a 50-pip trailing stop starts with its stop at 1.0950. If the price rises to 1.1080, the stop moves to 1.1080 − 0.0050 = 1.1030, locking in 30 pips.

Trend following

Strategies

Trend following is a family of strategies that buy assets that have been rising and sell or avoid those that have been falling, for example holding only while the price is above a long moving average. It typically loses on most trades and gets its result from a few long trends.

ExampleIn Edgoro's 200-day moving average study, the filter lost money on 25 of its 33 round trips on BTC (25 ÷ 33 = 76%), yet returned +602.6% against +572.7% for buying and holding over the same period.

V

VWAP (volume-weighted average price)

Indicators

The volume-weighted average price (VWAP) is the average price of all trades over a period, usually one session, weighted by the volume traded at each price. Intraday traders use it as a reference for fair value, and institutions as a benchmark for their executions.

FormulaVWAP = Σ(price × volume) ÷ Σ volume (charts use each bar's typical price, (high + low + close) ÷ 3)

Example10 shares at $100 and 30 shares at $102 give a VWAP of (1,000 + 3,060) ÷ 40 = $101.50, closer to $102 because more volume traded there.

W

Walk-forward analysis

Backtesting

Walk-forward analysis tests a strategy's optimisation process by repeatedly tuning parameters on one window of data and trading them unchanged on the next, then moving both windows forward. Only the chained out-of-sample results count.

FormulaWalk-forward efficiency = annualised out-of-sample return ÷ annualised in-sample return

ExampleIn Edgoro's Bitcoin test (24-month training windows, 6-month test windows), an out-of-sample return of 20.8% a year against 82.1% in sample gives a walk-forward efficiency of 20.8 ÷ 82.1 = 0.25.

Webhook alert

Pine Script

A webhook alert is a TradingView alert that, when it fires, sends an HTTP POST request carrying the alert message to a URL you choose, so another program, such as a trading bot, can act on it. TradingView requires two-factor authentication and a paid plan for webhooks, and sends them only to ports 80 and 443.

ExampleAn alert message such as {"action": "buy", "symbol": "BTCUSDT", "qty": 0.01} reaches your server as the body of the POST request; a bot that reads it buys 0.01 BTC, worth $1,000 at $100,000.

Win rate

Performance

Win rate is the share of trades that close with a profit. On its own it says little: a strategy can win most of its trades and still lose money if its losses are larger than its wins, and the win rate needed to break even depends on the risk/reward ratio.

FormulaWin rate = winning trades ÷ total trades

Example45 winners out of 120 trades is a 37.5% win rate. With wins twice the size of losses, that beats the 1 ÷ 3 = 33.3% needed to break even before costs.

Where the numbers come from

The arithmetic of every worked example on this page is recomputed by an automated test, and the examples taken from Edgoro's studies use the exact figures of the published posts. For figures from regulators and peer-reviewed research, such as how many retail CFD accounts lose money or how often backtested edges survive on new data, see our algorithmic trading statistics, each checked against its primary source.

Missing a term, or found a mistake? Write to us through the contact page and we'll add or correct it.

Trading involves substantial risk of loss and is not suitable for every investor. Edgoro is a software tool, not a broker or financial adviser: nothing it produces is investment advice, and past or backtested performance does not guarantee future results.

Put the terms to work

Describe a strategy in plain English and Edgoro writes it as a TradingView indicator in Pine Script v6 or a MetaTrader 5 Expert Advisor, with the stop-loss, position sizing and loss limits defined above. Every first purchase is covered by a 7-day money-back guarantee.

Build your strategy with Edgoro