OPEN-SOURCE SCRIPT
Shares to Stop Loss

📊 Shares to Stop Loss Calculator
This indicator automatically calculates the optimal number of shares to trade based on your predefined risk amount and dynamic stop loss levels.
🎯 Key Features:
Automatic Position Sizing: Calculates exact number of shares for both LONG and SHORT positions based on your risk tolerance
Dynamic Stop Loss Levels: Uses relative highs and lows from a customizable lookback period
Visual Reference Lines: Displays horizontal lines showing your stop loss levels on the chart
Real-time Updates: Position size adjusts automatically with price movement
Clean Interface: Compact table showing all relevant information without cluttering your chart
⚙️ How It Works:
For SHORT positions:
Stop loss is placed at the relative high (highest price in the lookback period)
Calculates shares needed to risk your specified dollar amount
For LONG positions:
Stop loss is placed at the relative low (lowest price in the lookback period)
Calculates shares needed to risk your specified dollar amount
📝 Inputs:
Amount for stop loss ($): Your maximum risk per trade in dollars (default: $100)
Look back candles for rel. HIGH: Period to calculate the relative high for SHORT stops (default: 20)
Look back candles for rel. LOW: Period to calculate the relative low for LONG stops (default: 20)
Line colors: Customize the appearance of reference lines
💡 Use Case:
Perfect for traders who practice proper risk management and want to maintain consistent dollar risk across different price levels and volatility conditions. Simply set your risk amount once, and the indicator does the math for you on every candle.
⚠️ Note: This indicator calculates position sizes based on technical levels. Always consider liquidity, account size, and broker requirements before entering positions.
This indicator automatically calculates the optimal number of shares to trade based on your predefined risk amount and dynamic stop loss levels.
🎯 Key Features:
Automatic Position Sizing: Calculates exact number of shares for both LONG and SHORT positions based on your risk tolerance
Dynamic Stop Loss Levels: Uses relative highs and lows from a customizable lookback period
Visual Reference Lines: Displays horizontal lines showing your stop loss levels on the chart
Real-time Updates: Position size adjusts automatically with price movement
Clean Interface: Compact table showing all relevant information without cluttering your chart
⚙️ How It Works:
For SHORT positions:
Stop loss is placed at the relative high (highest price in the lookback period)
Calculates shares needed to risk your specified dollar amount
For LONG positions:
Stop loss is placed at the relative low (lowest price in the lookback period)
Calculates shares needed to risk your specified dollar amount
📝 Inputs:
Amount for stop loss ($): Your maximum risk per trade in dollars (default: $100)
Look back candles for rel. HIGH: Period to calculate the relative high for SHORT stops (default: 20)
Look back candles for rel. LOW: Period to calculate the relative low for LONG stops (default: 20)
Line colors: Customize the appearance of reference lines
💡 Use Case:
Perfect for traders who practice proper risk management and want to maintain consistent dollar risk across different price levels and volatility conditions. Simply set your risk amount once, and the indicator does the math for you on every candle.
⚠️ Note: This indicator calculates position sizes based on technical levels. Always consider liquidity, account size, and broker requirements before entering positions.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.