The general way of configuring the size of each order is done via the Order Size
input under the Properties
tab of the strategy settings panel:
This Properties
tab is provided by TradingView automatically for all strategy scripts, and the settings therein is what the strategy uses by default to size each order it makes.
Unfortunately TradingView does not provide a way for you to configure how much of your equity you are willing to risk per trade. (The equity is the sum of the initial capital, net profit, and unrealised profit/loss).
We can work around this 'limitation' by creating our own setting for this, and ignore whatever the Order Size
is set to under the Properties
tab. By enabling the Activate Custom 'Order Size' Settings
checkbox, you tell the strategy to ignore whatever is set in the Order Size
input under the Properties
tab, and instead use the Order Size
settings provided below.
Each strategy script provides the following options for configuring a custom order size:
Let's review each of these options one by one.
The size of the order the strategy will use for each entry it makes.
Contracts
: Number of contracts/shares/lots/units to trade (e.g. setting this to 1 will result in the strategy buying/selling 1 BTC per order)Cash
: The amount of cash to use from your equity per order (e.g. setting this to 1000 will result in the strategy buying/selling $1000 worth of BTC per trade)% of equity
: The percentage of the strategy's equity to use per order (e.g. with an account size of $1000 and this set to 10, will result in the strategy buying/selling $100 worth of BTC per trade)% risk of equity
: The percentage of your account size you want to risk per trade.Fixed risk
: The maximum amount of cash to risk on each trade (to learn more about how the position size is calculated, please see above)All of these options are currency aware. For example, if you set order size to 1000, and you set the sizing type to Cash
, if your account's currency is set to GBP
, then the strategy will open positions in the value of £1000 (e.g. $1300) per order.
Imagine the following situation:
BTC/USD
chart on a 1 hour time frame, with 1 Bitcoin trading for $50,000% risk of equity
to 1% (i.e. $100 of your account), or you set a Fixed risk
of $100In order to buy 2 Bitcoins, you need $100,000, but you only have $10,000 on your account. How do you want the strategy to proceed?
You have the following options:
Allow infinitely large position size
: The strategy will assume that you have access to more money than what you have on your account (i.e. via leverage), and it will open a position for 2 Bitcoins. Risk will be $100 (1% of your account size).Limit position value to account size
: The strategy will assume that you don't have access to leverage, and it will open the biggest position you can afford ($10,000 / $50,000 = 0.2 BTC). Risk will be $10 (0.1% of your account size).Skip entry if can't afford desired position size
: The strategy will assume that you don't want to enter into a position, if in order to meet your risk settings you would have to take on a position bigger than your account size.The maximum % of equity
or Cash
the strategy should risk on any given trade. When set to 0, this config is ignored.
Think of this as a safety net. If you use an order sizing mechanism that doesn't control the risk (such as % of equity
), you are going to risk a random amount on each trade. However, if you configure a Max. Allowed Risk
of 100
Cash
for example, your position size will always be capped, so that you only risk at most $100 on each trade.
The maximum size of the position the strategy is allowed to take on any given order. When set to 0, this config is ignored.