A TradingView Pine Script indicator designed for short-term swing trading and portfolio simulation.
The script combines trend analysis, momentum, relative strength, volume flow, volatility control, position scaling, profit protection, and simulated account tracking in one chart-based tool.
- Fast and slow EMA trend analysis
- Weekly trend confirmation
- RSI and MACD momentum filters
- Relative strength comparison against a market benchmark
- OBV-based volume flow analysis
- ATR volatility filtering
- Probe entries, starter buys, add-on buys, and full-position buys
- Partial exits and full exits
- Initial stop-loss protection
- Breakeven and profit-lock logic
- Drawdown and climax-run protection
- Strong-trend hold mode
- Simulated cash, position value, equity, and trade history
- Buy-and-hold benchmark comparison
- On-chart decision, portfolio, and trade-log panels
- TradingView alert conditions
two_week_swing_stock_advisor_english.pine
The indicator uses several groups of signals to evaluate entries and exits.
The script analyzes:
- Fast EMA
- Slow EMA
- Weekly EMA
- Daily and weekly trend alignment
- Trend repair and continuation
- Golden-cross and breakdown conditions
Momentum confirmation includes:
- RSI direction and level
- MACD line and signal relationship
- MACD histogram improvement
- Breakout and pullback behavior
The strategy can evaluate:
- Market benchmark health
- Relative strength
- Volume flow
- ATR-based volatility
- Bull-market confirmation
- Capital-preservation conditions
The default market benchmark is:
NASDAQ:QQQ
The simulated portfolio can use staged position sizing:
- Probe Buy
- Starter Buy
- Add Buy
- Full Buy
- Partial Exit
- Full Exit
Default target allocations are configurable from the indicator settings.
The script includes:
- Initial maximum-loss protection
- Breakeven protection
- Profit giveback control
- Profit-lock activation
- Major drawdown exits
- Climax-run protection
- Trend-break exits
- Strong Hold Mode for sustained bullish trends
- Open TradingView.
- Open a chart.
- Select Pine Editor.
- Copy the contents of
two_week_swing_stock_advisor_english.pine. - Paste the code into the editor.
- Click Save.
- Click Add to chart.
This script is primarily designed for daily charts and approximately two-week swing-trading analysis.
Before relying on its output:
- Review all settings for the selected asset.
- Load enough historical chart data.
- Confirm that the simulation start date is visible in the chart history.
- Test the logic on multiple assets and market regimes.
- Compare the simulated result with the buy-and-hold benchmark.
- Avoid treating individual labels as standalone trading instructions.
| Setting | Purpose |
|---|---|
| Fast EMA | Measures short-term trend |
| Slow EMA | Measures broader trend |
| Weekly EMA | Confirms higher-timeframe direction |
| Minimum Buy Score | Controls entry strictness |
| Minimum Add Score | Controls add-on entry strictness |
| Minimum Exit Score | Controls exit sensitivity |
| Minimum Holding Bars | Prevents premature exits |
| Initial Capital | Starting value for the simulation |
| Simulation Start Date | Defines when simulated trading begins |
| Market Benchmark | Reference symbol for market filtering |
| Capital Preservation Mode | Restricts entries in weak conditions |
| Strong Hold Minimum Score | Controls sustained-trend holding behavior |
The script provides alert conditions for:
- Starter Buy
- Add Buy
- Full Buy
- Risk Warning
- Partial Exit
- Full Exit
To create an alert:
- Add the indicator to a TradingView chart.
- Click Alerts.
- Select this indicator under Condition.
- Choose the desired signal.
- Configure the alert frequency and notification method.
- This is an
indicator(), not a TradingViewstrategy(). - Portfolio results are internally simulated by the script.
- Simulated trades do not include every real-world execution factor.
- Slippage, taxes, liquidity, spreads, and brokerage restrictions may materially affect actual results.
- The script should be tested and validated before any practical use.
This project is provided for educational, research, and software-development purposes only.
It does not constitute financial, investment, legal, or tax advice. No result, signal, label, alert, or simulated performance should be interpreted as a recommendation to buy or sell any security.
Past or simulated performance does not guarantee future results. You are responsible for your own research, risk management, and trading decisions.
No license has been granted unless a separate license file is added to this repository.
All rights are reserved by the repository owner.