Simple Position Sizer

vinitpandya Updated   
Simple Position Sizer is designed to calculate optimal position sizes based on a defined risk percentage and stop-loss level. It offers two modes for determining position size: using the current close price or a specified entry price. The script provides key trade details such as entry price, stop-loss level, quantity to trade, total cost, and risk amount in monetary terms, alongside visual indications of these parameters through colored lines and labels on the chart. Users can customize account size, risk per trade percentage, and entry and stop-loss levels directly within the settings.

Usage Scenario:

A trader looking to enter a position would first decide whether the entry is based on the current closing price or a predetermined level. After setting the stop-loss level and specifying the risk per trade as a percentage of the account size, the script calculates the number of shares or contracts to purchase. It also computes the total cost of the position and displays the potential loss if the stop-loss is triggered, allowing the trader to understand the risk involved before entering the trade.

Visual Indicators:

  • Green indicators suggest a long setup where the entry level is above the stop-loss, indicating bullish entry.
  • Red indicators signal a short setup where the entry level is below the stop-loss, reflecting bearish entry
  • Blue lines represent the entry level when specified by the trader, providing a visual cue for planned entries.
Release Notes:

Added the ability to have a yellow Take Profit line based on the RR that can be defined in the settings of the indicator.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?