Dynamic Swing Anchored VWAP STRAT (Zeiierman/PineIndicators)Dynamic Swing Anchored VWAP STRATEGY — Zeiierman × PineIndicators (Pine Script v6)
A pivot-to-pivot Anchored VWAP strategy that adapts to volatility, enters long on bullish structure, and closes on bearish structure. Built for TradingView in Pine Script v6.
Full credits to zeiierman.
Repainting notice: The original indicator logic is repainting. Swing labels (HH/HL/LH/LL) are finalized after enough bars have printed, so labels do not occur in real time. It is not possible to execute at historical label points. Treat results as educational and validate with Bar Replay and paper trading before considering any discretionary use.
Concept
The script identifies swing highs/lows over a user-defined lookback ( Swing Period ). When structure flips (most recent swing low is newer than the most recent swing high, or vice versa), a new regime begins.
At each confirmed pivot, a fresh Anchored VWAP segment is started and updated bar-by-bar using an EWMA-style decay on price×volume and volume.
Responsiveness is controlled by Adaptive Price Tracking (APT) . Optionally, APT auto-adjusts with an ATR ratio so that high volatility accelerates responsiveness and low volatility smooths it.
Longs are opened/held in bullish regimes and closed when the regime turns bearish. No short positions are taken by design.
How it works (under the hood)
Swing detection: Uses ta.highestbars / ta.lowestbars over prd to update swing highs (ph) and lows (pl), plus their bar indices (phL, plL).
Regime logic: If phL > plL → bullish regime; else → bearish regime. A change in this condition triggers a re-anchor of the VWAP at the newest pivot.
Adaptive VWAP math: APT is converted to an exponential decay factor ( alphaFromAPT ), then applied to running sums of price×volume and volume, producing the current VWAP estimate.
Rendering: Each pivot-anchored VWAP segment is drawn as a polyline and color-coded by regime. Optional structure labels (HH/HL/LH/LL) annotate the swing character.
Orders: On bullish flips, strategy.entry("L") opens/maintains a long; on bearish flips, strategy.close("L") exits.
Inputs & controls
Swing Period (prd) — Higher values identify larger, slower swings; lower values catch more frequent pivots but add noise.
Adaptive Price Tracking (APT) — Governs the VWAP’s “half-life.” Smaller APT → faster/closer to price; larger APT → smoother/stabler.
Adapt APT by ATR ratio — When enabled, APT scales with volatility so the VWAP speeds up in turbulent markets and slows down in quiet markets.
Volatility Bias — Tunes the strength of APT’s response to volatility (above 1 = stronger effect; below 1 = milder).
Style settings — Colors for swing labels and VWAP segments, plus line width for visibility.
Trade logic summary
Entry: Long when the swing structure turns bullish (latest swing low is more recent than the last swing high).
Exit: Close the long when structure turns bearish.
Position size: qty = strategy.equity / close × 5 (dynamic sizing; scales with account equity and instrument price). Consider reducing the multiplier for a more conservative profile.
Recommended workflow
Apply to instruments with reliable volume (equities, futures, crypto; FX tick volume can work but varies by broker).
Start on your preferred timeframe. Intraday often benefits from smaller APT (more reactive); higher timeframes may prefer larger APT (smoother).
Begin with defaults ( prd=50, APT=20 ); then toggle “Adapt by ATR” and vary Volatility Bias to observe how segments tighten/loosen.
Use Bar Replay to watch how pivots confirm and how the strategy re-anchors VWAP at those confirmations.
Layer your own risk rules (stops/targets, max position cap, session filters) before any discretionary use.
Practical tips
Context filter: Consider combining with a higher-timeframe bias (e.g., daily trend) and using this strategy as an entry timing layer.
First pivot preference: Some traders prefer only the first bullish pivot after a bearish regime (and vice versa) to reduce whipsaw in choppy ranges.
Deviations: You can add VWAP deviation bands to pre-plan partial exits or re-entries on mean-reversion pulls.
Sessions: Session-based filters (RTH vs. ETH) can materially change behavior on futures and equities.
Extending the script (ideas)
Add stops/targets (e.g., ATR stop below last swing low; partial profits at k×VWAP deviation).
Introduce mirrored short logic for two-sided testing.
Include alert conditions for regime flips or for price-VWAP interactions.
Incorporate HTF confirmation (e.g., only long when daily VWAP slope ≥ 0).
Throttle entries (e.g., once per regime flip) to avoid over-trading in ranges.
Known limitations
Repainting: Swing labels and pivot confirmations depend on future bars; historical labels can look “perfect.” Treat them as annotations, not executable signals.
Execution realism: Strategy includes commission and slippage fields, yet actual fills differ by venue/liquidity.
No guarantees: Past behavior does not imply future results. This publication is for research/education only and not financial advice.
Defaults (backtest environment)
Initial capital: 10,000
Commission value: 0.01
Slippage: 1
Overlay: true
Max bars back: 5000; Max labels/polylines set for deep swing histories
Quick checklist
Add to chart and verify that the instrument has volume.
Use defaults, then tune APT and Volatility Bias with/without ATR adaptation.
Observe how each pivot re-anchors VWAP and how regime flips drive entries/exits.
Paper trade across several symbols/timeframes before any discretionary decisions.
Attribution & license
Original indicator concept and logic: Zeiierman — please credit the author.
Strategy wrapper and publication: PineIndicators .
License: CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike). Respect the license when forking or publishing derivatives.
Indicatori e strategie
VWAP Trend Strategy (Intraday) [KedarArc Quant]Description:
An intraday strategy that anchors to VWAP and only trades when a local EMA trend gate and a volume participation gate are both open. It offers two entry templates—Cross and Cross-and-Retest—with an optional Momentum Exception for impulsive moves. Exits combine a TrendBreak (structure flips) with an ATR emergency stop (risk cap).
Updates will be published under this script.
Why this merits a new script
This is not a simple “VWAP + EMA + ATR” overlay. The components are sequenced as gates and branches that *change the trade set* in ways a visual mashup cannot:
1. Trend Gate first (EMA fast vs. slow on the entry timeframe)
Counter-trend VWAP crosses are suppressed. Many VWAP scripts fire on every cross; here, no entry logic even evaluates unless the trend gate is open.
2. Participation Gate second (Volume SMA × multiplier)
This gate filters thin liquidity moves around VWAP. Without it, the same visuals would produce materially more false triggers.
3. Branching entries with structure awareness
* Cross: Immediate VWAP cross in the trend direction.
* Cross-and-Retest: Requires a revisit to VWAP vicinity within a lookback window (recent low near VWAP for longs; recent high for shorts). This explicitly removes first-touch fakeouts that a plain cross takes.
* Momentum Exception (optional): A quantified body% + volume condition can bypass the retest when flow is impulsive—intentional risk-timing, not “just another indicator.”
4. Dual exits that reference both anchor and structure
* TrendBreak: Close only when price loses VWAP and EMA alignment flips.
* ATR stop: Placed at entry to cap tail risk.
These exits complement the entry structure rather than being generic stop/target add-ons.
What it does
* Trades the session’s fair value anchor (VWAP), but only with local-trend agreement (EMA fast vs. slow) and sufficient participation (volume filter).
* Lets you pick Cross or Cross-and-Retest entries; optionally allow a fast Momentum Exception when candles expand with volume.
* Manages positions with a structure exit (TrendBreak) and an emergency ATR stop from entry.
How it works (concepts & calculations)
* VWAP (session anchor):
Standard VWAP of the active session; entries reference the cross and the retest proximity to VWAP.
* Trend gate:
Long context only if `EMA(fast) > EMA(slow)`; short only if `EMA(fast) < EMA(slow)`.
A *gate*, not a trigger—entries aren’t considered unless this is true.
* Participation (volume) gate:
Require `volume > SMA(volume, volLen) × volMult`.
Screens out low-participation wiggles around VWAP.
Entries:
* Cross: Price crosses VWAP in the trend direction while volume gate is open.
* Cross-and-Retest: After crossing, price revisits VWAP vicinity within `lookback` (recent *low near VWAP* for longs; recent *high near VWAP* for shorts).
* Momentum Exception (optional): If body% (|close−open| / range) and volume exceed thresholds, enter without waiting for the retest.
Exits:
* TrendBreak (structure):
* Longs close when `price < VWAP` and `EMA(fast) < EMA(slow)` (mirror for shorts).
* ATR stop (risk):
* From entry: `stop = entry ± ATR(atrLen) × atrMult`.
How to use it ?
1. Select market & timeframe: Intraday on liquid symbols (equities, futures, crypto).
2. Pick entry mode:
* Start with Cross-and-Retest for fewer, more selective signals.
* Enable Momentum Exception if strong moves leave without retesting.
3. Tune guards:
* Raise `volMult` to ignore thin periods; lower it for more activity.
* Adjust `lookback` if retests come late/early on your symbol.
4. Risk:
* `atrLen` and `atrMult` set the emergency stop distance.
5. Read results per session: Optional panel (if enabled) summarizes Net-R, Win%, and PF for today’s session to evaluate
behavior regime by regime.
⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
Penguin Volatility State StrategyThe Penguin Volatility State Strategy is a comprehensive technical analysis framework designed to identify the underlying "state" or "regime" of the market. Instead of just providing simple buy or sell signals, its primary goal is to classify the market into one of four distinct states by combining trend, momentum, and volatility analysis.
The core idea is to trade only when these three elements align, focusing on periods of volatility expansion (a "squeeze breakout") that occur in the direction of a confirmed trend and are supported by strong momentum.
Key Components
The strategy is built upon two main engines
The Volatility Engine (Bollinger Bands vs. Keltner Channels)
This engine detects periods of rapidly increasing volatility. It measures the percentage difference (diff) between the upper bands of Bollinger Bands (which are based on standard deviation) and Keltner Channels (based on Average True Range). During a volatility "squeeze," both bands are close. When price breaks out, the Bollinger Band expands much faster than the Keltner Channel, causing the diff value to become positive. A positive diff signals a volatility breakout, which is the moment the strategy becomes active.
The Trend & Momentum Engine (Multi-EMA System)
This engine determines the market's direction and strength. It uses:
A Fast EMA (e.g., 12-period) and a Slow EMA (e.g., 26-period): The crossover of these two moving averages defines the primary, underlying trend (similar to a MACD).
An Ultra-Fast EMA (e.g., 2-period of ohlc4): This is used to measure the immediate, short-term momentum of the price.
The Four Market States
By combining the Trend and Momentum engines, the strategy categorizes the market into four visually distinct states, represented by the chart's background color. This is the most crucial aspect of the system.
💚 Green State: Strong Bullish
The primary trend is UP (Fast EMA > Slow EMA) AND the immediate momentum is STRONG (Price > Fast EMA).
Interpretation: This represents a healthy, robust uptrend where both the underlying trend and short-term price action are aligned. It is considered the safest condition for taking long positions.
❤️ Red State: Strong Bearish
Condition: The primary trend is DOWN (Fast EMA < Slow EMA) AND the immediate momentum is WEAK (Price < Fast EMA).
Interpretation: This represents a strong, confirmed downtrend. It is considered the safest condition for taking short positions.
💛 Yellow State: Weakening Bullish / Pullback
Condition: The primary trend is UP (Fast EMA > Slow EMA) BUT the immediate momentum is WEAK (Price < Fast EMA).
Interpretation: This is a critical warning signal for bulls. While the larger trend is still up, the short-term price action is showing weakness. This could be a minor pullback, a period of consolidation, or the very beginning of a trend reversal. Caution is advised.
💙 Blue State: Weakening Bearish / Relief Rally
Condition: The primary trend is DOWN (Fast EMA < Slow EMA) BUT the immediate momentum is STRONG (Price > Fast EMA).
Interpretation: This signals that a downtrend is losing steam. It often represents a short-covering rally (a "bear market rally") or the first potential sign of a market bottom. Bears should be cautious and consider taking profits.
How the Strategy Functions
The strategy uses these four states as its foundation for making trading decisions. The entry and exit arrows (Long, Short, Close) are generated based on a set of rules that can be customized by the user. For instance, a trader can configure the strategy to
Only take long trades during the Green State.
Require a confirmed volatility breakout (diff > 0) before entering a trade.
Use the "RSI on Diff" indicator to ensure that the breakout is supported by accelerating momentum.
Summary
In essence, the Penguin Volatility State Strategy provides a powerful "dashboard" for viewing the market. It moves beyond simple indicators to offer a contextual understanding of price action. By waiting for the alignment of Trend (the State), Volatility (the Breakout), and Momentum (the Acceleration), it helps traders to identify higher-probability setups and, just as importantly, to know when it is better to stay out of the market.
License / disclaimer
© waranyu.trkm — MIT License. Educational use only; not financial advice.
Tristan's Box: Pre-Market Range Breakout + RetestMarket Context:
This is designed for U.S. stocks, focusing on pre-market price action (4:00–9:30 AM ET) to identify key support/resistance levels before the regular session opens.
Built for 1 min and 5 min timelines, and is intended for day trading / scalping.
Core Idea:
Pre-market range (high/low) often acts as a magnet for price during regular hours.
The first breakout outside this range signals potential strong momentum in that direction.
Retest of the breakout level confirms whether the breakout is valid, avoiding false moves.
Step-by-Step Logic:
Pre-Market Range Identification:
Track high and low from 4:00–9:30 AM ET.
Draw a box spanning this range for visual reference and calculation.
Breakout Detection:
When the first candle closes above the pre-market high → long breakout.
When the first candle closes below the pre-market low → short breakout.
The first breakout candle is highlighted with a “YOLO” label for visual confirmation.
Retest Confirmation:
Identify the first candle whose wick touches the pre-market box (high touches top for short, low touches bottom for long).
Wait for the next candle: if it closes outside the box, it confirms the breakout.
Entry Execution:
Long entry: on the confirming candle after a wick-touch above the pre-market high.
Short entry: on the confirming candle after a wick-touch below the pre-market low.
Only the first valid entry per direction per day is taken.
Visuals & Alerts:
Box represents pre-market high/low.
Top/bottom box border lines show the pre-market high / low levels cleanly.
BUY/SELL markers are pinned to the confirming candle.
Added a "YOLO" marker on breakout candle.
Alert conditions trigger when a breakout is confirmed by the retest.
Strategy Type:
Momentum breakout strategy with confirmation retest.
Combines pre-market structure and risk-managed entries.
Designed to filter false breakouts by requiring confirmation on the candle after the wick-touch.
In short, it’s a pre-market breakout momentum strategy: it uses the pre-market high/low as reference, waits for a breakout, and then enters only after a confirmation retest, reducing the chance of entering on a false spike.
Always use good risk management.
GK Momentum Crossover with Risk MgmtThe **GK Momentum Crossover with Risk Mgmt** strategy is a trend-following Pine Script v5 strategy for TradingView, trading 1 unit. It uses:
- **Entry**: Buys when the 9-period EMA crosses above the 21-period EMA (bullish) with volume above its 20-period SMA; sells when the 9-period EMA crosses below (bearish).
- **Risk Management**:
- Fixed stop loss (e.g., $10 below/above entry for long/short).
- Trailing stop activates after a $10 profit, trailing by $5.
- Optional fixed take profit (e.g., $20) is commented out.
- **Goal**: Captures trends while limiting drawdown via absolute price-based stops, suitable for stocks, forex, or crypto. Adjustable inputs for SL, TP, and trailing thresholds.
LONG Daily Candle (MACD)LONG Daily Candle (MACD)
A long-entry strategy based on the daily bullish candle (SC) with filters by EMA200, EMA20, volume, and MACD (modes: Spring / Spring+Summer / No filter).
Risk management via ATR: customizable SL and TP, position sizing based on account capital and risk percentage.
Includes an optional breakeven shift once 1RR is reached.
LONG Daily Candle (MACD)
Стратегия входа в лонг по дневной бычьей свече (SC) с фильтрами по EMA200, EMA20, объёму и MACD (режимы: весна / весна+лето / без фильтра).
Управление риском через ATR: настраиваемые SL и TP, расчёт размера позиции от капитала и процента риска.
Есть опция перевода позиции в безубыток при достижении 1RR.
DNSE VN301!, ADX Momentum StrategyDiscover the tailored Pine Script for trading VN30F1M Futures Contracts intraday.
This strategy applies the Statistical Method (IQR) to break down the components of the ADX, calculating the threshold of "normal" momentum fluctuations in price to identify potential breakouts for entry and exit signals. The script automatically closes all positions by 14:30 to avoid overnight holdings.
www.tradingview.com
Settings & Backtest Results:
- Chart: 30-minute timeframe
- Initial capital: VND 100 million
- Position size: 4 contracts per trade (includes trading fees, excludes tax)
- Backtest period: Sep-2021 to Sep-2025
- Return: over 270% (with 5 ticks slippage)
- Trades executed: 1,000+
- Win rate: ~40%
- Profit factor: 1.2
Default Script Settings:
Calculates the acceleration of changes in the +DI and -DI components of the ADX, using IQR to define "normal" momentum fluctuations (adjustable via Lookback period).
Calculates the difference between each bar’s Open and Close prices, using IQR to define "normal" gaps (adjustable via Lookback period).
Entry & Exit Conditions:
Entry Long: Change in +DI or -DI > Avg IQR Value AND Close Price > Previous Close
Exit Long: (all 4 conditions must be met)
- Change in +DI or -DI > Avg IQR Value
- RSI < Previous RSI
- Close–Open Gap > Avg IQR Gap
- Close Price < Previous Close
Entry Short: Change in +DI or -DI > Avg IQR Value AND Close Price < Previous Close
Exit Short: (all 4 conditions must be met)
- Change in +DI or -DI > Avg IQR Value
- RSI > Previous RSI
- Close–Open Gap > Avg IQR Gap
- Close Price > Previous Close
Disclaimers:
Trading futures contracts carries a high degree of risk, and price movements can be highly volatile. This script is intended as a reference tool only. It should be used by individuals who fully understand futures trading, have assessed their own risk tolerance, and are knowledgeable about the strategy’s logic.
All investment decisions are the sole responsibility of the user. DNSE bears no liability for any potential losses incurred from applying this strategy in real trading. Past performance does not guarantee future results. Please contact us directly if you have specific questions about this script.
RSI Momentum Trend MM with Risk Per Trade [MTF]This is a comprehensive and highly customizable trend-following strategy based on RSI momentum. The core logic identifies strong directional moves when the RSI crosses user-defined thresholds, combined with an EMA trend confirmation. It is designed for traders who want granular control over their strategy's parameters, from signal generation to risk management and exit logic.
This script evolves a simple concept into a powerful backtesting tool, allowing you to test various money management and trade management theories across different timeframes.
Key Features
- RSI Momentum Signals: Uses RSI crosses above a "Positive" level or below a "Negative" level to generate trend signals. An EMA filter ensures entries align with the immediate trend.
- Multi-Timeframe (MTF) Analysis: The core RSI and EMA signals can be calculated on a higher timeframe (e.g., using 4H signals to trade on a 1H chart) to align trades with the larger trend. This feature helps to reduce noise and improve signal quality.
Advanced Money Management
- Risk per Trade %: Calculate position size based on a fixed percentage of equity you want to risk per trade.
- Full Equity: A more aggressive option to open each position with 100% of the available strategy equity.
Flexible Exit Logic: Choose from three distinct exit strategies to match your trading style
- Percentage (%) Based: Set a fixed Stop Loss and Take Profit as a percentage of the entry price.
- ATR Multiplier: Base your Stop Loss and Take Profit on the Average True Range (ATR), making your exits adaptive to market volatility.
- Trend Reversal: A true trend-following mode. A long position is held until an opposite "Negative" signal appears, and a short position is held until a "Positive" signal appears. This allows you to "let your winners run."
Backtest Date Range Filter: Easily configure a start and end date to backtest the strategy's performance during specific market periods (e.g., bull markets, bear markets, or high-volatility periods).
How to Use
RSI Settings
- Higher Timeframe: Set the timeframe for signal calculation. This must be higher than your chart's timeframe.
- RSI Length, Positive above, Negative below: Configure the core parameters for the RSI signals.
Money Management
Position Sizing Mode
- Choose "Risk per Trade" to use the Risk per Trade (%) input for precise risk control.
- Choose "Full Equity" to use 100% of your capital for each trade.
- Risk per Trade (%): Define the percentage of your equity to risk on a single trade (only works with the corresponding sizing mode).
SL/TP Calculation Mode
Select your preferred exit method from the dropdown. The strategy will automatically use the relevant inputs (e.g., % values, ATR Multiplier values, or the trend reversal logic).
Backtest Period Settings
Use the Start Date and End Date inputs to isolate a specific period for your backtest analysis.
License & Disclaimer
© waranyu.trkm — MIT License.
This script is for educational purposes only and should not be considered financial advice. Trading involves significant risk, and past performance is not indicative of future results. Always conduct your own research and risk assessment before making any trading decisions.
Script_Algo - Pivot Trend Rider Strategy📌 This strategy aims to enter a trade in the direction of the trend, catching a reversal point at the end of a correction.
The script is unique due to the combination of three key elements:
🔹 Detection of reversal points through searching for local lows and highs
🔹 Trend filter based on SMA for trading only in the trend direction
🔹 Adaptive risk management using ATR for dynamic stop-losses and take-profits
This allows the strategy to work effectively in various market conditions, minimizing false signals and adapting to market volatility.
⚙️ Principle of Operation
The strategy is based on the following logical components:
📈 Entry Signals:
Long: when a local low (pivot low) is detected in an uptrend
Short: when a local high (pivot high) is detected in a downtrend
📉 Position Management:
Stop-loss and take-profit are calculated based on ATR
Automatic reverse switching when an opposite signal appears
📊 Trend Filter:
Uses SMA to determine trend direction (can be disabled if needed)
🔧 Default Settings
Pivot detection: 11 bars
SMA filter length: 16 periods
ATR period: 14
SL multiplier: 2.5
TP multiplier: 10
Trend filter: enabled
🕒 Usage Recommendations
Timeframe: from 1 hour and above
Assets: cryptocurrency pairs, stocks
🤖 Trading Automation
This script is fully ready for integration with cryptocurrency exchanges via Webhook.
📊 Backtest Results
As seen from testing results, over 4.5 years this strategy could have potentially generated about $5000 profit or 50% of initial capital on the NAERUSDT crypto pair on the 4H timeframe.
Position size: $1000
Max drawdown: $1400
Total trades: 376
Win rate: 38%
Profit factor: 1.34
⚠️ Disclaimer
Please note that the results of the strategy are not guaranteed to repeat in the future. The market constantly changes, and no algorithm can predict exactly how an asset will behave.
The author of this strategy is not responsible for any financial losses associated with using this script.
All trading decisions are made solely by the user.
Trading financial markets carries high risks and can lead to loss of your investments.
Before using the strategy, it is strongly recommended to:
✅ Backtest the strategy on historical data
✅ Start with small trading volumes
✅ Use only risk capital you are ready to lose
✅ Fully understand how the strategy works
🔮 Further Development
The strategy will continue to evolve and improve. Planned updates include:
Adding additional filters to reduce false signals
Optimizing position management algorithms
Expanding functionality for various market conditions
💡 Wishing everyone good luck and profitable trading!
📈 May your charts be green and your portfolios keep growing!
Developed by Script_Algo | MIT License | Version 1.0
Recovery StrategyDescription:
The Recovery Strategy is a long-only trading system designed to capitalize on significant price drops from recent highs. It enters a position when the price falls 10% or more from the highest high over a 6-month lookback period and adds positions on further 2% drops, up to a maximum of 5 positions. Each trade is held for 6 months before exiting, regardless of profit or loss. The strategy uses margin to amplify position sizes, with a default leverage of 5:1 (20% margin requirement). All key parameters are customizable via inputs, allowing flexibility for different assets and timeframes. Visual markers indicate recent highs for reference.
How It Works:
Entry: Buys when the closing price drops 10% or more from the recent high (highest high in the lookback period, default 126 bars ~6 months). If already in a position, additional buys occur on further 2% drops (e.g., 12%, 14%, 16%, 18%), up to 5 positions (pyramiding).
Exit: Each trade exits after its own holding period (default 126 bars ~6 months), regardless of profit or loss. No stop loss or take-profit is used.
Margin: Uses leverage to control larger positions (default 20% margin, 5:1 leverage). The order size is a percentage of equity (default 100%), adjustable via inputs.
Visualization: Displays blue markers (without text) at new recent highs to highlight reference levels.
Inputs:
Lookback Period for High Peak (bars): Number of bars to look back for the recent high (default: 126, ~6 months on daily charts).
Initial Drop Percentage to Buy (%): Percentage drop from recent high to trigger the first buy (default: 10.0%).
Additional Drop Percentage to Buy (%): Further drop percentage to add positions (default: 2.0%).
Holding Period (bars): Number of bars to hold each position before selling (default: 126, ~6 months).
Order Size (% of Equity): Percentage of equity used per trade (default: 100%).
Margin for Long Positions (%): Percentage of position value covered by equity (default: 20%, equivalent to 5:1 leverage).
Usage:
Timeframe: Designed for daily charts (126 bars ~6 months). Adjust Lookback Period and Holding Period for other timeframes (e.g., 1008 hours for hourly charts, assuming 8 trading hours/day).
Assets: Suitable for stocks, ETFs, or other assets with significant price volatility. Test thoroughly on your chosen asset.
Settings: Customize inputs in the strategy settings to match your risk tolerance and market conditions. For example, lower Margin for Long Positions (e.g., to 10% for 10:1 leverage) to increase position sizes, but beware of higher risk.
Backtesting: Use TradingView’s Strategy Tester to evaluate performance. Check the “List of Trades” for skipped trades due to insufficient equity or margin requirements.
Risks and Considerations:
No Stop Loss: The strategy holds trades for the full 6 months without a stop loss, exposing it to significant drawdowns in prolonged downtrends.
Margin Risk: Leverage (default 5:1) amplifies both profits and losses. Ensure sufficient equity to cover margin requirements to avoid skipped trades or simulated margin calls.
Pyramiding: Up to 5 positions can be open simultaneously, increasing exposure. Adjust pyramiding in the code if fewer positions are desired (e.g., change to pyramiding=3).
Market Conditions: Performance depends on price drops and recoveries. Test on historical data to assess effectiveness in your market.
Broker Emulator: TradingView’s paper trading simulates margin but does not execute real margin trading. Results may differ in live trading due to broker-specific margin rules.
How to Use:
Add the strategy to your chart in TradingView.
Adjust input parameters in the settings panel to suit your asset, timeframe, and risk preferences.
Run a backtest in the Strategy Tester to evaluate performance.
Monitor open positions and margin levels in the Trading Panel to manage risk.
For live trading, consult your broker’s margin requirements and leverage policies, as TradingView’s simulation may not match real-world conditions.
Disclaimer:
This strategy is for educational purposes only and does not constitute financial advice. Trading involves significant risk, especially with leverage and no stop loss. Always backtest thoroughly and consult a financial advisor before using any strategy in live trading.
5 EMA Close/Open Cross StrategyLong Entry - 5 EMA Close crossing above 5 EMA open
exit - 5 EMA Close crossing below 5 EMA open
Short entry - 5 EMA Close crossing below 5 EMA open
exit - 5 EMA Close crossing above 5 EMA open
Panel Pro+ 3.4.8Panel Pro+ Perform commercial operations, based on price analysis and signal quality based on percentage
huzaifa iqbal pakistanthis is custum only for mazaq //@version=6
strategy("UT Bot Long Only Strategy", overlay=true, pyramiding=0, initial_capital=10000, currency=currency.USD)
// Parameters for ATR-based trailing stop (UT Bot logic)
var int atrLength = 10 // ATR period length
var float atrMult = 5.0 // ATR multiplier for trailing stop
// Calculate ATR and the ATR-based stop distance (nLoss)
atrValue = ta.atr(atrLength)
nLoss = atrMult * atrValue
// ATR Trailing Stop logic (UT Bot)
// Using persistent variable 'trailingStop' to maintain state across bars
var float trailingStop = na
if na(trailingStop )
// Initialize trailing stop on first bar
trailingStop := close - nLoss
else if (close > trailingStop and close > trailingStop )
// Price is above trailing stop and was above it in previous bar -> uptrend continues
trailingStop := math.max(trailingStop , close - nLoss)
else if (close < trailingStop and close < trailingStop )
// Price is below trailing stop and was below it in previous bar -> downtrend continues
trailingStop := math.min(trailingStop , close + nLoss)
else if (close > trailingStop )
// Price crossed from below to above the trailing stop -> trend flips up (new long setup)
trailingStop := close - nLoss
else
// Price crossed from above to below the trailing stop -> trend flips down
trailingStop := close + nLoss
// Long entry signal: when price crosses above the trailing stop from below
bool longSignal = (close < trailingStop and close > trailingStop )
// Enter long position on UT Bot buy signal (price crossing above trailing stop)
if (longSignal)
strategy.entry("Long", strategy.long, comment="UT Bot Buy Signal")
// Exit conditions: take-profit at +10% and stop-loss at -0.10% from entry price
// We hold until TP or SL is hit; no early exit on UT Bot sell signals
if (strategy.position_size > 0)
// Calculate profit target and stop loss based on entry price
float entryPrice = strategy.position_avg_price
float takeProfit = entryPrice * 1.10 // +//@version=6
strategy("UT Bot Long Only Strategy", overlay=true, pyramiding=0, initial_capital=10000, currency=currency.USD)
// Parameters for ATR-based trailing stop (UT Bot logic)
var int atrLength = 10 // ATR period length
var float atrMult = 5.0 // ATR multiplier for trailing stop
// Calculate ATR and the ATR-based stop distance (nLoss)
atrValue = ta.atr(atrLength)
nLoss = atrMult * atrValue
// ATR Trailing Stop logic (UT Bot)
// Using persistent variable 'trailingStop' to maintain state across bars
var float trailingStop = na
if na(trailingStop )
// Initialize trailing stop on first bar
trailingStop := close - nLoss
else if (close > trailingStop and close > trailingStop )
// Price is above trailing stop and was above it in previous bar -> uptrend continues
trailingStop := math.max(trailingStop , close - nLoss)
else if (close < trailingStop and close < trailingStop )
// Price is below trailing stop and was below it in previous bar -> downtrend continues
trailingStop := math.min(trailingStop , close + nLoss)
else if (close > trailingStop )
// Price crossed from below to above the trailing stop -> trend flips up (new long setup)
trailingStop := close - nLoss
else
// Price crossed from above to below the trailing stop -> trend flips down
trailingStop := close + nLoss
// Long entry signal: when price crosses above the trailing stop from below
bool longSignal = (close < trailingStop and close > trailingStop )
// Enter long position on UT Bot buy signal (price crossing above trailing stop)
if (longSignal)
strategy.entry("Long", strategy.long, comment="UT Bot Buy Signal")
// Exit conditions: take-profit at +10% and stop-loss at -0.10% from entry price
// We hold until TP or SL is hit; no early exit on UT Bot sell signals
if (strategy.position_size > 0)
// Calculate profit target and stop loss based on entry price
float entryPrice = strategy.position_avg_price
//@version=6
strategy("UT Bot Long Only Strategy", overlay=true, pyramiding=0, initial_capital=10000, currency=currency.USD)
// Parameters for ATR-based trailing stop (UT Bot logic)
var int atrLength = 10 // ATR period length
var float atrMult = 5.0 // ATR multiplier for trailing stop
// Calculate ATR and the ATR-based stop distance (nLoss)
atrValue = ta.atr(atrLength)
nLoss = atrMult * atrValue
// ATR Trailing Stop logic (UT Bot)
// Using persistent variable 'trailingStop' to maintain state across bars
var float trailingStop = na
if na(trailingStop )
// Initialize trailing stop on first bar
trailingStop := close - nLoss
else if (close > trailingStop and close > trailingStop )
// Price is above trailing stop and was above it in previous bar -> uptrend continues
trailingStop := math.max(trailingStop , close - nLoss)
else if (close < trailingStop and close < trailingStop )
// Price is below trailing stop and was below it in previous bar -> downtrend continues
trailingStop := math.min(trailingStop , close + nLoss)
else if (close > trailingStop )
// Price crossed from below to above the trailing stop -> trend flips up (new long setup)
trailingStop := close - nLoss
else
// Price crossed from above to below the trailing stop -> trend flips down
trailingStop := close + nLoss
// Long entry signal: when price crosses above the trailing stop from below
bool longSignal = (close < trailingStop and close > trailingStop )
// Enter long position on UT Bot buy signal (price crossing above trailing stop)
if (longSignal)
strategy.entry("Long", strategy.long, comment="UT Bot Buy Signal")
// Exit conditions: take-profit at +10% and stop-loss at -0.10% from entry price
// We hold until TP or SL is hit; no early exit on UT Bot sell signals
if (strategy.position_size > 0)
// Calculate profit target and stop loss based on entry price
float entryPrice = strategy.position_avg_price
float takeProfit = entryPrice * 1.10 // +10%
float stopLoss = entryPrice * 0.999 // -0.10%
strategy.exit("ExitLong", "Long", limit=takeProfit, stop=stopLoss)
// Plot the ATR-based trailing stop for visualization (green when trend is up, red when down)
plot(trailingStop, "Trailing Stop", color = close >= trailingStop ? color.lime : color.red, style=plot.style_line)
float stopLoss = entryPrice * 0.999 // -0.10%
strategy.exit("ExitLong", "Long", limit=takeProfit, stop=stopLoss)
// Plot the ATR-based trailing stop for visualization (green when trend is up, red when down)
plot(trailingStop, "Trailing Stop", color = close >= trailingStop ? color.lime : color.red, style=plot.style_line)
10%
float stopLoss = entryPrice * 0.999 // -0.10%
strategy.exit("ExitLong", "Long", limit=takeProfit, stop=stopLoss)
// Plot the ATR-based trailing stop for visualization (green when trend is up, red when down)
plot(trailingStop, "Trailing Stop", color = close >= trailingStop ? color.lime : color.red, style=plot.style_line)
CryptoThunder Storm v1.21CryptoThunder Storm v1.21 — Strategy (non-repainting, HTF-aware)
CryptoThunder Storm is a Pine v6 strategy that trades the cross of two moving-average variants computed on an alternate (higher) timeframe derived from your current chart. It’s built to be non-repainting by evaluating signals only at HTF bar boundaries and by avoiding lookahead. The script can trade LONG, SHORT, BOTH, or be disabled, and it includes a one-click invert Long/Short mode.
How it works
Two MA streams (Open/Close series).
You can choose from multiple MA types (SMA/EMA/DEMA/TEMA/WMA/VWMA/SMMA/Hull/LSMA/ALMA/SSMA/TMA). The script computes:
closeSeries – MA of the (possibly delayed) close
openSeries – MA of the (possibly delayed) open
Alternate Resolution (HTF).
The inputs allow you to multiply your current chart’s timeframe (e.g., on 5m with multiplier 3 → HTF = 15m). Both series are requested via request.security() with lookahead_off.
Non-repainting gating.
Signals are evaluated once per HTF bar (htfClosed gate). This ensures entries/alerts are aligned with HTF boundaries and prevents forward-shifting.
Entry logic.
Long when closeSeriesAlt crosses above openSeriesAlt.
Short when closeSeriesAlt crosses below openSeriesAlt.
Invert mode swaps these actions (a former long signal opens a short, and vice versa).
Orders are processed on bar close (process_orders_on_close=true).
Risk management (optional).
Optional initial TP/SL exits via strategy.exit() (ticks/points). Set 0 to disable.
Visuals.
The script colors bars (optional) and plots the two HTF series with a filled band, plus compact UP/DN/CL markers that match the executed side after inversion/filtering.
Inputs & configuration
Use Alternate Resolution?
Turns the HTF logic on/off. When off, the strategy uses the chart timeframe.
Multiplier for Alternate Resolution
Multiplies the current timeframe to form the HTF (e.g., 3×).
MA Type / Period / Offsets
MA Type — choose from 12 variants.
MA Period — core length.
Offset for LSMA / Sigma for ALMA — MA-specific tuning.
Offset for ALMA — center of mass for ALMA.
Delay Open/Close MA — shifts the source back by n bars for a more conservative (non-peek) calculation. Keep at 0 unless you know you want extra delay.
Show coloured Bars to indicate Trend?
Colors bars relative to HTF band.
What trades should be taken: LONG / SHORT / BOTH / NONE
Filters which sides are actually traded.
Invert Long/Short logic?
Swaps long ↔ short everywhere (orders, markers, JSON alerts).
Backtest window (Number of Bars for Back Testing)
Crude limiter to speed up testing. 0 = test full history.
TP/SL (Initial Stop Loss / Target Profit Points)
Values in ticks/points. 0 disables. They apply to both sides via strategy.exit().
Alert options
Turn on alerts (JSON)
Show alert marks (UP/DOWN/CLOSE)
Send CLOSE alerts (toggle)
The strategy fires alert() internally. Create an alert on “Any alert() function call”.
The payload is a simple JSON string:{ "text":"C98USDT.P UP"}
Messages:
UP — a long entry was executed (or, with Invert on: the inverted long signal that opens a long).
DOWN — a short entry executed.
CLOSE — position closed or flipped.
Tip: If you want to route long/short to different webhooks, parse the text field for UP, DOWN, or CLOSE
Plotting & markers
Band: Fills between the two HTF MA lines.
Bar color (optional): Quick visual trend cue.
Markers:
▲ “UP” below bar when a long executes.
▼ “DN” above bar when a short executes.
✖ “CL” on position close/flip.
These reflect the final executed side, after trade filters and after Invert mode
Best practices & notes
Non-repainting design.
request.security(..., lookahead_off) prevents future data leakage.
Signals are gated to HTF bar boundaries, so you won’t get intra-HTF recalculations.
Strategy orders are processed at bar close.
Choosing the multiplier.
A 2×–4× multiplier often balances responsiveness vs stability (e.g., 5m→15m or 20m). Larger multipliers reduce churn and false signals.
TP/SL units.
Values are in ticks/points of the chart symbol. On crypto, check your instrument’s tick size and adjust accordingly.
Trade filters apply after inversion.
With invertLS = true and tradeType = LONG, only final longs (post-inversion) are allowed.
Strategy vs chart counts.
The Tester reports closed trades; your chart shows entries/markers including the latest open trade. This can explain 8 vs 12 discrepancies over short windows.
Performance.
calc_on_every_tick=false and the backtest limiter keep the script responsive on long histories.
Tips: user on mid-volume crypto pair, 1M chart, best MA is: SMMA, Hull, SSMA, DEMA, TEMA.
This strategy is for research and education. Markets carry risk; past performance doesn’t guarantee future results. Always forward-test on paper and validate your exchange execution, tick size, and fees before deploying live.
LP Sweep / Reclaim & Breakout Grading: Long-onlySignals
1) LP Sweep & Reclaim (mean-reversion entry)
Compute LP bounds from prior-bar window extremes:
lpLL_prev = lowest low of the last N bars (offset 1).
lpHH_prev = highest high of the last N bars (offset 1).
Sweep long trigger: current low dips below lpLL_prev and closes back above it.
Real-time quality grading (A/B/C) for sweep:
Trend filter & slope via EMA(88).
BOS bonus: close > last confirmed swing high.
Body size vs ATR, location above a long EMA, headroom to swing high (penalty if too close), and multi-sweep count bonus.
Sum → score → grade A/B/C; A or B required for sweep entry.
2) Trend Breakout (momentum entry)
Core trigger: close > previous Donchian high (length boLen) + ATR buffer.
Optional filter: close must be above the default EMA.
Breakout grading (A/B/C) in real time combining:
Trend up (price > EMA and EMA rising),
Body/ATR, Gap above breakout level (in ATR),
Volume vs MA,
Upper-wick penalty,
Position-in-Score: headroom to last swing high (penalty if too near) + EMA slope bonus.
Sum → score → A or B required if grading enabled.
Gann Fan Strategy [KedarArc Quant]Description
A single-concept, rule-based strategy that trades around a programmatic Gann Fan.
It anchors to a swing (or a manual point), builds 1×1 and related fan lines numerically, and triggers entries when price interacts with the 1×1 (breakout or bounce). Management is done entirely with the fan structure (next/previous line) plus optional ATR trailing.
What TV indicators are used
* Pivots: `ta.pivothigh/ta.pivotlow` to confirm swing highs/lows for anchor selection.
* ATR: `ta.atr` only to scale the 1×1 slope (optional) and for an optional trailing stop.
* EMA: `ta.ema` as a trend filter (e.g., only long above the EMA, short below).
No RSI/MACD/Stoch/Heikin/etc. The logic is one coherent framework: Gann price–time geometry, with ATR as a scale and EMA as a risk filter.
How it works
1. Anchor
* Auto: chooses the most recent *confirmed* pivot (you control Left/Right).
* Manual: set a price and bar index and the fan will hold that point (no re-anchoring).
* Optional Re-anchor when a newer pivot confirms.
2. 1×1 Slope (numeric, not cosmetic)
* ATR mode: `1×1 = ATR(Length) × Multiplier` (adapts to volatility).
* Fixed mode: `ticks per bar` (constant slope).
Because slope is numeric, it doesn’t change with chart zoom, unlike the drawing tool.
3. Fan Lines
Builds classic ratios around the 1×1: 1/8, 1/4, 1/3, 1/2, 1/1, 2/1, 3/1, 4/1, 8/1.
4. Signals
* Breakout: cross of price over/under the 1×1 in the EMA-aligned direction.
* Bounce (optional): touch + reversal across the 1×1 to reduce whipsaw.
5. Exits & Risk
* Take-profit at the next fan line; Stop at the previous fan line.
* If a level is missing (right after re-anchor), a fallback Risk-Reward (RR) is used.
* Optional ATR trailing stop.
Why this is unique
* True numeric fan: The 1×1 slope is calculated from ATR or fixed ticks—not from screen geometry—so it is scale-invariant and reproducible across users/timeframes.
* Deterministic anchor logic: Uses confirmed pivots (with your L/R settings). No look-ahead; anchors update only when the right bars complete.
* Fan-native trade management: Both entries and exits come from the fan structure itself (with a minimal ATR/EMA assist), keeping the method pure.
* Two entry archetypes: Breakout for momentum days; Bounce for range days—switchable without changing the core model.
* Manual mode: Lock a session’s bias by anchoring to a chosen swing (e.g., day’s first major low/high) and keep the fan constant all day.
Inputs (quick guide)
* Auto Anchor (Left/Right): pivot sensitivity. Higher values = fewer, stronger anchors.
* Re-anchor: refresh to newer pivots as they confirm.
* Manual Anchor Price / Bar Index: fixes the fan (turn Auto off).
* Scale 1×1 by ATR: on = adaptive; off = use ticks per bar.
* ATR Length / ATR Multiplier: controls adaptive slope; start around 14 / 0.25–0.35.
* Ticks per bar: exact fixed slope (match a hand-drawn fan by computing slope ÷ mintick).
* EMA Trend Filter: e.g., 50–100; trades only in EMA direction.
* Use Bounce: require touch + reverse across 1×1 (helps in chop).
* TP/SL at fan lines; Fallback RR for missing levels; ATR Trailing Stop optional.
* Transparency/Plot EMA: visual preferences.
Tips
* Range days: larger pivots (L/R 8–12), Bounce ON, ATR Multiplier \~0.30–0.40, EMA 100.
* Trend days: L/R 5–6, Breakout, Multiplier \~0.20–0.30, EMA 50, ATR trail 1.0–1.5.
* Match the TV Gann Fan drawing: turn ATR scale OFF, set ticks per bar = `(Δprice between anchor and 1×1 target) / (bars) / mintick`.
Repainting & testing notes
* Pivots require Right bars to confirm; anchors are set after confirmation (no look-ahead).
* Signals use the current bar close with TradingView strategy mechanics; real-time vs. bar-close can differ slightly, as with any strategy.
* Re-anchoring legitimately moves the structure when new pivots confirm—by design.
⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
Advanced Crypto Day Trading - Bybit Optimized mapercivEMA RSI ATR MACD trading script strategy with filters for weekdays
Fury by Tetrad on TESLA v2Fury by Tetrad — TSLA v2 (Free Version)
📊 Fury v2 on TSLA — Financial Snapshot
First trade: August 11, 2010
Last trade: September 5, 2025
Net Profit: $10,549.10 (≈ +10,549%)
Gross Profit: $10,554.36
Gross Loss: $5.26
Commission Paid: $86.95
⚖️ Risk/Return Ratios
Sharpe Ratio: 0.42
Sortino Ratio: 17.63
Profit Factor: 2005.38
🔄 Trade Statistics
Total Trades: 37
Winning Trades: 37
Losing Trades: 0
Win Rate: 100%
Fury is a momentum-reversion hybrid designed for Tesla (TSLA) on higher-liquidity timeframes. It combines Bollinger Bands (signal extremes) with RSI (exhaustion filter) to time mean-reversion pops/drops, then exits via price multipliers or optional time-based stops. A Market Direction toggle (Market Neutral / Long Only / Short Only) lets you align with macro bias or risk constraints. Intrabar simulation is enabled for realistic stop/limit behavior, and labeled entries/exits improve visual auditability.
How it works
Entries:
• Long when price pierces lower band and RSI is below the long threshold.
• Short when price pierces upper band and RSI is above the short threshold.
Exits:
• Profit targets via entry×multiplier (independent for long/short).
• Optional price-based stop factors per side.
• Optional time stop (N days) to cap trade duration.
Controls:
• Market Direction switch (Neutral / Long Only / Short Only).
• Tunable BB length/multiplier, RSI length/thresholds, exit multipliers, stops.
Intended use
Swing or position trading TSLA; can be adapted to other high-beta equities with parameter retuning. Use on liquid timeframes and validate with robust out-of-sample testing.
Disclaimers
Backtests are approximations; past performance ≠ future results. Educational use only. Not financial advice.
Stay connected
Follow on TradingView for updates • Telegram: t.me • Website: tetradprotocol.com
Higher Lows, Lower Highs & Failures with Signal Quality ScoringAn attempt at a higher low and lower high with scoring
dr.forexy strategy 1“Dear friends, please do not use this strategy on your own! This setup works best on the 5-minute timeframe. I hope it brings you great profits.”
Delayed X Exit Strategy - Final Versionattempt at a scored lowerhigh, higher lower delayed exit strat
Nifty 50 Scalping - Bullish Buy & Bearish Sell (5 Target / 2 SL)Nifty 50 Scalping - Bullish Buy & Bearish Sell (5 Target / 2 SL)
AlphaTrend Strategy – Advanced Trend & Momentum Trading SystemThe AlphaTrend Strategy is a powerful trading system designed to capture trend-following opportunities while filtering out low-quality setups.
It combines multiple layers of confirmation, including:
✅ AlphaTrend entry & exit signals based on dynamic ATR and MFI calculations
✅ Trend filter with customizable moving averages (SMA, EMA, WMA, VWMA, HMA)
✅ Momentum filter using ADX with optional DI+ / DI– checks
✅ Session-based trading to restrict entries to specific market hours
This script supports both long & short trades, provides session highlights, and plots risk-reward levels for better trade management.
Traders can fine-tune the multipliers, lookback periods, and filters to adapt the strategy across different assets and timeframes.
⚡ Ideal for forex, crypto, and indices where trend-following strategies thrive.