TradersPost does not verify you have the buying power for an order and we depend on the broker accepting or rejecting the order based on your available buying power and the rules each broker implements surrounding buying power.
The position sizing features documented here are only for dynamically calculating quantities for entry orders and the FULL quantity of the open position is used for exit orders unless a quantity is explicitly sent in the signal and Allow signal override is checked next to the quantity settings in the strategy subscription. You can read more about what can be sent in signals in the Webhooks page.
Amount per position
The Amount per position feature allows you to configure a fixed dollar amount to be used to calculate the quantity for your entry order.
quantity = amountPerPosition / entryPrice
Here is an example of how you can control this feature from the webhook JSON. This example would calculate a quantity of 10 with an entry limit price of $100 and an amount per position of $1000.
{
"ticker": "TSLA",
"action": "buy",
"orderType": "limit",
"limitPrice": 100,
"quantityType": "dollar_amount",
"quantity": 1000
}
Risk per position
The Risk per position feature allows you to configure a fixed risk dollar amount to be used to calculate the quantity for your entry order. This setting requires a stop loss to be configured.
difference = entryPrice - stopLossPrice
quantity = riskPerPosition / difference
Here is an example of how you can control this feature from the webhook JSON. This example would calculate a quantity of 10 with an entry limit price of $100 and a stop loss stop price of $90 and a risk per position of $100. Since the most we want to lose is $100, then we can afford to buy 10 shares.
{
"ticker": "TSLA",
"action": "buy",
"orderType": "limit",
"limitPrice": 100,
"stopLoss": {
"type": "stop",
"stopPrice": 90
},
"quantityType": "risk_dollar_amount",
"quantity": 100
}
For options, the entry and stop loss prices are option prices and one contract has a multiplier of 100, so the difference is measured per contract:
difference = (entryPrice - stopLossPrice) * 100
An option bought at $4.25 with a stop loss at $4.04 risks $21 per contract, so a risk per position of $200 buys 9 contracts.
Percent of equity
The Percent of equity feature allows you to dynamically calculate an amount per position to use based on your total portfolio equity. This calculation does not use your total buying power/margin. It is only your total portfolio value minus any unrealized profits or losses.
portfolioValue = portfolioValue - unrealized
amountPerPosition = portfolioValue * percentOfPortfolioValue
quantity = amountPerPosition / entryPrice
If you want to use margin, you can use percentages that add up to greater than 100%. If you are trading 5 tickers, each with 25%, then you will use 125% of your total equity which will require some margin.
Here is an example of how you can control this feature from the webhook JSON. Assuming you have a $100000 account, this example would calculate a quantity of 10 with an entry limit price of $100 and a percent of equity 1%. If you have a $100000 account and you want to use 1% of it, then you have $1000 to spend which means at an entry limit price of $100, we will calculate a quantity of 10.
{
"ticker": "TSLA",
"action": "buy",
"orderType": "limit",
"limitPrice": 100,
"quantityType": "percent_of_equity",
"quantity": 1
}
The entryPrice variable in the above examples use the price from the signal if limit orders are configured and uses the latest quote price when using market orders.
If the signal does not have a price and limit orders are configured, then the latest quote price is used.
Fixed Quantity
If you don't want to dynamically calculate a quantity, you can use the fixed quantity feature. You can configure a fixed quantity in your strategy subscription settings or send it along in your webhook JSON. Here is an example that will buy 5 shares of TSLA.
{
"ticker": "TSLA",
"action": "buy",
"orderType": "market",
"quantity": 5
}
For entries, TradersPost will buy a quantity of 1 if no quantity is provided in the signal and no dynamic quantity calculation is configured in your strategy subscription settings.
For exits, TradersPost will exit the FULL quantity of the open position in the broker if you do not provide a quantity to exit in the signal.
Subtract exit quantity from signal quantity
Sometimes when you are flipping from one side to the other, for example long to short, you need to send the full quantity to exit the current open position and use the remaining quantity to enter a new position on the other side. Check the Subtract exit quantity from signal quantity checkbox to enable this behavior.
Now if you were long a quantity of 5, you can send a signal like the following to exit the 5 long and enter 3 short.
{
"ticker": "TSLA",
"action": "sell",
"sentiment": "bearish",
"quantity": 8
}
Use fractional quantity
By default TradersPost will round decimal quantity to a whole number. If you check the Use fractional quantity checkbox then we will pass the fractional quantity to the broker if the broker supports it. We will round the decimal to the number of decimal places the broker supports. You can read more about fractional shares here.
Forex units
Forex orders on OANDA are sized in units of the base currency, not lots. A quantity of 1000 on EUR/USD buys or sells 1,000 euros. A standard lot is 100,000 units, a mini lot 10,000, and a micro lot 1,000. TradersPost does not convert lots, so send units.
Units are whole numbers. A size with decimals is rounded down to a whole unit, and Use fractional quantity cannot be turned on for an OANDA subscription.
Amount per position, Risk per position, and Percent of equity use the currency your OANDA account is held in, and TradersPost converts the pair's price into that currency when the two differ. With Amount per position set to 1000 on a USD account and EUR/USD at 1.0800:
quantity = 1000 / 1.0800 = 925.9, rounded down to 925 units
Read more in Forex Trading.