Skip to content

Strategy trade size scaling#

About#

Using this setting you can configure how the trade signal volume is transformed to match the subscriber account.

Fields#

Name Type Required Description
mode string Yes If set to balance, the trade size on strategy subscriber will be scaled according to balance to preserve risk. If set to equity, the trade size on strategy subscriber will be scaled according to subscriber equity. If value is none, then trade size will be preserved irregardless of the subscriber balance. If value is contractSize, then trade size will be scaled according to contract size. If fixedVolume is set, then trade will be copied with a fixed volume of tradeVolume setting. If fixedRisk is set, then each trade will be copied with a trade volume set to risk specific fraction of balance as configured by riskFraction setting. Note, that in fixedRisk mode trades without a SL are not copied. If expression is set, then trade volume will be calculated using a user-defined expression. Note, that expression trade size scaling mode is intended for advanced users and we DO NOT RECOMMEND using it unless you understand what are you doing, as mistakes in expression can result in loss. Default is balance. Allowed values: none, contractSize, balance, equity, fixedVolume, fixedRisk, expression
tradeVolume number Fixed trade volume for use with fixedVolume trade size scaling mode
riskFraction number Fixed risk fraction for use with fixedRisk trade size scaling mode
forceTinyTrades boolean If set to true, that trades smaller than minVolume - 0.5 * volumeStep will be placed with minVolume volume, in spite that they will result in increased trade risk, as long as risk increase is in line with maxRiskCoefficient configuration. Othersite such trades will be skipped to avoid taking excessive trade risk. Default is false.
maxRiskCoefficient number Sometimes when placing a small trade, the risk taken can exceed the subscription expectation due to volume rounding or forcefully placing tiny trades in accordance with forceTinyTrades setting. The maxRiskCoefficient setting will act as an extra line of protection to restrict trades if actual risk exceeds the value of expected subscription risk multiplied by maxRiskCoefficient. As a result trade volume will be decreased correspondingly or trade will be skipped if resulting volume is less than minVolume. Default value is 5, minimum value is 1.
expression string math.js expression which will be used to calculate trade volume (see https://mathjs.org/docs/expressions/syntax.html). Following variables are available in expression scope: providerVolume - provider signal trade size; providerTradeAmount - provider signal trade value in trade copier base curency; multiplier - subscription multiplier value; providerBalance - provider balance value in trade copier base currency; balance - subscriber balance value in trade copier base currency; quoteOrOpenPrice - current asset price (for market orders) or open price (for pending orders) on subscriber side; tickValue - current asset tick value on subscriber side expressed in trade copier base currency; tickSize - tick size on subscriber side; providerScaledVolume - provider trade volume multiplied by provider contract size; contractSize - subscriber contract size; providerStopLoss - provider signal stop loss price; providerTakeProfit - provider signal take profit price; accountCurrencyExchangeRate - subscriber exchange rate of account currency to trade copier base currency

Please note that for any of the above modes, after applying trade size scaling mode you can further adjust trade size by slave using subscription multiplier setting.

Examples#

Scale trade size by balance. E.g. if the master has balance of $10K and trading 0.01 lot the trade will be scaled to 0.1 lot for a slave with $100K balace.

{
  "mode": "balance"
}

Preserve trade size regardless of the balance or symbol contract size.

{
  "mode": "none"
}

Scale trade size by contract size. E.g. if master account has contract size of 10K for a symbol traded with 0.1 lot and slave has contract size of 100K, then slave will trade 0.01 lot.

{
  "mode": "contractSize"
}

Set fixed trade size of 0.05 lots regardless of the master trade size.

{
  "mode": "fixedVolume",
  "tradeVolume": 0.05
}

Scale trade size so that each trade of slave takes a fixed risk of 2% of available balance.

{
  "mode": "fixedRisk",
  "riskFraction": 0.02
}

Scale trade size so that volume on subscriber is set according to balance ratio regardless of the risk size.

{
  "mode": "expression",
  "expression": "providerVolume * balance / providerBalance * multiplier" 
}

Usages#