指標和策略
Volume-Based Candle Colorindicates the increase in volume on the individual candles relative to the 20ma on the volume indicator.
Non-Repainting RSI 30/70 SignalA simple buy and sell indicator that relies on overbought and oversold areas that you enter whenyou get either a buy or sold signal.
Price Action Breakout – CALL/PUT AlertsThis strategy generates CALL or PUT alerts based on price breakouts confirmed by EMA and volume filters.
🔍 Breakout Logic
📈 CALL Alert (Bullish Breakout):
Price closes above EMA
Price breaks above previous high
Volume is above average × multiplier
📉 PUT Alert (Bearish Breakout):
Price closes below EMA
Price breaks below previous low
Volume is above average × multiplier
🎯 Alert Structure
CALL 📈 / PUT 📉
Entry Price
Take Profit (TP) – Based on risk/reward ratio
Stop Loss (SL) – Based on percentage distance from entry
📊 Chart Elements
Labels on breakout candle with full alert info
Horizontal lines for TP and SL levels
Works on any timeframe (e.g., 15min for intraday)
✅ Use Case
Ideal for options traders, scalpers, and automated alerts
Range Breakout [sgbpulse]Range Breakout
1. Overview
The "Range Breakout " indicator is a powerful tool designed to identify and visually display price ranges on your chart using pivot points. It dynamically draws two distinct boxes – an External Range and an Internal Range – helping traders pinpoint potential support and resistance zones. Beyond its visual representation, the indicator offers a comprehensive set of 12 unique breakout alerts, providing real-time notifications for significant price movements outside these defined ranges. Additionally, it integrates RSI and MFI metrics for momentum confirmation.
2. How It Works
The indicator operates by identifying pivot points based on user-defined "left" and "right" bar lengths. A high pivot is a bar with a specified number of lower highs both to its left and right, and similarly for a low pivot.
External Range: Calculated using longer pivot lengths (default: 15 bars left, 6 bars right). This range represents broader, more significant price consolidation areas.
Internal Range: Calculated using shorter pivot lengths (default: 4 bars left, 3 bars right). This range captures tighter, more immediate price consolidations within the broader trend.
The External Range will always be greater than or equal to the Internal Range, as it's based on a wider historical context. Both ranges are displayed as transparent boxes on your chart, dynamically adjusting as new pivots are formed.
3. Key Features and Settings
Customizable Pivot Lengths:
External Range (Left/Right Bars): Adjust sensitivity for identifying the broader price range. Longer lengths lead to more stable, but less frequent, range updates.
Internal Range (Left/Right Bars): Adjust sensitivity for the tighter, more immediate price range.
Tool Tips: Minimum 6 bars for the External Range, and minimum 2 bars for the Internal Range.
Customizable Range Colors: Easily change the background colors of the External and Internal Range boxes to match your chart's aesthetic.
Dynamic Range Display: The indicator automatically updates the range boxes as new pivot highs and lows are formed, always presenting the most current valid ranges.
RSI / MFI Settings:
Timeframe Source: Select the timeframe for RSI and MFI calculation.
- Chart: Calculation based on the current chart timeframe.
- Daily: Always calculated based on the daily ("D") timeframe, even if the chart is on a lower timeframe.
RSI Length: Period length for RSI calculation (default: 14).
RSI Overbought Level: Overbought level for RSI (default: 70.0).
RSI Oversold Level: Oversold level for RSI (default: 30.0).
MFI Length: Period length for MFI calculation (default: 14).
MFI Overbought Level: Overbought level for MFI (default: 80.0).
MFI Oversold Level: Oversold level for MFI (default: 20.0).
4. Synergy of Ranges & Breakout Strength
The interaction between the External and Internal Ranges provides deep insights into price movement and breakout strength:
Immediate Direction: The movement of the Internal Range (up or down) indicates the short-term directional bias within the broader framework of the External Range.
Strength Confirmation: A breakout of the External Range, followed by a breakout of the Internal Range, confirms the strength of the move and increases confidence in the breakout.
Strong Momentum ("Leaving" Ranges Behind): When price breaks out with exceptionally strong momentum, it continues to move aggressively and does not immediately form new pivots. In such situations, the existing ranges (External and Internal) remain in place while the candles "leave them behind." A "Full Candle" breakout, where the entire candle moves past both ranges, indicates a particularly powerful and decisive move.
Momentum (RSI / MFI) as Confirmation:
- RSI (Relative Strength Index): Measures the speed and change of price movements. Extreme values (above 70 or below 30) indicate overbought/oversold conditions respectively, confirming strong momentum in a breakout.
- MFI (Money Flow Index): Similar to RSI but incorporates volume. Extreme values (above 80 or below 20) indicate strong money flow in/out, reinforcing breakout confirmation.
- Importance of Confirmation: If a breakout occurs but momentum indicators do not confirm it (for example, an upside breakout while RSI is declining), this could signal weakness in the move and the risk of a false breakout (Fakeout).
5. Visuals
The indicator provides clear visual representations on the chart:
Range Boxes:
Two dynamic boxes are drawn on the chart: one for the External Range and one for the Internal Range.
These boxes update continuously, displaying the current range boundaries based on the latest pivots. They provide an immediate visual indication of support and resistance levels.
RSI/MFI Status Labels:
Small text labels appear to the right of the current bar, vertically centered.
They display the status of RSI and MFI: RSI OB (Overbought), RSI OS (Oversold), MFI OB, MFI OS, along with the exact value.
Important: The labels remain on the chart as long as the condition holds (indicator is above/below the level), unlike alerts which mark a singular crossover event.
Plotting of Key Values:
The indicator plots six invisible series on the chart, primarily to allow the user to view the exact numerical values of:
- The upper and lower bounds of the External Range (External High, External Low).
- The upper and lower bounds of the Internal Range (Internal High, Internal Low).
- The calculated RSI and MFI values (RSI, MFI).
These values are accessible for viewing through TradingView's Data Window and also via the Status Line when hovering over the relevant candle. This enables more precise quantitative analysis of range levels and momentum.
6. Comprehensive Breakout Alerts
The "Range Breakout " indicator provides 12 distinct alert conditions for breakouts, allowing you to select the required level of confirmation for each alert. All alerts are triggered only upon a fully confirmed bar close (barstate.isconfirmed) to minimize false signals and ensure reliability.
All breakout alerts are configured to detect a Crossover/Crossunder of the levels, meaning a specific event where the price moves from one side of the range to the other.
External Range Breakout UP
- Close: Price closes above the External Range.
- Real Body: The entire "real body" of the candle (min of open/close prices) closes above the External Range.
- Full Candle: The entire candle (the lowest point of the candle) closes above the External Range.
External Range Breakout DOWN
- Close: Price closes below the External Range.
- Real Body: The entire "real body" of the candle (max of open/close prices) closes below the External Range.
- Full Candle: The entire candle (the highest point of the candle) closes below the External Range.
Internal Range Breakout UP
- Close: Price closes above the Internal Range.
- Real Body: The "real body" of the candle closes above the Internal Range.
- Full Candle: The entire candle closes above the Internal Range.
Internal Range Breakout DOWN
- Close: Price closes below the Internal Range.
- Real Body: The "real body" of the candle closes below the Internal Range.
- Full Candle: The entire candle closes below the Internal Range.
7. Ideal Use Cases
This indicator is ideal for traders who:
Want to clearly identify and monitor price consolidation zones.
Seek confirmation for breakout strategies across various timeframes.
Require reliable and automated alerts for potential entry or exit points based on range expansion.
8. Complementary Indicator
For even more comprehensive market analysis, we highly recommend using this indicator in conjunction with Market Structure Support & Resistance External/Internal & BoS .
This powerful complementary indicator automatically and accurately identifies significant support and resistance levels by locating high and low pivot points, as well as key Pre-Market High/Low levels. Its strength lies in its dynamic adaptability to any timeframe and asset, providing precise and relevant real-time levels while maintaining a clean chart. It also identifies Break of Structure (BoS) to signal potential trend changes or continuations.
Using both indicators together provides a robust framework for identifying defined ranges and potential trend shifts, enabling more informed trading decisions.
View Market Structure Support & Resistance External/Internal & BoS Indicator
9. Important Note: Trading Risk
This indicator is intended for educational and informational purposes only and does not constitute investment advice or a recommendation for trading in any form whatsoever.
Trading in financial markets involves significant risk of capital loss. It is important to remember that past performance is not indicative of future results. All trading decisions are your sole responsibility. Never trade with money you cannot afford to lose.
Momentum_EMABandThe Momentum EMA Band V1 is a precision tool designed for intraday traders & scalpers. This is the first version of the script, combining three powerful technical elements to help traders identify directional moves while filtering out weak, choppy market phases.
🔧 How the Indicator Works — Combined Logic
This indicator merges well-known but distinct concepts into a unified visual framework:
1️⃣ EMA Price Band — Dynamic Zone Visualization
Plots upper and lower EMA bands based on user input (default: 9-period EMA).
Price relative to the bands provides immediate visual cues:
Green Band: Price above the upper EMA — bullish strength.
Red Band: Price below the lower EMA — bearish pressure.
Yellow Band: Price within the band — neutral zone.
2️⃣ Supertrend Overlay — Reliable Trend Confirmation
ATR-based Supertrend logic (customizable ATR length & factor).
Green Supertrend Line: Uptrend confirmation.
Red Supertrend Line: Downtrend confirmation.
Helps traders ride trends with dynamic levels that adjust to volatility.
3️⃣ ADX-Based No Trade Zone — Choppy Market Filter
Manual ADX calculation measures trend strength (default ADX length: 14).
When ADX is below a user-defined threshold (default: 20) and price is within the EMA Band buffer, a gray background highlights sideways or indecisive market conditions — suggesting no new trade or low momentum zone
Optional gray triangle marker shows the start of each No-Trade Zone phase.
🎯 Key Features
✅ Combines EMA Bands, Supertrend & ADX filtering for comprehensive market context.
✅ Visual No-Trade Zone shading keeps traders out of low-probability setups.
✅ Supertrend Line tracks evolving trend bias.
✅ Fully customizable — adjust EMA, ATR, ADX settings to match different instruments or styles.
✅ Clean, focused chart presentation for easy interpretation.
💡 Practical Application
Momentum Breakouts: Enter trades when price breaks beyond the EMA Band, with Supertrend confirmation.
Avoid Sideways Traps: Refrain from trading during gray-shaded No-Trade Zones, minimizing exposure to whipsaws.
Scalping & Intraday Edge: Particularly effective on lower timeframes where choppy periods are common.
⚠️ Important Disclaimer
This is Version 1 — future versions may expand on features based on trader feedback.
This script is for educational purposes only. Always combine with risk management and thorough strategy validation.
No indicator guarantees profitability — use this tool as part of a broader trading system.
Relative StrengthDescription:
This indicator provides a simplified yet powerful method for measuring a stock's momentum based on its proximity to its recent high. It is a direct implementation of a trading concept discussed in a lecture from the New York Institute of Finance.
Core Concept
The underlying theory, supported by academic research, is that a stock making a new high is one of the most bullish signals possible. Such stocks have a statistical tendency to continue making new highs in the near term.
Instead of requiring complex relative strength calculations against a universe of stocks, this indicator uses a simple and elegant ratio to act as a proxy for momentum:
Indicator Value = Current Close / Highest High of Lookback Period
A value approaching 1.0 indicates the stock is strong and nearing a new high. A value at 1.0 means a new high has just been made.
How to Use This Indicator
The indicator consists of two primary components:
RS Line (Teal): The core momentum calculation (Close / High).
Signal MA (Orange): A moving average of the NHRS Line, which acts as the trigger for signals.
The signals are generated based on the crossover between these two lines:
BUY Signal: When the RS Line crosses ABOVE its moving average. This suggests that short-term momentum is accelerating and a new uptrend may be starting. The background will turn green.
SELL Signal: When the RS Line crosses BELOW its moving average. This indicates that momentum is fading and it may be prudent to exit the position to avoid a decline. The background will turn red.
Indicator Settings
You can customize the indicator to fit your trading style and the timeframe you are analyzing:
High Lookback Period: Choose the period for the "Highest High" calculation. Options range from 1 Month to 12 Months (52 weeks), allowing you to measure short-term or long-term strength.
Moving Average Length: Adjust the length of the signal line's moving average. The lecturer defaults to 26 weeks for a six-month view.
Moving Average Type: Select the type of moving average for the signal line (SMA, EMA, WMA, HMA).
Credits and Inspiration
Proper credit is essential. This script is a practical application of a concept that builds upon foundational academic work.
The core idea that a stock's proximity to its 52-week high is an investable anomaly was detailed in the 2004 Journal of Finance paper:
"The 52 Week High and Momentum Investing" by Thomas J. George and Chuan-Yang Hwang.
The lecturer's contribution, which this script implements, was to simplify this concept into an actionable trading tool by applying a moving average crossover to generate clear and objective buy and sell signals.
Disclaimer: This tool is for educational and informational purposes only. It is not financial advice. All trading involves risk, and you should always perform your own research and backtesting before making any trading decisions.
[GalihRidha] Scalping Dashboard 5m Scalping Dashboard 5m is a practical, real-time, and user-friendly indicator designed for 5-minute intraday scalping strategies. This indicator provides clear, actionable signals along with dynamic risk management levels, all visualized in a single vertical dashboard on your chart.
Key Features:
Actionable Next Signal:
Generates a strong, easy-to-follow trading signal ("LONG" or "SHORT") every 5 minutes, based on a multi-factor algorithm (MA20/MA50 trend, RSI, price/volume strength, candle momentum, and market structure).
Dynamic TP/SL Calculation:
Automatically displays recommended Take Profit (TP) and Stop Loss (SL) price ranges, calculated from recent price action, support/resistance, and volatility (ATR).
Vertical Dashboard Layout:
Information is neatly split between "LAST SECTION" (your most recent executed signal, TP, and SL) and "NEXT SECTION" (real-time signal, recommended TP/SL, and current price). Perfectly formatted for both desktop and mobile TradingView use.
Live "Capturing" Status:
When a new signal is forming (1 minute before candle close), the dashboard shows an animated "Capturing..." status—so you always know when the indicator is preparing the next actionable trade.
Buffered Signal Logic:
Prevents “signal repainting” by ensuring that your "Last Signal" and TP/SL levels are exactly what was shown in the previous Next Signal, never the recalculated value from a new bar. This is vital for honest backtesting and live trade confidence.
Zero Lag, Mobile Ready:
Designed to be lightweight and responsive, with instant dashboard updates and no visual lag—even on slower connections or when switching timeframes.
No repaint, no lagging, pure price action + volatility logic.
How to Use:
Add to Chart
Apply the indicator to any liquid crypto or forex pair on the 5-minute (5m) timeframe.
Watch the Dashboard
1 minute before the close of each 5-minute candle, the "Next Signal" section will activate.
"Capturing..." status (with animated dots) means a new entry signal is forming.
Use the suggested Entry, TP Range, and SL for your scalping strategy.
Follow the Signal
When "Next Signal" appears, you have 1 minute to enter the trade if desired.
After the signal passes, the values are locked into the "Last Section" for reference, record-keeping, or trade management.
Mobile Friendly
The vertical format ensures the dashboard is always visible and readable on both web and mobile versions of TradingView.
No need to manually refresh or guess when a new signal is forming—just watch for "Capturing..."!
Best Practice & Tips:
For best results, use on trending or high-volume assets. Avoid low liquidity or choppy sideways markets.
Combine with your own risk management and execution strategy for maximum performance.
This dashboard is 100% Pine Script v5, fully open-source, and does not repaint. You can customize TP/SL logic or integrate with alerts for even more automation.
Why This Indicator?
Most scalping indicators provide signals, but don't show you the real, actionable context—especially in mobile or fast-moving markets.
This dashboard solves that problem by giving you everything you need for quick, clear, and confident trading—all in one place, with true buffer logic so your entries and results are always honest and reproducible.
Happy scalping and stay disciplined—let the dashboard do the heavy lifting for you! 🚀
WMA(10) Momentum Indicatorshows wma momentum. work in progress. Attempts to capture mementum changes and confirm current trend direction. i will be expanding on this.
ATR as % of Close (Daily)Sometimes, ATR is more comparable and meaningful when we express it in % rather than dollar. This is a quickly developed version (using ChatGPT), so review it and use it with caution, although the calculation is quite straightforward.
EMA-Pack MTFEMA-Pack MTF
This TradingView Pine Script defines a custom indicator called "EMA-Pack MTF" that overlays various types of moving averages and Bollinger Bands across multiple timeframes on a chart. It begins by importing the built-in technical analysis library and defining a custom ma function that calculates several types of moving averages (SMA, EMA, TEMA, DEMA, HMA, and ALMA) based on user input. The ema function is the core logic, retrieving market data for the specified timeframe and calculating fast, mid, slow, 50, 100, and 200-period moving averages along with Bollinger Band components (basis, upper, and lower bands). The function adjusts values to the nearest valid price tick and returns them.
User input fields allow customization of timeframes, source data, moving average types, and Bollinger Band parameters. The script calls the ema function for each selected timeframe (1 minute, 5 minutes, 15 minutes, 1 hour, 4 hours, and 1 day), storing their respective computed values. It then plots the calculated moving averages and Bollinger Band basis lines on the chart, using different colors and line widths to distinguish between them. Some plots are hidden by default (display.none) to reduce chart clutter. This script is useful for multi-timeframe trend analysis using customizable moving averages and Bollinger Bands.
20 EMA Envelope with Editable %Its Ema envelope with editable feature of EMA and % of EMA how much one want deviation from EMA.
EMA Stack (13–200) Toggle📈 EMA Stack (13–200) Toggle – Color-Coded Trend Filter
Customizable EMA stack with slope-based coloring:
• 🟩 Green = Bullish slope
• 🟥 Red = Bearish slope
• Lengths: 13, 20, 34, 50, 89, 100, 200
• Toggle each EMA on/off in settings
✅ Great for:
• Trend confirmation
• Pullback entries
• Momentum confluence across timeframes
• Heikin Ashi candle setups (as shown in screenshot)
Clean, clear, and built for scalping or trend-riding.
Breaker BlockA brand new script that correctly displays the current breaker block in play but also shows the previous 2 breaker blocks for both bullish and bearish scenarios.
This greatly improves my previous code that was used for Unicorn setups, I was not happy with the logic around the production of the breaker blocks.
A new Unicorn version will be published using this new logic soon.
ICT Killzones & Pivots [TFO]Italian time: Traccia dei box per le tre time zone principali: Asia, Europa e America
200 EMA, 50 EMA, 21 EMAEMA Indicator 3 in 1 (21,50,200) Why download three individual indicator in you can have all in one.
SPY-ES & QQQ-NQ Live Ratiothis shows the live ratios of SPY and QQQs o you can easily convert them into ES and NQ levels
Position Size Calculator with Fees# Position Size Calculator with Portfolio Management - Manual
## Overview
The Position Size Calculator with Portfolio Management is an advanced Pine Script indicator designed to help traders calculate optimal position sizes based on their total portfolio value and risk management strategy. This tool automatically calculates your risk amount based on portfolio allocation percentages and determines the exact position size needed while accounting for trading fees.
## Key Features
- **Portfolio-Based Risk Management**: Calculates risk based on total portfolio value
- **Tiered Risk Allocation**: Separates trading allocation from total portfolio
- **Automatic Trade Direction Detection**: Determines long/short based on entry vs stop loss
- **Fee Integration**: Accounts for trading fees in position size calculations
- **Risk Factor Adjustment**: Allows scaling of position size up or down
- **Visual Display**: Shows all calculations in a clear, color-coded table
- **Automatic Risk Calculation**: No need to manually input risk amount
## Input Parameters
### Total Portfolio ($)
- **Purpose**: The total value of your investment portfolio
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
- **Example**: If your total portfolio is worth $100,000, enter 100000
### Trading Portfolio Allocation (%)
- **Purpose**: The percentage of your total portfolio allocated to active trading
- **Default**: 20.0%
- **Range**: 0.0% to 100.0%
- **Step**: 0.01
- **Example**: If you allocate 20% of your portfolio to trading, enter 20
### Risk from Trading (%)
- **Purpose**: The percentage of your trading allocation you're willing to risk per trade
- **Default**: 0.1%
- **Range**: Any positive value
- **Step**: 0.01
- **Example**: If you risk 0.1% of your trading allocation per trade, enter 0.1
### Entry Price ($)
- **Purpose**: The price at which you plan to enter the trade
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Stop Loss ($)
- **Purpose**: The price at which you will exit if the trade goes against you
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Risk Factor
- **Purpose**: A multiplier to scale your position size up or down
- **Default**: 1.0 (no scaling)
- **Range**: 0.0 to 10.0
- **Step**: 0.1
- **Examples**:
- 1.0 = Normal position size
- 2.0 = Double the position size
- 0.5 = Half the position size
### Fee (%)
- **Purpose**: The percentage fee charged per transaction
- **Default**: 0.01% (0.01)
- **Range**: 0.0% to 1.0%
- **Step**: 0.001
## How Risk Amount is Calculated
The script automatically calculates your risk amount using this formula:
```
Risk Amount = Total Portfolio × Trading Allocation (%) × Risk % ÷ 10,000
```
### Example Calculation:
- Total Portfolio: $100,000
- Trading Allocation: 20%
- Risk per Trade: 0.1%
**Risk Amount = $100,000 × 20 × 0.1 ÷ 10,000 = $20**
This means you would risk $20 per trade, which is 0.1% of your $20,000 trading allocation.
## Portfolio Structure Example
Let's say you have a $100,000 portfolio:
### Allocation Structure:
- **Total Portfolio**: $100,000
- **Trading Allocation (20%)**: $20,000
- **Long-term Investments (80%)**: $80,000
### Risk Management:
- **Risk per Trade (0.1% of trading)**: $20
- **Maximum trades at risk**: Could theoretically have 1,000 trades before risking entire trading allocation
## How Position Size is Calculated
### Trade Direction Detection
- **Long Trade**: Entry price > Stop loss price
- **Short Trade**: Entry price < Stop loss price
### Position Size Formulas
#### For Long Trades:
```
Position Size = -Risk Factor × Risk Amount / (Stop Loss × (1 - Fee) - Entry Price × (1 + Fee))
```
#### For Short Trades:
```
Position Size = -Risk Factor × Risk Amount / (Entry Price × (1 - Fee) - Stop Loss × (1 + Fee))
```
## Output Display
The indicator displays a comprehensive table with color-coded sections:
### Portfolio Information (Light Blue Background)
- **Portfolio (USD)**: Your total portfolio value
- **Trading Portfolio Allocation (%)**: Percentage allocated to trading
- **Risk as % of Trading**: Risk percentage per trade
### Trade Setup (Gray Background)
- **Entry Price**: Your specified entry price
- **Stop Loss**: Your specified stop loss price
- **Fee (%)**: Trading fee percentage
- **Risk Factor**: Position size multiplier
### Risk Analysis (Red Background)
- **Risk Amount**: Automatically calculated dollar risk
- **Effective Entry**: Actual entry cost including fees
- **Effective Exit**: Actual exit value including fees
- **Expected Loss**: Calculated loss if stop loss is hit
- **Deviation from Risk %**: Accuracy of risk calculation
### Final Result (Blue Background)
- **Position Size**: Number of shares/units to trade
## Usage Examples
### Example 1: Conservative Long Trade
- **Total Portfolio**: $50,000
- **Trading Allocation**: 15%
- **Risk per Trade**: 0.05%
- **Entry Price**: $25.00
- **Stop Loss**: $24.00
- **Risk Factor**: 1.0
- **Fee**: 0.01%
**Calculated Risk Amount**: $50,000 × 15% × 0.05% ÷ 100 = $3.75
### Example 2: Aggressive Short Trade
- **Total Portfolio**: $200,000
- **Trading Allocation**: 30%
- **Risk per Trade**: 0.2%
- **Entry Price**: $150.00
- **Stop Loss**: $155.00
- **Risk Factor**: 2.0
- **Fee**: 0.01%
**Calculated Risk Amount**: $200,000 × 30% × 0.2% ÷ 100 = $120
**Actual Risk**: $120 × 2.0 = $240 (due to risk factor)
## Color Coding System
- **Green/Red Header**: Trade direction (Long/Short)
- **Light Blue**: Portfolio management parameters
- **Gray**: Trade setup parameters
- **Red**: Risk-related calculations and results
- **Blue**: Final position size result
## Best Practices
### Portfolio Management
1. **Keep trading allocation reasonable** (typically 10-30% of total portfolio)
2. **Use conservative risk percentages** (0.05-0.2% per trade)
3. **Don't risk more than you can afford to lose**
### Risk Management
1. **Start with small risk factors** (1.0 or less) until comfortable
2. **Monitor your total exposure** across all open positions
3. **Adjust risk based on market conditions**
### Trade Execution
1. **Always validate calculations** before placing trades
2. **Account for slippage** in volatile markets
3. **Consider position size relative to liquidity**
## Risk Management Guidelines
### Conservative Approach
- Trading Allocation: 10-20%
- Risk per Trade: 0.05-0.1%
- Risk Factor: 0.5-1.0
### Moderate Approach
- Trading Allocation: 20-30%
- Risk per Trade: 0.1-0.15%
- Risk Factor: 1.0-1.5
### Aggressive Approach
- Trading Allocation: 30-40%
- Risk per Trade: 0.15-0.25%
- Risk Factor: 1.5-2.0
## Troubleshooting
### Common Issues
1. **Position Size shows 0**
- Verify all portfolio inputs are greater than 0
- Check that entry price differs from stop loss
- Ensure calculated risk amount is positive
2. **Very small position sizes**
- Increase risk percentage or risk factor
- Check if your risk amount is too small for the price difference
3. **Large risk deviation**
- Normal for very small positions
- Consider adjusting entry/stop loss levels
### Validation Checklist
- Total portfolio value is realistic
- Trading allocation percentage makes sense
- Risk percentage is conservative
- Entry and stop loss prices are valid
- Trade direction matches your intention
## Advanced Features
### Risk Factor Usage
- **Scaling up**: Use risk factors > 1.0 for high-confidence trades
- **Scaling down**: Use risk factors < 1.0 for uncertain trades
- **Never exceed**: Risk factors that would risk more than your comfort level
### Multiple Timeframe Analysis
- Use different risk factors for different timeframes
- Consider correlation between positions
- Adjust trading allocation based on market conditions
## Disclaimer
This tool is for educational and planning purposes only. Always verify calculations manually and consider market conditions, liquidity, and correlation between positions. The automated risk calculation assumes you're comfortable with the mathematical relationship between portfolio allocation and individual trade risk. Past performance doesn't guarantee future results, and all trading involves risk of loss.
Easy Position Size Calculator with Fees# Easy Position Size Calculator with Fees - Manual
## Overview
The Easy Position Size Calculator is a Pine Script indicator designed to help traders calculate the optimal position size for their trades while accounting for trading fees. This tool automatically determines whether you're planning a long or short position and calculates the exact position size needed to risk a specific dollar amount.
## Key Features
- **Automatic Trade Direction Detection**: Determines if you're going long or short based on entry price vs stop loss
- **Fee Integration**: Accounts for trading fees in position size calculations
- **Risk Management**: Calculates position size based on your specified risk amount
- **Risk Factor Adjustment**: Allows you to scale your position size up or down
- **Visual Display**: Shows all calculations in a clear, organized table
## Input Parameters
### Entry Price ($)
- **Purpose**: The price at which you plan to enter the trade
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Stop Loss ($)
- **Purpose**: The price at which you will exit the trade if it goes against you
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Risk ($)
- **Purpose**: The maximum dollar amount you're willing to lose on this trade
- **Default**: 0.0
- **Range**: Any positive value
- **Step**: 0.01
### Risk Factor
- **Purpose**: A multiplier to scale your position size up or down
- **Default**: 1.0 (no scaling)
- **Range**: 0.0 to 10.0
- **Step**: 0.1
- **Examples**:
- 1.0 = Normal position size
- 2.0 = Double the position size
- 0.5 = Half the position size
### Fee (%)
- **Purpose**: The percentage fee charged per transaction (buy/sell)
- **Default**: 0.01% (0.01)
- **Range**: 0.0% to 1.0%
- **Step**: 0.001
## How It Works
### Trade Direction Detection
The script automatically determines your trade direction:
- **Long Trade**: Entry price > Stop loss price
- **Short Trade**: Entry price < Stop loss price
### Position Size Calculation
#### For Long Trades:
```
Position Size = -Risk Factor × Risk Amount / (Stop Loss × (1 - Fee) - Entry Price × (1 + Fee))
```
#### For Short Trades:
```
Position Size = -Risk Factor × Risk Amount / (Entry Price × (1 - Fee) - Stop Loss × (1 + Fee))
```
### Fee Adjustment
The script accounts for fees on both entry and exit:
- **Long trades**: You pay fees when buying (entry) and selling (exit)
- **Short trades**: You pay fees when shorting (entry) and covering (exit)
## Output Display
The indicator displays a table with the following information:
### Trade Information
- **Trade Type**: Shows whether it's a LONG, SHORT, or INVALID trade
- **Entry Price**: Your specified entry price
- **Stop Loss**: Your specified stop loss price
- **Fee (%)**: The fee percentage being used
### Risk Parameters
- **Risk Amount**: The dollar amount you're willing to risk
- **Risk Factor**: The multiplier being applied
### Calculated Values
- **Effective Entry**: The actual cost per share including fees
- **Effective Exit**: The actual exit value per share including fees
- **Expected Loss**: The calculated loss if stop loss is hit
- **Deviation from Risk %**: Shows how close the expected loss is to your target risk
- **Position Size**: The number of shares/units to trade
## Usage Examples
### Example 1: Long Trade
- Entry Price: $100.00
- Stop Loss: $95.00
- Risk Amount: $500.00
- Risk Factor: 1.0
- Fee: 0.01%
**Result**: The script will calculate how many shares to buy so that if the stop loss is hit, you lose approximately $500 (accounting for fees). Position Size: 99.61152
### Example 2: Short Trade
- Entry Price: $50.00
- Stop Loss: $55.00
- Risk Amount: $300.00
- Risk Factor: 1.0
- Fee: 0.01%
**Result**: The script will calculate how many shares to short so that if the stop loss is hit, you lose approximately $300 (accounting for fees). Position Size: 59.87426
## Important Notes
### Validation Requirements
For the script to work properly, all of the following must be true:
- Entry price > 0
- Stop loss > 0
- Risk amount > 0
- Entry price ≠ Stop loss (to determine direction)
### Negative Position Sizes
The script may show negative position sizes, which is normal:
- **Negative values for long trades**: Represents shares to buy
- **Negative values for short trades**: Represents shares to short
### Risk Deviation
The "Deviation from Risk %" shows how closely the calculated position size matches your target risk. Small deviations are normal due to:
- Fee calculations
- Rounding
- Market precision
## Color Coding
The table uses color coding for easy identification:
- **Green**: Long trade information
- **Red**: Short trade information
- **Gray**: Invalid trade (when inputs are incorrect)
- **Blue**: Final position size
- **Red background**: Risk-related calculations
## Troubleshooting
### Common Issues
1. **Position Size shows 0**
- Check that all inputs are greater than 0
- Ensure entry price is different from stop loss
2. **Trade Type shows INVALID**
- Verify that entry price and stop loss are both positive
- Make sure entry price ≠ stop loss
3. **Large Risk Deviation**
- This is normal for very small position sizes
- Consider adjusting your risk amount or price levels
## Best Practices
1. **Always validate your inputs** before placing actual trades
2. **Double-check the trade direction** shown in the table
3. **Review the expected loss** to ensure it aligns with your risk management
4. **Consider the effective entry/exit prices** which include fees
5. **Use appropriate risk factors** - avoid extreme values that could lead to overexposure
## Disclaimer
This tool is for educational and planning purposes only. Always verify calculations manually and consider market conditions, liquidity, and other factors before placing actual trades. The script assumes that fees are charged on both entry and exit transactions.
My script/@version=5
indicator("20 SMA Cross 200 SMA", overlay=true)
sma20 = ta.sma(close, 20)
sma200 = ta.sma(close, 200)
plot(sma20, color=color.blue)
plot(sma200, color=color.red)
longSignal = ta.crossover(sma20, sma200)
plotshape(longSignal, title="20/200 Cross", location=location.belowbar, color=color.green, style=shape.labelup)
Forex Dynamic Momentum Reversal (FDMR) - AlternativeRed and green dashed lines on the last bar represent the upper and lower volatility bands, extending from the previous bar.
Blue and orange labels on the last bar show the fast and slow EMA values.
Green triangles below bars indicate buy signals; red triangles above bars indicate sell signals.
Enable Alerts: Set up alerts in TradingView for buy/sell signals.