Popular results
Position Sizer
Calculate risk-based position size directly in your MetaTrader platform and execute a trade in one click or a press of a button.What Is Forex
Learn what Forex is and how it works from this simple explanation.Supertrend
Download the Supertrend indicator for MT4 and MT5 to detect trend changes based on the price action.Position Size Calculator
Calculate your position size based on risk, stop-loss, account size, and the currencies involved. A simple online calculator for quick results.Position Sizer for cTrader
Table of contents
Position Sizer for cTrader is a cTrader version of our MetaTrader Position Sizer EA. The cTrader platform is not as popular as MetaTrader, but it is supported by quite a few brokers and some prop-firms.
This cBot calculates a position size in lots based on:
- Entry and stop-loss levels
- Risk tolerance
- Account size (balance, equity, or even your savings account)
- Account currency
- Currency exchange rates
cTrader Position Sizer is similar to its MetaTrader version and offers the following features:
- Works with any trading instruments: currency pairs, CFDs, shares, indices, commodities, cryptocurrencies.
- Drag-and-drop interface.
- Minimize or close the panel.
- Quickly change the panel's settings.
- Drag entry, stop-loss, and take-profit lines in the chart.
- Optional SL/TP as distance in points.
- Set SL and TP as multiples of ATR (Average True Range) for adaptive exits.
- See potential reward level and the risk-to-reward ratio.
- Switch between pending and instant orders.
- Reverse calculation: find out your risk based on the given position size.
- Risk and reward analysis of your portfolio.
- A Margin tab for margin-related calculations and info.
- Calculate the maximum position size based on free margin.
- Custom leverage for custom margin calculations.
- Information on swaps (overnight interest).
- Optional spread and point value display.
- The cBot automatically saves and loads its inputs on timeframe change or platform restart, preserving your configuration efforts.
- Click to trade based on the calculations.
- The calculated position can be divided into several trades with different take-profit levels.
- Supports stop limit orders.
- A dark mode option for less strain on your eyes.
- Completely free and open-source project.
Interface
Main tab
The main tab of the panel provides the primary control over the cBot's functions and serves to output the most important calculation results: the position size, risk, reward, and risk-to-reward ratio. The following controls and outputs are available:
- Direction arrow shows whether the current trade is long (▲) or short (▼).
- Version number.
- Spread value in ticks.
- Move button to enable dragging of the panel.
- Minimization button to fold down the panel.
- Close button to stop the cBot.
- Main tab switch — it is currently turned on.
- Risk tab switch — click on it to see the current and potential risk profile. The Risk tab interface is explained below.
- Margin tab switch — click on it to see everything related to required and free margin. The Margin tab interface is explained below.
- Swaps tab switch — click on it to see the details on the swaps for the current trading instrument. The Swaps tab interface is explained below.
- Trading tab switch — click on it to see the controls for trading operations. The Trading tab interface is explained below.
- Trade button can be displayed instead of the Entry label if the AdditionalTradeButtons parameter is set accordingly.
- Long/Short switch — enables you to quickly switch between long and short trade calculation. The trade direction can also be switched by pressing the Tab key on your keyboard.
- Entry input — grayed out when Instant order is used, can be used enter entry level when Pending order is set.
- Stop-loss button will set stop-loss level to a given default value. Visible only if a non-zero default stop-loss is set via SL input parameter.
- Stop-loss input.
- + button to quickly add another take-profit level.
- Take-profit button allows quick setting of TP to the multiple of the current SL value or to peg the TP level to the SL value.
- Take-profit multiplier, if set via input parameters, applies to the current SL value when Take-profit button is pressed.
- Take-profit input.
- Multiple take-profit input fields. Visible if TakeProfitsNumber input parameter is set to a value greater than 1 or if you add them via the panel.
- X button to quickly remove an extra take-profit level.
- Stop price input for stop limit orders.
- ATR Period — setting to use with the ATR-based SL/TP. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- ATR — current value of ATR with a given period. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- SL multiplier — multiplier for ATR-based stop-loss. The ATR value is multiplied by this value to produce the actual stop-loss distance. Set to zero to disable ATR-based stop-loss. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- TP multiplier — multiplier for ATR-based take-profit. The ATR value is multiplied by this value to produce the actual take-profit distance. Set to zero to disable ATR-based take-profit. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- Spread Adjustment for SL — if ticked, the spread value will be subtracted from or added to the stop-loss to make the distance count from the price the trade can be closed at. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- Spread Adjustment for TP — if ticked, the spread value will be subtracted from or added to the take-profit to make the distance count from the price the trade can be closed at. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- ATR timeframe — timeframe to calculate ATR on. Click the button to switch between timeframes. ATR options are visible only if ShowATROptions input parameter is set to Yes.
- Order type button to switch between Instant, Pending, and Stop Limit. You can also switch this by pressing the
o key on your keyboard. - Hide/show lines button to quickly switch the display of the Entry, Take-profit, and Stop-loss lines on the chart. You can also switch this by pressing the
h key on your keyboard. - Commission size per lot gets updated with the value of the commission charged by your broker per 1 standard lot.
- Account size button switches between balance, equity, and "Balance - CPR"; the latter being account balance less the current portfolio risk as calculated on the Risk tab.
- Account size in account currency units.
- Account size asterisk signals that the custom balance was set.
- Quick risk button #1 — first button to quickly set percentage risk value.
- Quick risk button #2 — second button to quickly set percentage risk value.
- Risk input — you can set your tolerated risk in percentage of the account size. If you set your risk via Risk money input, percentage risk will be calculated based on that input.
- Risk money input — you can set your tolerated risk in account currency units. If you set your risk via Risk percentage input, money risk will be calculated based on that input.
- Risk (result) — percentage risk calculated based on the actual position size allowed in your broker's platform.
- Risk money (result) — money risk calculated based on the actual position size allowed in your broker's platform.
- Reward in account currency is based on the position size calculated without taking into account the platform's restrictions.
- Reward (result) — reward in account currency is based on the actual position size allowed in your broker's platform.
- Reward/risk (input) — input reward divided by input risk.
- Reward/risk ratio (result) — reward result divided by risk result.
- Max PS button to set the position size to the maximum value possible based on the account's free margin. The button only appears if the ShowMaxPSButton input parameter is set to Yes.
- Position size — actual position size calculation output. You can modify it yourself if you want to calculate your risk based on position size.
- Point value per calculated position size.
Risk tab
The risk tab can help you assess current and potential risk and reward profile. Using a simple algorithm, the cBot calculates the risk of the currently open positions and pending orders based on their stop-loss levels (or lack thereof). It also assesses the potential reward of already opened positions and the position calculated by the cBot based on take-profit levels. The employed risk analysis method does not account for complex situations involving hedged orders and positions.
- Count pending orders — if ticked, the cBot will also attempt to calculate the risk of pending orders in addition to currently open positions.
- Ignore orders without stop-loss — if ticked, PS will ignore all risk coming from orders and positions without SL value set. Can be useful if you prefer not to set stop-loss for some of your trades.
- Ignore orders without take-profit — if ticked, PS will ignore all reward coming from orders and positions without TP value set. Can be useful if you prefer not to set take-profit for some of your trades.
- Ignore orders in other symbols — if ticked, will only calculate risk and reward for the current chart's symbol, ignoring all positions and orders in other symbols.
- Current portfolio risk (currency) — shows the risk in currency units without the position that is currently being calculated by this robot.
- Potential portfolio risk (currency) — shows the risk in currency units as if you have already opened a position that is currently calculated by this robot.
- Current portfolio risk (%) — same as Current portfolio risk (currency) but in percentage to the account size.
- Potential portfolio risk (%) — same as Potential portfolio risk (currency) but in percentage to the account size.
- Current portfolio reward (currency) — shows the reward in currency units without the position that is currently being calculated by this robot.
- Potential portfolio reward (currency) — shows the reward in currency units as if you have already opened a position that is currently calculated by this robot.
- Current portfolio reward (%) — same as Current portfolio reward (currency) but in percentage to the account size.
- Potential portfolio reward (%) — same as Potential portfolio reward (currency) but in percentage to the account size.
- Current portfolio lots — the total size of the currently open positions in lots.
- Potential portfolio lots — the total size in lots of the open positions plus the one, which is currently being calculated by this robot.
- Current portfolio risk-to-reward ratio — the total risk-to-reward ratio on all existing trades.
- Potential portfolio risk-to-reward ratio — the total risk-to-reward ratio on all trades, including the one, which is currently being calculated by the Position Sizer for cTrader.
Margin tab
The margin tab provides information about the calculated position's margin, amount of used and available margin after opening the calculated position, and the biggest possible position size considering the current available margin and leverage.
- Position margin shows the margin that will be used for the calculated position. Negative value means that the future used margin will be lower than the current due to lower requirement for margin of the hedged positions.
- Future used margin is calculated based on the current used margin and position margin.
- Future free margin shows how much free margin you will have left after opening the calculated position.
- Custom leverage input lets you set your own leverage for all the margin calculations done by this robot.
- Default leverage shows the account's actual leverage for your reference.
- Symbol leverage shows the actual leverage for the current trading instrument. It is calculated based on required margin and contract size/value. It may be inaccurate in some cases.
- Maximum position size by margin displays the biggest trade you can take with your currently available free margin and leverage.
Swaps tab
The swaps tab displays details on the overnight interest payments associated with the current trading instrument and calculated position size. It shows swaps type, nominal swaps, daily, yearly, per lot, per calculated position size, and both for long and short positions:
- Type shows the type of swaps used by the broker for the current trading instrument. It can be either pips or percentage.
- Triple swap shows the day of week when triple swaps are charged/paid (to account for Saturday and Sunday).
- Nominal swaps (Long) — nominal swaps paid or charged by a broker for long positions.
- Nominal swaps (Short) — nominal swaps paid or charged by a broker for short positions.
- Daily swap per lot (Long) — daily swap paid or charged by a broker for long positions in account currency per lot.
- Daily swap per lot (Short) — daily swap paid or charged by a broker for short positions in account currency per lot.
- Daily swap per PS (Long) — daily swap paid or charged by a broker for long positions in account currency for calculated position size (on the Main tab).
- Daily swap per PS (Short) — daily swap paid or charged by a broker for short positions in account currency for calculated position size (on the Main tab).
- Yearly swap per lot (Long) — swap paid or charged by a broker for long positions in account currency per lot. Calculated for a period of 360 days.
- Yearly swap per lot (Short) — swap paid or charged by a broker for short positions in account currency per lot. Calculated for a period of 360 days.
- Yearly swap per PS (Long) — swap paid or charged by a broker for long positions in account currency for calculated position size (on the Main tab). Calculated for a period of 360 days.
- Yearly swap per PS (Short) — swap paid or charged by a broker for short positions in account currency for calculated position size (on the Main tab). Calculated for a period of 360 days.
- Position size duplicates the display of the position size calculated by the cBot on the Main tab.
Trading tab
The trading tab lets you trade based on the results of the calculation and also to control the trading process.
- Trade — a button to open a trade (or multiple trades) based on the position size calculation results.
- Trailing stop — a number of pips to apply as a trailing stop to trades with the given Label.
- Breakeven — a number of pips in profit when a breakeven will be applied to a trade with the given Label.
- Label — a Label that will be assigned to the orders and positions opened using the robot.
- Expiry — expiration time for pending orders; set in seconds.
- Order commentary — commentary for orders and positions opened using the robot.
- Auto-suffix — if ticked, the cBot will append a unique suffix to the order commentary set up above. This can be particularly useful when you want to set the same commentary for all parts of a multi-TP trade, but you want the next multi-TP trade to use a different commentary.
- Max # of trades: Total — if opening a new trade will make the number of all open trades exceed the maximum value, the cBot won't open the trade.
- Max # of trades: Per symbol — the same as above but takes into account only the trades on the current symbol.
- Max volume: Total — if non-zero value is given, the cBot will not open a new trade if the total volume of all open positions exceeds the given value.
- Max volume: Per symbol — the same as above but takes into account only the trades on the current symbol.
- Max risk: Total — if non-zero value is given, the cBot will not open a new trade if the total calculated risk of all orders exceeds the given value.
- Max risk: Per symbol — the same as above but takes into account only the trades on the current symbol.
- Disable trading when lines are hidden — a simple checkbox to prevent the cBot from opening a position when you have chosen to hide the lines via the Main tab.
- Fill take-profits inwards — a button to fill multiple take-profit fields equidistantly from Entry level to main Take-Profit level.
- Fill take-profits outwards — a button to fill multiple take-profit fields equidistantly with the main Take-Profit level as the closest one.
- Share, % — a button to distribute the volume shares between multiple take-profits. It switches between three modes: equal, descending, ascending.
- Multiple take-profit levels — a number (set via TakeProfitsNumber input parameter) of take-profits to divide the position among. The first take-profit is always the same as the one set on the Main tab.
- Shares to divide the position size — each take-profit level is assigned its percentage of the total position size calculated on the Main tab.
- Max slippage — the maximum tolerable slippage value (in pips) that will be used in trading functions of the robot.
- Max spread — the cBot will not trade if current spread is wider than the value given here.
- Max Entry/SL distance — the cBot will not trade if distance between the Entry level and Stop-Loss level becomes greater than this value.
- Min Entry/SL distance — the cBot will not trade if distance between the Entry level and Stop-Loss level becomes less than this value.
- Subtract open positions volume — if ticked, the cBot will calculate the total open volume for a given trading instrument and will subtract it from the calculated position size, so the resulting volume after a new trade opens is equal to the calculated position size.
- Subtract pending orders volume — if ticked, the cBot will calculate the total volume of all pending orders on a given trading instrument and will subtract it from the calculated position size, so the resulting volume after a new trade opens is equal to the calculated position size.
- Do not apply stop-loss — if ticked, the cBot will open a trade without stop-loss. This can be useful if you use a separate robot or some other means to trigger your stop-loss.
- Do not apply take-profit — if ticked, the cBot will open a trade without take-profit. This can be useful if you use a separate robot or some other means to trigger your take-profit.
- Ask for confirmation — if ticked, the cBot will ask for confirmation before trading.
How to use?
Using this robot is very simple if your main aim is to calculate the position size based on your stop-loss and the current market parameters and then to execute the trade based on that calculated position size.
- Running the Position Sizer cBot on a chart will automatically set an entry level to the current price, preparing for a market buy order. Stop-loss level will be set to the nearest low. Take-profit will be turned off.
- Now, you can already use its position size output to enter a trade if you planned a market buy order with SL set to the low of the current bar and with 1% of balance risk. You can also change the position size field manually to calculate the risk based on its value.
- If not, you can freely change the stop-loss — either by dragging the stop-loss line on the chart or by entering the value into the stop-loss input in the panel. You can also set your stop-loss as a distance in points by turning on the respective input parameter.
- You can set your take-profit the same way. Additionally, you can quickly set the TP equal to the current SL value (or with some preset multiplier) by clicking the Take-profit button. Similar to the stop-loss, the take-profit can be set as distance in points if the respective input parameter is turned on. Multiple take-profit levels are supported when TakeProfitsNumber input parameter is set to a value greater than 1. You can also add and remove take-profits using the panel buttons.
- If you turn ATR settings on via the cBot's input parameters, you can also control the ATR values for stop-loss and take-profit calculation.
- Adding a take-profit will turn on the display of Reward and Reward/risk ratio for your information.
- Switching the type of order from Instant to Pending (and backwards) is done with the order type button. When Instant order is used, the Entry level will trail the current price (Bid or Ask) and cannot be changed manually. When Pending or Stop Limit order is used, the Entry level can be set either via panel's input or by dragging the chart line.
- The cBot will warn if the Entry level is too close to the current price in the Pending order mode and if the Stop-loss or Take-profit level is too close to the Entry level.
- Switching the account size from balance to equity or to balance minus portfolio risk can be useful in some cases and is done by one or two clicks on the respective button.
- Adjusting the risk tolerance can be done in two ways: by setting the percentage risk value or by setting the money risk value. Both are done via the input fields in the panel. You can also use the quick risk setting buttons if you need to switch risk per trade often.
- Moving on to the Risk tab of the panel is completely optional and provides information about your current and potential risk and reward. You can control how pending orders and orders without stop-loss/take-profit are treated in this tab.
- The Margin tab is not necessary either if your goal is to calculate the optimal position size based on your risk and stop-loss. This tab will inform you of the amount of free and used margin resulting from your position. It will also show you what is the biggest position size that you can open with your current free margin and leverage. A custom leverage can be entered if needed.
- The Swaps tab can be consulted if you wish to know how costly the daily rollover will be for your position. It will be especially useful if you are using a carry trade strategy.
- The Trading tab will help you execute the actual trade and control how it is done.
Trading
You can use the position size output of this cBot to open trades manually directly in cTrader or in some other platform. Alternatively, you can use its trading capability to open trades based on the calculated position size and with the given entry, SL, and TP levels. You can either use the Trade button on the Trading tab or the hotkey (set via input parameters). Additionally, you can turn on more trade buttons: on the Main tab and near the Entry line.
Trade execution example with confirmation to open a position:
How to set a keyboard shortcut for trade execution
You can set a keyboard shortcut via the TradeHotKey input parameter. You can either use a single key (e.g., "T") or with a combination of
Comparison with MetaTrader version
If you already used our Position Sizer for MetaTrader, you will find the cTrader Position Sizer quite similar. However, there are some important differences between two versions.
- Commission size is automatically retrieved by the panel.
- A pip is defined within the platform, so some fields are set in pips rather than points.
- Order expiry time is more flexible; it can be set in seconds.
- No
Ctrl /Shift modifiers for +/- buttons. - Moving the panel around the chart is a little bit complicated.
- The on-chart trade button doesn't change text to match the order type.
- No panel translations (for now).
Input parameters
The cBot has a set of input parameters besides the panel-based controls. The Position Sizer's display options and a number of default options are set via the standard parameters interface in cTrader.
Compactness
- ShowLineLabels (default = Yes) — if Yes, SL and TP distance in points will be shown below the stop-loss and take-profit lines.
- ShowAdditionalSLLabel (default = No) — if Yes, percentage and money risk will be displayed above the stop-loss line.
- ShowAdditionalTPLabel (default = No) — if Yes, percentage and money targets and a risk-to-reward ratios will be displayed above the take-profit lines. If multiple take-profits are used, the relevant trade size will also be displayed there.
- ShowAdditionalEntryLabel (default = No) — if Yes, total position size will be displayed above the entry line.
- HideAccSize (default = No) — if Yes, the account size display and button will be hidden.
- ShowPointValue (default = No) — if Yes, the point value will be displayed in the bottom of the Main tab.
- ShowMaxPSButton (default = No) — if Yes, the maximum position size button will be displayed near the position size field.
- StartPanelMinimized (default = No) — if Yes, the panel will be created in a minimized state.
- ShowATROptions (default = No) — if Yes, the panel will display options for ATR indicator to be used for SL/TP calculation.
- ShowMaxParametersOnTrading (default = Yes) — if Yes, the Trading tab of the panel will display the fields to limit maximum number, volume, and risk of trades. Set to No to reduce the tab's vertical size.
- ShowFusesOnTrading (default = Yes) — if Yes, the Trading tab of the panel will display the fields of the so-called trade fuses: on slippage, spread, and SL/Entry distance. Set to No to reduce the tab's vertical size.
- ShowCheckboxesOnTrading (default = Yes) — if Yes, the Trading tab of the panel will display the checkboxes that affect how trades are executed. Set to No to reduce the tab's vertical size.
- HideEntryLineOnInstant (default = No) — if Yes, the Entry line will be hidden when working with Instant orders.
- AdditionalTradeButtons (default = None) — can be one of four options:
- None — no additional Trade button; only the one on the Trading tab is present.
- Above the Entry line — a floating Trade button just above the Entry line will be shown.
- Main tab — a Trade button in the top-left corner of the Main tab will be shown.
- Both — both of the above additional Trade buttons will appear.
Fonts
- SL Label Font Color (default = Green) — font color for the stop-loss line label.
- TP Label Font Color (default = Goldenrod) — font color for the take-profit line label.
- Stop Price Label Font Color (default = Purple) — font color for the stop price line label.
- Entry Label Font Color (default = Blue) — font color for the entry line label.
- Labels Font Size (default = 13) — font size for the text in labels.
Lines
- Entry Line Color (default = Blue) — color of the entry line.
- Stop-Loss Line Color (default = Green) — color of the stop-loss line.
- Take-Profit Line Color (default = Goldenrod) — color of the take-profit line.
- Stop Price Line Color (default = Purple) — color of the stop price line for stop limit orders.
- BE Line Color (default = None) — color of the breakeven lines.
- Entry Line Style (default = Solid) — entry line style.
- Stop-Loss Line Style (default = Solid) — stop-loss line style.
- Take-Profit Line Style (default = Solid) — take-profit line style.
- Stop Price Line Style (default = Dots) — stop price line style for stop limit orders.
- BE Line Style (default = Dots) — breakeven line style.
- Entry Line Width (default = 1) — entry line width.
- Stop-Loss Line Width (default = 1) — stop-loss line width.
- Take-Profit Line Width (default = 1) — take-profit line width.
- Stop Price Line Width (default = 1) — stop price line width for stop limit orders.
- BE Line Width (default = 1) — breakeven line width.
Defaults
All default parameters can be changed via the panel. They are added here for the sake of convenience — you can save them to a settings file.
- TradeDirection (default = Long) — the default trade direction. Can be Long or Short.
- SL (default = 0) — if non-zero, the stop-loss level of a newly attached Position Sizer will be set to this value in pips. Will also turn on the Stop-loss button on the main tab.
- TP (default = 0) — if non-zero, the take-profit level of a newly attached Position Sizer will be set to this value in pips.
- TakeProfitsNumber (default = 1) — if greater than 1, multiple take-profit levels will be available on the Trading tab to split the position in several trades with different take-profits.
- EntryType (default = Instant) — the default order type. Can be Instant, Pending, or Stop Limit.
- ShowLines (default = Yes) — if Yes, SL, TP, and Entry lines won't be hidden.
- LinesSelected (default = Yes) — if Yes, SL, TP, and Entry lines will be selected for moving. Be careful not to delete them occasionally!
- ATRPeriod (default = 14) — the default period for ATR indicator.
- ATRMultiplierSL (default = 0) — the default multiplier for ATR value when calculating ATR-based stop-loss.
- ATRMultiplierTP (default = 0) — the default multiplier for ATR value when calculating ATR-based take-profit.
- ATRTimeframe (default = Current) — if set to some specific timeframe, a newly attached Position Sizer will use this timeframe for ATR calculation.
- SpreadAdjustmentSL (default = No) — the default state of the spread adjustment checkbox for the ATR-based stop-loss field. If Yes, the ATR-based stop-loss level will be adjusted by the spread value.
- SpreadAdjustmentTP (default = No) — the default state of the spread adjustment checkbox for the ATR-based take-profit field. If Yes, the ATR-based take-profit level will be adjusted by the spread value.
- AccountButton (default = Balance) — the default state of the Account button. Can be Balance, Equity, or Balance - Risk (account balance minus the current portfolio risk).
- Risk (default = 1) — the default value for percentage risk.
- MoneyRisk (default = 0) — if greater than zero, will be used as the default value for money risk and the percentage risk will be calculated based on the money risk.
- CountPendingOrders (default = No) — the default value for the Count pending orders checkbox on the Risk tab.
- IgnoreOrdersWithoutSL (default = No) — the default value for the Ignore orders without stop-loss checkbox on the Risk tab.
- IgnoreOrdersWithoutTP (default = No) — the default value for the Ignore orders without take-profit checkbox on the Risk tab.
- IgnoreOtherSymbols (default = No) — the default value for the Ignore orders in other symbols checkbox on the Risk tab.
- CustomLeverage (default = 0) — the default value for the Custom leverage field on the Margin tab.
- Label (default = PSLabel) — the default Label for the Trading tab.
- Commentary (default = "") — the default order commentary for trades.
- AutoSuffix (default = No) — if Yes, a suffix will be automatically appended to the order commentary.
- DisableTradingWhenLinesAreHidden (default = No) — the default value for the Disable trading when lines are hidden checkbox on the Trading tab.
- MaxSlippage (default = 0) — the default value for the maximum slippage on the Trading tab.
- MaxSpread (default = 0) — the default value for the maximum spread on the Trading tab.
- MaxEntrySLDistance (default = 0) — the default maximum entry/SL distance for the Trading tab.
- MinEntrySLDistance (default = 0) — the default minimum entry/SL distance for the Trading tab.
- MaxPositionSizeTotal (default = 0) — the default maximum total open volume to tolerate in the account. A zero value means no limit.
- MaxPositionSizePerSymbol (default = 0) — the default maximum open volume per symbol to tolerate in the account. A zero value means no limit.
- SubtractOPV (default = No) — the default value for the Subtract open positions volume checkbox on the Trading tab.
- SubtractPOV (default = No) — the default value for the Subtract pending orders volume checkbox on the Trading tab.
- DoNotApplyStopLoss (default = No) — the default value for the Do not apply stop-loss checkbox on the Trading tab.
- DoNotApplyTakeProfit (default = No) — the default value for the Do not apply take-profit checkbox on the Trading tab.
- AskForConfirmation (default = Yes) — the default value for the Ask for confirmation checkbox on the Trading tab.
- PanelPositionX (default = 10) — the default horizontal distance from the selected panel position corner.
- PanelPositionY (default = 10) — the default vertical distance from the selected panel position corner.
- TPLockedOnSL (default = No) — the default state of the take-profit "lock" on the stop-loss. If Yes, the take-profit tracks the stop-loss distance automatically.
- TrailingStop (default = 0) — the default trailing stop value in pips for the Trading tab.
- BreakEven (default = 0) — the default breakeven value in pips for the Trading tab.
- Expiry (default = 0) — the default expiry duration in seconds for a pending order for the Trading tab.
- MaxNumberOfTradesTotal (default = 0) — the default total maximum number of trades to tolerate in the account. A zero value means no limit.
- MaxNumberOfTradesPerSymbol (default = 0) — the default maximum number of trades per symbol to tolerate in the account. A zero value means no limit.
- MaxTotalRisk (default = 0) — the default maximum total risk to tolerate in the account. A zero value means no limit.
- MaxTotalRiskPerSymbol (default = 0) — the default maximum risk per symbol to tolerate in the account. A zero value means no limit.
- SLDistanceInPoints (default = No) — if Yes, stop-loss will be set in points and the SL line will be following the entry line.
- TPDistanceInPoints (default = No) — if Yes, take-profit will be set in points and the TP line will be following the entry line.
Keyboard shortcuts
- TradeHotKey (default = "Shift+T") — a case-insensitive hotkey shortcut to open a new trade based on the calculations. Supports
Shift andCtrl modifiers. - SwitchOrderTypeHotKey (default = "O") — a case-insensitive hotkey shortcut to switch the order type. Supports
Shift andCtrl modifiers. - SwitchEntryDirectionHotKey (default = "TAB") — a case-insensitive hotkey shortcut to switch the trade direction. Supports
Shift andCtrl modifiers. - SwitchHideShowLinesHotKey (default = "H") — a case-insensitive hotkey shortcut to toggle lines' visibility. Supports
Shift andCtrl modifiers. - SetStopLossHotKey (default = "S") — a case-insensitive hotkey shortcut to set the stop-loss to where the mouse pointer is. Supports
Shift andCtrl modifiers. - SetTakeProfitHotKey (default = "P") — a case-insensitive hotkey shortcut to set the take-profit to where the mouse pointer is. Supports
Shift andCtrl modifiers. - SetEntryHotKey (default = "E") — a case-insensitive hotkey shortcut to set the entry line to where the mouse pointer is. If current order type is set to Instant, it will be switched to Pending. Supports
Shift andCtrl modifiers. - MinimizeMaximizeHotkey (default = "`") — a case-insensitive hotkey shortcut to minimize or maximize the panel. Supports
Shift andCtrl modifiers. - SwitchSLPointsLevelHotKey (default = "
Shift +S ") — a case-insensitive hotkey shortcut to switch Stop-loss between points and level modes. SupportsShift andCtrl modifiers. - SwitchTPPointsLevelHotKey (default = "
Shift +P ") — a case-insensitive hotkey shortcut to switch Take-profit between points and level modes. SupportsShift andCtrl modifiers.
Miscellaneous
- TP Multiplier (default = 1) — the multiplier value for the take-profit button.
- Use Commission to Set TP Distance (default = No) — if Yes, the take-profit button will take into account the commission field when calculating the appropriate TP level.
- ShowSpread (default = None) — show spread either in Points or as percentage of SL.
- AdditionalFunds (default = 0) — funds to be added to the account size for the purpose of risk and position size calculation. For example, this could be some funds you hold outside the broker's account but consider a part of your Forex risk capital.
- CustomBalance (default = 0) — you can set custom balance size for the expert advisor. For example, if you are calculating position size for another account. This parameter will override the AdditionalFunds parameter.
- ATRCandle (default = Current candle) — which candle to use to get the ATR value from — current or previous.
- CalculateUnadjustedPositionSize (default = No) — if Yes, position size calculation result will not be adjusted using broker's minimum/maximum volume and volume step parameters.
- SurpassBrokerMaxPositionSize (default = No) — if Yes, the robot will surpass the broker's maximum volume limit by opening multiple trades.
- Use Async Orders (default = No) — if Yes, the robot will use asynchronous orders in trading.
- Rounding (default = Down) — how the position size and potential reward should be rounded. Switching to Up or Nearest may lead you to risking more than you planned.
- QuickRisk1 (default = 0) — the percentage risk value to be assigned to the first quick button. Alongside with the second quick risk button, it enables you to quickly set a specific risk level.
- QuickRisk2 (default = 0) — the percentage risk value to be assigned to the second quick button. Alongside with the first quick risk button, it enables you to quickly set a specific risk level.
- Symbol Change Action (default = Each Symbol Own Settings) — what to do when chart's symbol changes:
- Each Symbol Own Settings — each symbol will try to load each own settings if they exist.
- Reset To Defaults On Symbol Change — a hard reset of all panel settings will occur.
- Keep Panel As Is — panel settings will be kept unchanged.
- DisableStopLimit (default = No) — if Yes, the Stop Limit order type will be skipped when switching through order types via the panel.
- Apply SL-TP After All Trades Executed (default = Yes) — if Yes, SL and TP levels will be applied to positions only after all trades finish executing.
- DarkMode (default = No) — if Yes, the panel's color scheme will switch to a dark mode.
- Use Last Saved Settings (default = Yes) — if Yes, the panel's fields will be restored when restarting the cBot on the same symbol.
- Prefill Additional TPs Based On Main (default = Yes) — if Yes, newly additional take-profit levels will be pre-filled based on the main TP value.
- Ask for Confirmation Before Closing (default = No) — if Yes, you will be prompted for confirmation when closing the panel.
Screenshots
Main tab
The main tab is the biggest one and looks nice on any background — this one is white for example. The take-profit and stop-loss lines' colors have been changed via input parameters for better readability. The order type is set to Stop Limit here, so the purple stop price line is also visible on the chart.
Risk tab
Black background color and chart grid do not interfere with the panel as you can see on this screenshot of the Risk tab. The panel is set to a dark mode, to reduce the screen brightness. The risk outputs show Infinity as there is, apparently, a sell order without stop-loss.
Margin tab
You can use it with any color scheme. In this case, a light blue background is combined with the black stop-loss line and label.
Swaps tab
This example shows swaps tab with a classic black and white color scheme chart. You can see double negative swaps on this US 30 CFD.
Trading tab
The trading tab is the largest of all five tabs but still fits quite well into the chart.
Minimized panel
Minimizing the panel in one click makes it completely non-obtrusive and allows trader to easily see the entire chart.
Download (ver. 1.06, 2024-12-10)
Installation
To install the robot, please copy the PositionSizer.algo file to the \cAlgo\Sources\Robots
associated with your cTrader. Normally, it can be found under C:\Users\<
Username
>\Documents\
. The cBot should immediately become available in your platform.
If you prefer to work with the source code, you can copy the source code folder to the same destination: \cAlgo\Sources\Robots
.
Frequently asked questions
I enter, let's say, 1% risk, but the Results column shows 0.87%. I want to risk, let's say $5,000, but end up risking $4,350. Why?
The most probable reason for that is that increasing the position size by the minimum possible increment would lead to a position size with a risk greater than the given percentage. The Position Sizer rounds the position size down in such cases, aiming to reduce the actual risk rather than to overshoot the specified value. You can always set the Calculate Unadjusted Position Size input parameter to Yes to make the Position Sizer to show the exact calculated position size, but you won't be able to open such a trade with this broker because it won't comply with the broker's restrictions on the minimum position volume step.
The Position Sizer crashes, it doesn't trade, there is some error! What do I do?
Please report any abnormal behavior in the official forum thread. Don't forget to include screenshots of the Position Sizer panel (screenshots of the entire chart or even platform are preferable) and of any errors you encounter. It also helps to see the output from the Logs tab of the platform.
Discussion
Do you have any suggestions or questions regarding this cTrader robot?
Discuss cTrader Position Sizer with other traders and cAlgo programmers on the forum.
You might be also interested in our list of cTrader Forex brokers if you'd like to choose one that offers the best trading conditions for you.
Changelog
1.06 — 2024-12-10
- Added an input parameter (Use Async Orders) to enable asynchronous trade requests.
- Fixed panel minimization status not saving through timeframe switching.
- Fixed a runtime error that could appear in some cases when opening the chart with the Position Sizer after launching it first.
- Fixed a runtime error that could sometimes appear when setting a take-profit.
- Fixed a runtime error when clicking on the Show lines button.
- Fixed a bug that would cause edit fields' background change to white in the dark mode.