Risk ModuleThis indicator provides a visual reference for position sizing and approximate stop and target placement. It supports trade planning by calculating equalized risk per trade and maintaining consistent exposure across different markets.
For more information about the concept, see the post Position Sizing and Risk Management .
Fixed Fractional Risk
The indicator calculates the number of shares that can be traded to maintain consistent monetary risk. The formula is based on the distance between the current price and stop reference, adjusting position size proportionally. A closer stop results in a larger position size, while a wider stop results in a smaller one.
Position Size = (Account Size × Risk %) ÷ (Entry Price – Stop Price)
Stop and Target
Stop placement is derived from volatility using the Average True Range (ATR). The target is plotted as a multiple of the stop distance, defining the risk-to-reward relationship in R units.
Stop = Price ± ATR × Multiplier
Target = Price ± (R × Risk Distance)
Chart Elements
The stop and target levels are plotted above and below the current price, with the stop marked by a red dot and the target by a green dot. The information table displayed on the chart shows the number of shares to trade, stop level, and target level.
Setup and Configuration
This configuration only needs to be set once, but can be adjusted later if preferred.
1. Start by setting the account size and risk percentage per trade to define the monetary amount risked on each trade. These values form the basis for position size calculation.
2. Set the ATR multiplier to determine stop distance, common values range between 1 and 3 ATR. Lower values place stops closer to price, increasing sensitivity but risking short-term noise. Higher values widen the stop, which reduces noise impact but extends time in risk.
3. Set the R-multiple to determine target distance relative to the stop. A value of 1 represents a 1:1 risk-to-reward relationship. Lower values reduce potential reward but tend to increase win rate, whereas higher values increase potential reward but tend to reduce win rate. The selection depends on system characteristics and trade expectancy.
When the parameters are defined, the indicator displays the stop, target, and calculated position size on the chart. All that remains is to enter the trade with the number of shares shown in the table and place bracket orders at the plotted stop and target levels.
Settings Overview
Account Size / Risk %: Defines account capital and per-trade exposure.
ATR Multiplier: Adjusts stop distance relative to volatility.
R Multiple: Sets target distance relative to stop (risk-reward ratio).
Position: Choose Long or Short direction.
Table Position: Controls information table placement and scale.
Execution
Enhanced Execution ToolA comprehensive position sizing calculator for disciplined risk management
Description :
This tool provides traders with precise position sizing calculations based on their account parameters and market conditions. The indicator calculates optimal position sizes for different entry scenarios while maintaining strict risk control.
Key Features:
Multiple entry options (High, Close, Manual)
Flexible stop loss configuration (LoD or Previous Day Low)
Account-based risk management (1% risk by default)
ATR-based distance metrics for volatility assessment
Clear visual table displaying all critical trade parameters
How to Use:
Configure your account size and risk percentage
Select your preferred entry methods (High/Close/Manual)
Choose stop loss reference (Low of Day or Previous Day Low)
View calculated position sizes and risk parameters
For manual entries, input your desired entry and stop prices
Input Parameters:
Account Configuration: Set your capital and risk tolerance
Entry Options: Choose which entry methods to display
Stop Loss: Select stop loss reference level
Technical Settings: Adjust ATR length and distance limits
Display Options: Customize table appearance
Output Includes:
Risk amount in dollars
Risk as percentage of entry price
Entry to stop loss as percentage of ATR
Stop loss price
Entry price
Position size as % of account
Share quantity
Ideal For:
Traders who want to maintain consistent risk management
Those who need quick position sizing calculations
Investors who trade with multiple entry strategies
Note: Always verify calculations before executing trades. This tool is designed to assist with trade planning, not as trade advice.
Multiple Instrument Automation ScreenerI have developed a Pine Script indicator on TradingView designed to demonstrate how to automate execution for ten instruments. This example utilizes a straightforward, Simple Moving Average (SMA) indicator. You can use it as a template, but use your indicator.
The indicator computes long/short signals based on the crossing of the SMA using the security function
It acts as a screener, presenting calculation results in an organized table format.
Utilizing the varip variable, the indicator sends alerts for multiple instruments sequentially rather than simultaneously.
For every generated signal, the indicator builds and sends a JSON execution command to a third-party tool, ensuring seamless integration and automation. You can use your own format.
Sent alerts look like this:
{"ticker": "DOGEBTC","action": "buy","price": "0.00000199","time": "1719754620658"}
Details and Limitations
Instrument Limit: The example is configured for ten instruments for simplicity. However, it can be expanded to handle up to 40 instruments.
Alert Rate Limit: There is a rate limit of 15 alerts in 3 minutes. Exceeding this limit may cause some alerts to be stopped. This can be managed by tracking the alert times and delaying some alerts, though this may affect the entry prices.
Timing of Signal Generation : The indicator processes signals at the bar close to the active instrument. Due to its computational complexity, there is a slight delay in collecting all records, potentially causing signals to reflect a few seconds before the bar closes. Care should be taken when executing based on these signals.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.