Mustang Algo - Momentum Trend Zone Backtest๐ MUSTANG ALGO - Momentum Trend Zone Strategy
A complete trading system combining MACD momentum analysis with visual trend zones, full backtesting capabilities, and advanced risk management tools.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น OVERVIEW
Mustang Algo transforms traditional MACD analysis into a powerful visual trading system. It instantly identifies market bias through colored background zones and provides clear entry/exit signals with customizable stop loss and take profit management.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น KEY FEATURES
โ
Visual Trend Zones (Green = Bullish | Red = Bearish)
โ
Clear Buy/Sell Triangles on Chart
โ
Full Backtesting Engine
โ
Multiple Stop Loss Types
โ
Multiple Take Profit Types
โ
Trailing Stop Option
โ
Time Filter for Backtesting
โ
Real-time Info Panel
โ
Customizable Alerts
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น HOW IT WORKS
The strategy uses a smoothed MACD system to detect trend changes:
- MACD Line (White): Fast EMA minus Slow EMA - shows raw momentum
- Signal Line (Yellow): EMA of MACD - shows smoothed trend direction
- Trend Zone: Changes when the smoothed signal line crosses zero
- Entry Signals: Generated at zone transitions
When the trend line crosses above zero โ GREEN zone โ BUY signal ๐บ
When the trend line crosses below zero โ RED zone โ SELL signal ๐ป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น STOP LOSS OPTIONS
๐ Percentage: Fixed percentage from entry price
๐ ATR-Based: Dynamic SL based on market volatility
๐ Fixed Points: Set number of points/pips
๐ Swing Low/High: Uses recent swing levels as stops
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น TAKE PROFIT OPTIONS
๐ฏ Percentage: Fixed percentage target
๐ฏ ATR-Based: Dynamic TP based on volatility
๐ฏ Fixed Points: Set number of points/pips
๐ฏ Risk Reward: Automatic TP based on R:R ratio (e.g., 2:1, 3:1)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น TRAILING STOP
๐ Percentage-Based: Trail by a fixed percentage
๐ ATR-Based: Trail using ATR multiplier for dynamic adjustment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น SETTINGS
MACD Parameters:
- Fast Length (default: 12)
- Slow Length (default: 26)
- Signal Length (default: 9)
- Trend Smoothing (default: 5)
Risk Management:
- Enable/Disable Stop Loss
- Enable/Disable Take Profit
- Enable/Disable Trailing Stop
- Customize all SL/TP parameters
Visual Options:
- Show/Hide Buy/Sell Triangles
- Show/Hide SL/TP Lines
- Show/Hide Labels
Time Filter:
- Set Start Date for backtest
- Set End Date for backtest
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น SIGNALS EXPLAINED
๐ข GREEN TRIANGLE (Below Bar):
Bullish zone detected - Consider LONG entry
๐ด RED TRIANGLE (Above Bar):
Bearish zone detected - Consider SHORT entry
๐ข GREEN BACKGROUND:
Currently in bullish trend zone
๐ด RED BACKGROUND:
Currently in bearish trend zone
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น INFO PANEL
The real-time info panel (top right) displays:
- Current Trend Zone status
- MACD value
- Signal Line value
- Active SL Type
- Active TP Type
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น ALERTS
Set up alerts for:
๐ Buy Signals: "๐ Mustang Algo: BUY Signal on {ticker} at {price}"
๐ Sell Signals: "๐ Mustang Algo: SELL Signal on {ticker} at {price}"
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น BEST PRACTICES
1. Use higher timeframes (1H, 4H, Daily) for more reliable signals
2. Combine with price action and support/resistance levels
3. Adjust ATR multipliers based on asset volatility
4. Use Risk Reward ratio for consistent risk management
5. Backtest on your preferred asset before live trading
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น RECOMMENDED TIMEFRAMES
โฑ๏ธ Scalping: 5M, 15M (more signals, more noise)
โฑ๏ธ Day Trading: 1H, 4H (balanced signals)
โฑ๏ธ Swing Trading: Daily, Weekly (fewer but stronger signals)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐น MARKETS
Works on all markets:
๐ Forex
๐ Crypto
๐ Stocks
๐ Indices
๐ Commodities
๐ Futures
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ RIDE THE TREND WITH MUSTANG ALGO!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ DISCLAIMER
This indicator/strategy is for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always use proper risk management, do your own research, and consider consulting a financial advisor before making any trading decisions. Use at your own risk.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ VERSION HISTORY
v1.0 - Initial Release
- MACD-based trend detection
- Visual trend zones
- Multiple SL/TP options
- Full backtesting support
- Trailing stop functionality
- Time filter
- Info panel
- Alert system
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฌ FEEDBACK
If you find this strategy useful, please leave a comment or suggestion!
Your feedback helps improve future updates.
๐ Happy Trading!
Search in scripts for "backtesting"
Bifurcation Zone - CAEBifurcation Zone โ Cognitive Adversarial Engine (BZ-CAE)
Bifurcation Zone โ CAE (BZ-CAE) is a next-generation divergence detection system enhanced by a Cognitive Adversarial Engine that evaluates both sides of every potential trade before presenting signals. Unlike traditional divergence indicators that show every price-oscillator disagreement regardless of context, BZ-CAE applies comprehensive market-state intelligence to identify only the divergences that occur in favorable conditions with genuine probability edges.
The system identifies structural bifurcation points โ critical junctures where price and momentum disagree, signaling potential reversals or continuations โ then validates these opportunities through five interconnected intelligence layers: Trend Conviction Scoring , Directional Momentum Alignment , Multi-Factor Exhaustion Modeling , Adversarial Validation , and Confidence Scoring . The result is a selective, context-aware signal system that filters noise and highlights high-probability setups.
This is not a "buy the arrow" indicator. It's a decision support framework that teaches you how to read market state, evaluate divergence quality, and make informed trading decisions based on quantified intelligence rather than hope.
What Sets BZ-CAE Apart: Technical Architecture
The Problem With Traditional Divergence Indicators
Most divergence indicators operate on a simple rule: if price makes a higher high and RSI makes a lower high, show a bearish signal. If price makes a lower low and RSI makes a higher low, show a bullish signal. This creates several critical problems:
Context Blindness : They show counter-trend signals in powerful trends that rarely reverse, leading to repeated losses as you fade momentum.
Signal Spam : Every minor price-oscillator disagreement generates an alert, overwhelming you with low-quality setups and creating analysis paralysis.
No Quality Ranking : All signals are treated identically. A marginal divergence in choppy conditions receives the same visual treatment as a high-conviction setup at a major exhaustion point.
Single-Sided Evaluation : They ask "Is this a good long?" without checking if the short case is overwhelmingly stronger, leading you into obvious bad trades.
Static Configuration : You manually choose RSI 14 or Stochastic 14 and hope it works, with no systematic way to validate if that's optimal for your instrument.
BZ-CAE's Solution: Cognitive Adversarial Intelligence
BZ-CAE solves these problems through an integrated five-layer intelligence architecture:
1. Trend Conviction Score (TCS) โ 0 to 1 Scale
Most indicators check if ADX is above 25 to determine "trending" conditions. This binary approach misses nuance. TCS is a weighted composite metric:
Formula : 0.35 ร normalize(ADX, 10, 35) + 0.35 ร structural_strength + 0.30 ร htf_alignment
Structural Strength : 10-bar SMA of consecutive directional bars. Captures persistence โ are bulls or bears consistently winning?
HTF Alignment : Multi-timeframe EMA stacking (20/50/100/200). When all EMAs align in the same direction, you're in institutional trend territory.
Purpose : Quantifies how "locked in" the trend is. When TCS exceeds your threshold (default 0.80), the system knows to avoid counter-trend trades unless other factors override.
Interpretation :
TCS > 0.85: Very strong trend โ counter-trading is extremely high risk
TCS 0.70-0.85: Strong trend โ favor continuation, require exhaustion for reversals
TCS 0.50-0.70: Moderate trend โ context matters, both directions viable
TCS < 0.50: Weak/choppy โ reversals more viable, range-bound conditions
2. Directional Momentum Alignment (DMA) โ ATR-Normalized
Formula : (EMA21 - EMA55) / ATR14
This isn't just "price above EMA" โ it's a regime-aware momentum gauge. The same $100 price movement reads completely differently in high-volatility crypto versus low-volatility forex. By normalizing with ATR, DMA adapts its interpretation to current market conditions.
Purpose : Quantifies the directional "force" behind current price action. Positive = bullish push, negative = bearish push. Magnitude = strength.
Interpretation :
DMA > 0.7: Strong bullish momentum โ bearish divergences risky
DMA 0.3 to 0.7: Moderate bullish bias
DMA -0.3 to 0.3: Balanced/choppy conditions
DMA -0.7 to -0.3: Moderate bearish bias
DMA < -0.7: Strong bearish momentum โ bullish divergences risky
3. Multi-Factor Exhaustion Modeling โ 0 to 1 Probability
Single-metric exhaustion detection (like "RSI > 80") misses complex market states. BZ-CAE aggregates five independent exhaustion signals:
Volume Spikes : Current volume versus 50-bar average
2.5x average: 0.25 weight
2.0x average: 0.15 weight
1.5x average: 0.10 weight
Divergence Present : The fact that a divergence exists contributes 0.30 weight โ structural momentum disagreement is itself an exhaustion signal.
RSI Extremes : Captures oscillator climax zones
RSI > 80 or < 20: 0.25 weight
RSI > 75 or < 25: 0.15 weight
Pin Bar Detection : Identifies rejection candles (2:1 wick-to-body ratio, indicating failed breakout attempts): 0.15 weight
Extended Runs : Consecutive bars above/below EMA20 without pullback
30+ bars: 0.15 weight (market hasn't paused to consolidate)
Total exhaustion score is the sum of all applicable weights, capped at 1.0.
Purpose : Detects when strong trends become vulnerable to reversal. High exhaustion can override trend filters, allowing counter-trend trades at genuine turning points that basic indicators would miss.
Interpretation :
Exhaustion > 0.75: High probability of climax โ yellow background shading alerts you visually
Exhaustion 0.50-0.75: Moderate overextension โ watch for confirmation
Exhaustion < 0.50: Fresh move โ trend can continue, counter-trend trades higher risk
4. Adversarial Validation โ Game Theory Applied to Trading
This is BZ-CAE's signature innovation. Before approving any signal, the engine quantifies BOTH sides of the trade simultaneously:
For Bullish Divergences , it calculates:
Bull Case Score (0-1+) :
Distance below EMA20 (pullback quality): up to 0.25
Bullish EMA alignment (close > EMA20 > EMA50): 0.25
Oversold RSI (< 40): 0.25
Volume confirmation (> 1.2x average): 0.25
Bear Case Score (0-1+) :
Price below EMA50 (structural weakness): 0.30
Very oversold RSI (< 30, indicating knife-catching): 0.20
Differential = Bull Case - Bear Case
If differential < -0.10 (default threshold), the bear case is dominating โ signal is BLOCKED or ANNOTATED.
For Bearish Divergences , the logic inverts (Bear Case vs Bull Case).
Purpose : Prevents trades where you're fighting obvious strength in the opposite direction. This is institutional-grade risk management โ don't just evaluate your trade, evaluate the counter-trade simultaneously.
Why This Matters : You might see a bullish divergence at a local low, but if price is deeply below major support EMAs with strong bearish momentum, you're catching a falling knife. The adversarial check catches this and blocks the signal.
5. Confidence Scoring โ 0 to 1 Quality Assessment
Every signal that passes initial filters receives a comprehensive quality score:
Formula :
0.30 ร normalize(TCS) // Trend context
+ 0.25 ร normalize(|DMA|) // Momentum magnitude
+ 0.20 ร pullback_quality // Entry distance from EMA20
+ 0.15 ร state_quality // ADX + alignment + structure
+ 0.10 ร divergence_strength // Slope separation magnitude
+ adversarial_bonus (0-0.30) // Your side's advantage
Purpose : Ranks setup quality for filtering and position sizing decisions. You can set a minimum confidence threshold (default 0.35) to ensure only quality setups reach your chart.
Interpretation :
Confidence > 0.70: Premium setup โ consider increased position size
Confidence 0.50-0.70: Good quality โ standard size
Confidence 0.35-0.50: Acceptable โ reduced size or skip if conservative
Confidence < 0.35: Marginal โ blocked in Filtering mode, annotated in Advisory mode
CAE Operating Modes: Learning vs Enforcement
Off : Disables all CAE logic. Raw divergence pipeline only. Use for baseline comparison.
Advisory : Shows ALL signals regardless of CAE evaluation, but annotates signals that WOULD be blocked with specific warnings (e.g., "Bull: strong downtrend (TCS=0.87)" or "Adversarial bearish"). This is your learning mode โ see CAE's decision logic in action without missing educational opportunities.
Filtering : Actively blocks low-quality signals. Only setups that pass all enabled gates (Trend Filter, Adversarial Validation, Confidence Gating) reach your chart. This is your live trading mode โ trust the system to enforce discipline.
CAE Filter Gates: Three-Layer Protection
When CAE is enabled, signals must pass through three independent gates (each can be toggled on/off):
Gate 1: Strong Trend Filter
If TCS โฅ tcs_threshold (default 0.80)
And signal is counter-trend (bullish in downtrend or bearish in uptrend)
And exhaustion < exhaustion_required (default 0.50)
Then: BLOCK signal
Logic: Don't fade strong trends unless the move is clearly overextended
Gate 2: Adversarial Validation
Calculate both bull case and bear case scores
If opposing case dominates by more than adv_threshold (default 0.10)
Then: BLOCK signal
Logic: Avoid trades where you're fighting obvious strength in the opposite direction
Gate 3: Confidence Gating
Calculate composite confidence score (0-1)
If confidence < min_confidence (default 0.35)
Then: In Filtering mode, BLOCK signal; in Advisory mode, ANNOTATE with warning
Logic: Only take setups with minimum quality threshold
All three gates work together. A signal must pass ALL enabled gates to fire.
Visual Intelligence System
Bifurcation Zones (Supply/Demand Blocks)
When a divergence signal fires, BZ-CAE draws a semi-transparent box extending 15 bars forward from the signal pivot:
Demand Zones (Bullish) : Theme-colored box (cyan in Cyberpunk, blue in Professional, etc.) labeled "Demand" โ marks where smart money likely placed buy orders as price diverged at the low.
Supply Zones (Bearish) : Theme-colored box (magenta in Cyberpunk, orange in Professional) labeled "Supply" โ marks where smart money likely placed sell orders as price diverged at the high.
Theory : Divergences represent institutional disagreement with the crowd. The crowd pushed price to an extreme (new high or low), but momentum (oscillator) is waning, indicating smart money is taking the opposite side. These zones mark order placement areas that become future support/resistance.
Use Cases :
Exit targets: Take profit when price returns to opposite-side zone
Re-entry levels: If price returns to your entry zone, consider adding
Stop placement: Place stops just beyond your zone (below demand, above supply)
Auto-Cleanup : System keeps the last 20 zones to prevent chart clutter.
Adversarial Bar Coloring โ Real-Time Market Debate Heatmap
Each bar is colored based on the Bull Case vs Bear Case differential:
Strong Bull Advantage (diff > 0.3): Full theme bull color (e.g., cyan)
Moderate Bull Advantage (diff > 0.1): 50% transparency bull
Neutral (diff -0.1 to 0.1): Gray/neutral theme
Moderate Bear Advantage (diff < -0.1): 50% transparency bear
Strong Bear Advantage (diff < -0.3): Full theme bear color (e.g., magenta)
This creates a real-time visual heatmap showing which side is "winning" the market debate. When bars flip from cyan to magenta (or vice versa), you're witnessing a shift in adversarial advantage โ a leading indicator of potential momentum changes.
Exhaustion Shading
When exhaustion score exceeds 0.75, the chart background displays a semi-transparent yellow highlight. This immediate visual warning alerts you that the current move is at high risk of reversal, even if trend indicators remain strong.
Visual Themes โ Six Aesthetic Options
Cyberpunk : Cyan/Magenta/Yellow โ High contrast, neon aesthetic, excellent for dark-themed trading environments
Professional : Blue/Orange/Green โ Corporate color palette, suitable for presentations and professional documentation
Ocean : Teal/Red/Cyan โ Aquatic palette, calming for extended monitoring sessions
Fire : Orange/Red/Coral โ Warm aggressive colors, high energy
Matrix : Green/Red/Lime โ Code aesthetic, homage to classic hacker visuals
Monochrome : White/Gray โ Minimal distraction, maximum focus on price action
All visual elements (signal markers, zones, bar colors, dashboard) adapt to your selected theme.
Divergence Engine โ Core Detection System
What Are Divergences?
Divergences occur when price action and momentum indicators disagree, creating structural tension that often resolves in a change of direction:
Regular Divergence (Reversal Signal) :
Bearish Regular : Price makes higher high, oscillator makes lower high โ Potential trend reversal down
Bullish Regular : Price makes lower low, oscillator makes higher low โ Potential trend reversal up
Hidden Divergence (Continuation Signal) :
Bearish Hidden : Price makes lower high, oscillator makes higher high โ Downtrend continuation
Bullish Hidden : Price makes higher low, oscillator makes lower low โ Uptrend continuation
Both types can be enabled/disabled independently in settings.
Pivot Detection Methods
BZ-CAE uses symmetric pivot detection with separate lookback and lookforward periods (default 5/5):
Pivot High : Bar where high > all highs within lookback range AND high > all highs within lookforward range
Pivot Low : Bar where low < all lows within lookback range AND low < all lows within lookforward range
This ensures structural validity โ the pivot must be a clear local extreme, not just a minor wiggle.
Divergence Validation Requirements
For a divergence to be confirmed, it must satisfy:
Slope Disagreement : Price slope and oscillator slope must move in opposite directions (for regular divs) or same direction with inverted highs/lows (for hidden divs)
Minimum Slope Change : |osc_slope| > min_slope_change / 100 (default 1.0) โ filters weak, marginal divergences
Maximum Lookback Range : Pivots must be within max_lookback bars (default 60) โ prevents ancient, irrelevant divergences
ATR-Normalized Strength : Divergence strength = min(|price_slope| ร |osc_slope| ร 10, 1.0) โ quantifies the magnitude of disagreement in volatility context
Regular divergences receive 1.0ร weight; hidden divergences receive 0.8ร weight (slightly less reliable historically).
Oscillator Options โ Five Professional Indicators
RSI (Relative Strength Index) : Classic overbought/oversold momentum indicator. Best for: General purpose divergence detection across all instruments.
Stochastic : Range-bound %K momentum comparing close to high-low range. Best for: Mean reversion strategies and range-bound markets.
CCI (Commodity Channel Index) : Measures deviation from statistical mean, auto-normalized to 0-100 scale. Best for: Cyclical instruments and commodities.
MFI (Money Flow Index) : Volume-weighted RSI incorporating money flow. Best for: Volume-driven markets like stocks and crypto.
Williams %R : Inverse stochastic looking back over period, auto-adjusted to 0-100. Best for: Reversal detection at extremes.
Each oscillator has adjustable length (2-200, default 14) and smoothing (1-20, default 1). You also set overbought (50-100, default 70) and oversold (0-50, default 30) thresholds.
Signal Timing Modes โ Understanding Repainting
BZ-CAE offers two timing policies with complete transparency about repainting behavior:
Realtime (1-bar, peak-anchored)
How It Works :
Detects peaks 1 bar ago using pattern: high > high AND high > high
Signal prints on the NEXT bar after peak detection (bar_index)
Visual marker anchors to the actual PEAK bar (bar_index - 1, offset -1)
Signal locks in when bar CONFIRMS (closes)
Repainting Behavior :
On the FORMING bar (before close), the peak condition may change as new prices arrive
Once bar CLOSES (barstate.isconfirmed), signal is locked permanently
This is preview/early warning behavior by design
Best For :
Active monitoring and immediate alerts
Learning the system (seeing signals develop in real-time)
Responsive entry if you're watching the chart live
Confirmed (lookforward)
How It Works :
Uses Pine Script's built-in ta.pivothigh() and ta.pivotlow() functions
Requires full pivot validation period (lookback + lookforward bars)
Signal prints pivot_lookforward bars after the actual peak (default 5-bar delay)
Visual marker anchors to the actual peak bar (offset -pivot_lookforward)
No Repainting Behavior
Best For :
Backtesting and historical analysis
Conservative entries requiring full confirmation
Automated trading systems
Swing trading with larger timeframes
Tradeoff :
Delayed entry by pivot_lookforward bars (typically 5 bars)
On a 5-minute chart, this is a 25-minute delay
On a 4-hour chart, this is a 20-hour delay
Recommendation : Use Confirmed for backtesting to verify system performance honestly. Use Realtime for live monitoring only if you're actively watching the chart and understand pre-confirmation repainting behavior.
Signal Spacing System โ Anti-Spam Architecture
Even after CAE filtering, raw divergences can cluster. The spacing system enforces separation:
Three Independent Filters
1. Min Bars Between ANY Signals (default 12):
Prevents rapid-fire clustering across both directions
If last signal (bull or bear) was within N bars, block new signal
Ensures breathing room between all setups
2. Min Bars Between SAME-SIDE Signals (default 24, optional enforcement):
Prevents bull-bull or bear-bear spam
Separate tracking for bullish and bearish signal timelines
Toggle enforcement on/off
3. Min ATR Distance From Last Signal (default 0, optional):
Requires price to move N ร ATR from last signal location
Ensures meaningful price movement between setups
0 = disabled, 0.5-2.0 = typical range for enabled
All three filters work independently. A signal must pass ALL enabled filters to proceed.
Practical Guidance :
Scalping (1-5m) : Any 6-10, Same-side 12-20, ATR 0-0.5
Day Trading (15m-1H) : Any 12, Same-side 24, ATR 0-1.0
Swing Trading (4H-D) : Any 20-30, Same-side 40-60, ATR 1.0-2.0
Dashboard โ Real-Time Control Center
The dashboard (toggleable, four corner positions, three sizes) provides comprehensive system intelligence:
Oscillator Section
Current oscillator type and value
State: OVERBOUGHT / OVERSOLD / NEUTRAL (color-coded)
Length parameter
Cognitive Engine Section
TCS (Trend Conviction Score) :
Current value with emoji state indicator
๐ฅ = Strong trend (>0.75)
๐ = Moderate trend (0.50-0.75)
ใฐ๏ธ = Weak/choppy (<0.50)
Color: Red if above threshold (trend filter active), yellow if moderate, green if weak
DMA (Directional Momentum Alignment) :
Current value with emoji direction indicator
๐ = Bullish momentum (>0.5)
โ๏ธ = Balanced (-0.5 to 0.5)
๐ป = Bearish momentum (<-0.5)
Color: Green if bullish, red if bearish
Exhaustion :
Current value with emoji warning indicator
โ ๏ธ = High exhaustion (>0.75)
๐ก = Moderate (0.50-0.75)
โ = Low (<0.50)
Color: Red if high, yellow if moderate, green if low
Pullback :
Quality of current distance from EMA20
Values >0.6 are ideal entry zones (not too close, not too far)
Bull Case / Bear Case (if Adversarial enabled):
Current scores for both sides of the market debate
Differential with emoji indicator:
๐ = Bull advantage (>0.2)
โก๏ธ = Balanced (-0.2 to 0.2)
๐ = Bear advantage (<-0.2)
Last Signal Metrics Section (New Feature)
When a signal fires, this section captures and displays:
Signal type (BULL or BEAR)
Bars elapsed since signal
Confidence % at time of signal
TCS value at signal time
DMA value at signal time
Purpose : Provides a historical reference for learning. You can see what the market state looked like when the last signal fired, helping you correlate outcomes with conditions.
Statistics Section
Total Signals : Lifetime count across session
Blocked Signals : Count and percentage (filter effectiveness metric)
Bull Signals : Total bullish divergences
Bear Signals : Total bearish divergences
Purpose : System health monitoring. If blocked % is very high (>60%), filters may be too strict. If very low (<10%), filters may be too loose.
Advisory Annotations
When CAE Mode = Advisory, this section displays warnings for signals that would be blocked in Filtering mode:
Examples:
"Bull spacing: wait 8 bars"
"Bear: strong uptrend (TCS=0.87)"
"Adversarial bearish"
"Low confidence 32%"
Multiple warnings can stack, separated by " | ". This teaches you CAE's decision logic transparently.
How to Use BZ-CAE โ Complete Workflow
Phase 1: Initial Setup (First Session)
Apply BZ-CAE to your chart
Select your preferred Visual Theme (Cyberpunk recommended for visibility)
Set Signal Timing to "Confirmed (lookforward)" for learning
Choose your Oscillator Type (RSI recommended for general use, length 14)
Set Overbought/Oversold to 70/30 (standard)
Enable both Regular Divergence and Hidden Divergence
Set Pivot Lookback/Lookforward to 5/5 (balanced structure)
Enable CAE Intelligence
Set CAE Mode to "Advisory" (learning mode)
Enable all three CAE filters: Strong Trend Filter , Adversarial Validation , Confidence Gating
Enable Show Dashboard , position Top Right, size Normal
Enable Draw Bifurcation Zones and Adversarial Bar Coloring
Phase 2: Learning Period (Weeks 1-2)
Goal : Understand how CAE evaluates market state and filters signals.
Activities :
Watch the dashboard during signals :
Note TCS values when counter-trend signals fail โ this teaches you the trend strength threshold for your instrument
Observe exhaustion patterns at actual turning points โ learn when overextension truly matters
Study adversarial differential at signal times โ see when opposing cases dominate
Review blocked signals (orange X-crosses):
In Advisory mode, you see everything โ signals that would pass AND signals that would be blocked
Check the advisory annotations to understand why CAE would block
Track outcomes: Were the blocks correct? Did those signals fail?
Use Last Signal Metrics :
After each signal, check the dashboard capture of confidence, TCS, and DMA
Journal these values alongside trade outcomes
Identify patterns: Do confidence >0.70 signals work better? Does your instrument respect TCS >0.85?
Understand your instrument's "personality" :
Trending instruments (indices, major forex) may need TCS threshold 0.85-0.90
Choppy instruments (low-cap stocks, exotic pairs) may work best with TCS 0.70-0.75
High-volatility instruments (crypto) may need wider spacing
Low-volatility instruments may need tighter spacing
Phase 3: Calibration (Weeks 3-4)
Goal : Optimize settings for your specific instrument, timeframe, and style.
Calibration Checklist :
Min Confidence Threshold :
Review confidence distribution in your signal journal
Identify the confidence level below which signals consistently fail
Set min_confidence slightly above that level
Day trading : 0.35-0.45
Swing trading : 0.40-0.55
Scalping : 0.30-0.40
TCS Threshold :
Find the TCS level where counter-trend signals consistently get stopped out
Set tcs_threshold at or slightly below that level
Trending instruments : 0.85-0.90
Mixed instruments : 0.80-0.85
Choppy instruments : 0.75-0.80
Exhaustion Override Level :
Identify exhaustion readings that marked genuine reversals
Set exhaustion_required just below the average
Typical range : 0.45-0.55
Adversarial Threshold :
Default 0.10 works for most instruments
If you find CAE is too conservative (blocking good trades), raise to 0.15-0.20
If signals are still getting caught in opposing momentum, lower to 0.07-0.09
Spacing Parameters :
Count bars between quality signals in your journal
Set min bars ANY to ~60% of that average
Set min bars SAME-SIDE to ~120% of that average
Scalping : Any 6-10, Same 12-20
Day trading : Any 12, Same 24
Swing : Any 20-30, Same 40-60
Oscillator Selection :
Try different oscillators for 1-2 weeks each
Track win rate and average winner/loser by oscillator type
RSI : Best for general use, clear OB/OS
Stochastic : Best for range-bound, mean reversion
MFI : Best for volume-driven markets
CCI : Best for cyclical instruments
Williams %R : Best for reversal detection
Phase 4: Live Deployment
Goal : Disciplined execution with proven, calibrated system.
Settings Changes :
Switch CAE Mode from Advisory to Filtering
System now actively blocks low-quality signals
Only setups passing all gates reach your chart
Keep Signal Timing on Confirmed for conservative entries
OR switch to Realtime if you're actively monitoring and want faster entries (accept pre-confirmation repaint risk)
Use your calibrated thresholds from Phase 3
Enable high-confidence alerts: "โญ High Confidence Bullish/Bearish" (>0.70)
Trading Discipline Rules :
Respect Blocked Signals :
If CAE blocks a trade you wanted to take, TRUST THE SYSTEM
Don't manually override โ if you consistently disagree, return to Phase 2/3 calibration
The block exists because market state failed intelligence checks
Confidence-Based Position Sizing :
Confidence >0.70: Standard or increased size (e.g., 1.5-2.0% risk)
Confidence 0.50-0.70: Standard size (e.g., 1.0% risk)
Confidence 0.35-0.50: Reduced size (e.g., 0.5% risk) or skip if conservative
TCS-Based Management :
High TCS + counter-trend signal: Use tight stops, quick exits (you're fading momentum)
Low TCS + reversal signal: Use wider stops, trail aggressively (genuine reversal potential)
Exhaustion Awareness :
Exhaustion >0.75 (yellow shading): Market is overextended, reversal risk is elevated โ consider early exit or tighter trailing stops even on winning trades
Exhaustion <0.30: Continuation bias โ hold for larger move, wide trailing stops
Adversarial Context :
Strong differential against you (e.g., bullish signal with bear diff <-0.2): Use very tight stops, consider skipping
Strong differential with you (e.g., bullish signal with bull diff >0.2): Trail aggressively, this is your tailwind
Practical Settings by Timeframe & Style
Scalping (1-5 Minute Charts)
Objective : High frequency, tight stops, quick reversals in fast-moving markets.
Oscillator :
Type: RSI or Stochastic (fast response to quick moves)
Length: 9-11 (more responsive than standard 14)
Smoothing: 1 (no lag)
OB/OS: 65/35 (looser thresholds ensure frequent crossings in fast conditions)
Divergence :
Pivot Lookback/Lookforward: 3/3 (tight structure, catch small swings)
Max Lookback: 40-50 bars (recent structure only)
Min Slope Change: 0.8-1.0 (don't be overly strict)
CAE :
Mode: Advisory first (learn), then Filtering
Min Confidence: 0.30-0.35 (lower bar for speed, accept more signals)
TCS Threshold: 0.70-0.75 (allow more counter-trend opportunities)
Exhaustion Required: 0.45-0.50 (moderate override)
Strong Trend Filter: ON (still respect major intraday trends)
Adversarial: ON (critical for scalping protection โ catches bad entries quickly)
Spacing :
Min Bars ANY: 6-10 (fast pace, many setups)
Min Bars SAME-SIDE: 12-20 (prevent clustering)
Min ATR Distance: 0 or 0.5 (loose)
Timing : Realtime (speed over precision, but understand repaint risk)
Visuals :
Signal Size: Tiny (chart clarity in busy conditions)
Show Zones: Optional (can clutter on low timeframes)
Bar Coloring: ON (helps read momentum shifts quickly)
Dashboard: Small size (corner reference, not main focus)
Key Consideration : Scalping generates noise. Even with CAE, expect lower win rate (45-55%) but aim for favorable R:R (2:1 or better). Size conservatively.
Day Trading (15-Minute to 1-Hour Charts)
Objective : Balance quality and frequency. Standard divergence trading approach.
Oscillator :
Type: RSI or MFI (proven reliability, volume confirmation with MFI)
Length: 14 (industry standard, well-studied)
Smoothing: 1-2
OB/OS: 70/30 (classic levels)
Divergence :
Pivot Lookback/Lookforward: 5/5 (balanced structure)
Max Lookback: 60 bars
Min Slope Change: 1.0 (standard strictness)
CAE :
Mode: Filtering (enforce discipline from the start after brief Advisory learning)
Min Confidence: 0.35-0.45 (quality filter without being too restrictive)
TCS Threshold: 0.80-0.85 (respect strong trends)
Exhaustion Required: 0.50 (balanced override threshold)
Strong Trend Filter: ON
Adversarial: ON
Confidence Gating: ON (all three filters active)
Spacing :
Min Bars ANY: 12 (breathing room between all setups)
Min Bars SAME-SIDE: 24 (prevent bull/bear clusters)
Min ATR Distance: 0-1.0 (optional refinement, typically 0.5-1.0)
Timing : Confirmed (1-bar delay for reliability, no repainting)
Visuals :
Signal Size: Tiny or Small
Show Zones: ON (useful reference for exits/re-entries)
Bar Coloring: ON (context awareness)
Dashboard: Normal size (full visibility)
Key Consideration : This is the "sweet spot" timeframe for BZ-CAE. Market structure is clear, CAE has sufficient data, and signal frequency is manageable. Expect 55-65% win rate with proper execution.
Swing Trading (4-Hour to Daily Charts)
Objective : Quality over quantity. High conviction only. Larger stops and targets.
Oscillator :
Type: RSI or CCI (robust on higher timeframes, smooth longer waves)
Length: 14-21 (capture larger momentum swings)
Smoothing: 1-3
OB/OS: 70/30 or 75/25 (strict extremes)
Divergence :
Pivot Lookback/Lookforward: 5/5 or 7/7 (structural purity, major swings only)
Max Lookback: 80-100 bars (broader historical context)
Min Slope Change: 1.2-1.5 (require strong, undeniable divergence)
CAE :
Mode: Filtering (strict enforcement, premium setups only)
Min Confidence: 0.40-0.55 (high bar for entry)
TCS Threshold: 0.85-0.95 (very strong trend protection โ don't fade established HTF trends)
Exhaustion Required: 0.50-0.60 (higher bar for override โ only extreme exhaustion justifies counter-trend)
Strong Trend Filter: ON (critical on HTF)
Adversarial: ON (avoid obvious bad trades)
Confidence Gating: ON (quality gate essential)
Spacing :
Min Bars ANY: 20-30 (substantial separation)
Min Bars SAME-SIDE: 40-60 (significant breathing room)
Min ATR Distance: 1.0-2.0 (require meaningful price movement)
Timing : Confirmed (purity over speed, zero repaint for swing accuracy)
Visuals :
Signal Size: Small or Normal (clear markers on zoomed-out view)
Show Zones: ON (important HTF levels)
Bar Coloring: ON (long-term trend awareness)
Dashboard: Normal or Large (comprehensive analysis)
Key Consideration : Swing signals are rare but powerful. Expect 2-5 signals per month per instrument. Win rate should be 60-70%+ due to stringent filtering. Position size can be larger given confidence.
Dashboard Interpretation Reference
TCS (Trend Conviction Score) States
0.00-0.50: Weak/Choppy
Emoji: ใฐ๏ธ
Color: Green/cyan
Meaning: No established trend. Range-bound or consolidating. Both reversal and continuation signals viable.
Action: Reversals (regular divs) are safer. Use wider profit targets (market has room to move). Consider mean reversion strategies.
0.50-0.75: Moderate Trend
Emoji: ๐
Color: Yellow/neutral
Meaning: Developing trend but not locked in. Context matters significantly.
Action: Check DMA and exhaustion. If DMA confirms trend and exhaustion is low, favor continuation (hidden divs). If exhaustion is high, reversals are viable.
0.75-0.85: Strong Trend
Emoji: ๐ฅ
Color: Orange/warning
Meaning: Well-established trend with persistence. Counter-trend is high risk.
Action: Require exhaustion >0.50 for counter-trend entries. Favor continuation signals. Use tight stops on counter-trend attempts.
0.85-1.00: Very Strong Trend
Emoji: ๐ฅ๐ฅ
Color: Red/danger (if counter-trading)
Meaning: Locked-in institutional trend. Extremely high risk to fade.
Action: Avoid counter-trend unless exhaustion >0.75 (yellow shading). Focus exclusively on continuation opportunities. Momentum is king here.
DMA (Directional Momentum Alignment) Zones
-2.0 to -1.0: Strong Bearish Momentum
Emoji: ๐ป๐ป
Color: Dark red
Meaning: Powerful downside force. Sellers are in control.
Action: Bullish divergences are counter-momentum (high risk). Bearish divergences are with-momentum (lower risk). Size down on longs.
-0.5 to 0.5: Neutral/Balanced
Emoji: โ๏ธ
Color: Gray/neutral
Meaning: No strong directional bias. Choppy or consolidating.
Action: Both directions have similar probability. Focus on confidence score and adversarial differential for edge.
1.0 to 2.0: Strong Bullish Momentum
Emoji: ๐๐
Color: Bright green/cyan
Meaning: Powerful upside force. Buyers are in control.
Action: Bearish divergences are counter-momentum (high risk). Bullish divergences are with-momentum (lower risk). Size down on shorts.
Exhaustion States
0.00-0.50: Fresh Move
Emoji: โ
Color: Green
Meaning: Trend is healthy, not overextended. Room to run.
Action: Counter-trend trades are premature. Favor continuation. Hold winners for larger moves. Avoid early exits.
0.50-0.75: Mature Move
Emoji: ๐ก
Color: Yellow
Meaning: Move is aging. Watch for signs of climax.
Action: Tighten trailing stops on winning trades. Be ready for reversals. Don't add to positions aggressively.
0.75-0.85: High Exhaustion
Emoji: โ ๏ธ
Color: Orange
Background: Yellow shading appears
Meaning: Move is overextended. Reversal risk elevated significantly.
Action: Counter-trend reversals are higher probability. Consider early exits on with-trend positions. Size up on reversal divergences (if CAE allows).
0.85-1.00: Critical Exhaustion
Emoji: โ ๏ธโ ๏ธ
Color: Red
Background: Yellow shading intensifies
Meaning: Climax conditions. Reversal imminent or underway.
Action: Aggressive reversal trades justified. Exit all with-trend positions. This is where major turns occur.
Confidence Score Tiers
0.00-0.30: Low Quality
Color: Red
Status: Blocked in Filtering mode
Action: Skip entirely. Setup lacks fundamental quality across multiple factors.
0.30-0.50: Moderate Quality
Color: Yellow/orange
Status: Marginal โ passes in Filtering only if >min_confidence
Action: Reduced position size (0.5-0.75% risk). Tight stops. Conservative profit targets. Skip if you're selective.
0.50-0.70: High Quality
Color: Green/cyan
Status: Good setup across most quality factors
Action: Standard position size (1.0-1.5% risk). Normal stops and targets. This is your bread-and-butter trade.
0.70-1.00: Premium Quality
Color: Bright green/gold
Status: Exceptional setup โ all factors aligned
Visual: Double confidence ring appears
Action: Consider increased position size (1.5-2.0% risk, maximum). Wider stops. Larger targets. High probability of success. These are rare โ capitalize when they appear.
Adversarial Differential Interpretation
Bull Differential > 0.3 :
Visual: Strong cyan/green bar colors
Meaning: Bull case strongly dominates. Buyers have clear advantage.
Action: Bullish divergences favored (with-advantage). Bearish divergences face headwind (reduce size or skip). Momentum is bullish.
Bull Differential 0.1 to 0.3 :
Visual: Moderate cyan/green transparency
Meaning: Moderate bull advantage. Buyers have edge but not overwhelming.
Action: Both directions viable. Slight bias toward longs.
Differential -0.1 to 0.1 :
Visual: Gray/neutral bars
Meaning: Balanced debate. No clear advantage either side.
Action: Rely on other factors (confidence, TCS, exhaustion) for direction. Adversarial is neutral.
Bear Differential -0.3 to -0.1 :
Visual: Moderate red/magenta transparency
Meaning: Moderate bear advantage. Sellers have edge but not overwhelming.
Action: Both directions viable. Slight bias toward shorts.
Bear Differential < -0.3 :
Visual: Strong red/magenta bar colors
Meaning: Bear case strongly dominates. Sellers have clear advantage.
Action: Bearish divergences favored (with-advantage). Bullish divergences face headwind (reduce size or skip). Momentum is bearish.
Last Signal Metrics โ Post-Trade Analysis
After a signal fires, dashboard captures:
Type : BULL or BEAR
Bars Ago : How long since signal (updates every bar)
Confidence : What was the quality score at signal time
TCS : What was trend conviction at signal time
DMA : What was momentum alignment at signal time
Use Case : Post-trade journaling and learning.
Example: "BULL signal 12 bars ago. Confidence: 68%, TCS: 0.42, DMA: -0.85"
Analysis : This was a bullish reversal (regular div) with good confidence, weak trend (TCS), but strong bearish momentum (DMA). The bet was that momentum would reverse โ a counter-momentum play requiring exhaustion confirmation. Check if exhaustion was high at that time to justify the entry.
Track patterns:
Do your best trades have confidence >0.65?
Do low-TCS signals (<0.50) work better for you?
Are you more successful with-momentum (DMA aligned with signal) or counter-momentum?
Troubleshooting Guide
Problem: No Signals Appearing
Symptoms : Chart loads, dashboard shows metrics, but no divergence signals fire.
Diagnosis Checklist :
Check dashboard oscillator value : Is it crossing OB/OS levels (70/30)? If oscillator stays in 40-60 range constantly, it can't reach extremes needed for divergence detection.
Are pivots forming? : Look for local swing highs/lows on your chart. If price is in tight consolidation, pivots may not meet lookback/lookforward requirements.
Is spacing too tight? : Check "Last Signal" metrics โ how many bars since last signal? If <12 and your min_bars_ANY is 12, spacing filter is blocking.
Is CAE blocking everything? : Check dashboard Statistics section โ what's the blocked signal count? High blocks indicate overly strict filters.
Solutions :
Loosen OB/OS Temporarily :
Try 65/35 to verify divergence detection works
If signals appear, the issue was threshold strictness
Gradually tighten back to 67/33, then 70/30 as appropriate
Lower Min Confidence :
Try 0.25-0.30 (diagnostic level)
If signals appear, filter was too strict
Raise gradually to find sweet spot (0.35-0.45 typical)
Disable Strong Trend Filter Temporarily :
Turn off in CAE settings
If signals appear, TCS threshold was blocking everything
Re-enable and lower TCS_threshold to 0.70-0.75
Reduce Min Slope Change :
Try 0.7-0.8 (from default 1.0)
Allows weaker divergences through
Helpful on low-volatility instruments
Widen Spacing :
Set min_bars_ANY to 6-8
Set min_bars_SAME_SIDE to 12-16
Reduces time between allowed signals
Check Timing Mode :
If using Confirmed, remember there's a pivot_lookforward delay (5+ bars)
Switch to Realtime temporarily to verify system is working
Realtime has no delay but repaints
Verify Oscillator Settings :
Length 14 is standard but might not fit all instruments
Try length 9-11 for faster response
Try length 18-21 for slower, smoother response
Problem: Too Many Signals (Signal Spam)
Symptoms : Dashboard shows 50+ signals in Statistics, confidence scores mostly <0.40, signals clustering close together.
Solutions :
Raise Min Confidence :
Try 0.40-0.50 (quality filter)
Blocks bottom-tier setups
Targets top 50-60% of divergences only
Tighten OB/OS :
Use 70/30 or 75/25
Requires more extreme oscillator readings
Reduces false divergences in mid-range
Increase Min Slope Change :
Try 1.2-1.5 (from default 1.0)
Requires stronger, more obvious divergences
Filters marginal slope disagreements
Raise TCS Threshold :
Try 0.85-0.90 (from default 0.80)
Stricter trend filter blocks more counter-trend attempts
Favors only strongest trend alignment
Enable ALL CAE Gates :
Turn on Trend Filter + Adversarial + Confidence
Triple-layer protection
Blocks aggressively โ expect 20-40% reduction in signals
Widen Spacing :
min_bars_ANY: 15-20 (from 12)
min_bars_SAME_SIDE: 30-40 (from 24)
Creates substantial breathing room
Switch to Confirmed Timing :
Removes realtime preview noise
Ensures full pivot validation
5-bar delay filters many false starts
Problem: Signals in Strong Trends Get Stopped Out
Symptoms : You take a bullish divergence in a downtrend (or bearish in uptrend), and it immediately fails. Dashboard showed high TCS at the time.
Analysis : This is INTENDED behavior โ CAE is protecting you from low-probability counter-trend trades.
Understanding :
Check Last Signal Metrics in dashboard โ what was TCS when signal fired?
If TCS was >0.85 and signal was counter-trend, CAE correctly identified it as high risk
Strong trends rarely reverse cleanly without major exhaustion
Your losses here are the system working as designed (blocking bad odds)
If You Want to Override (Not Recommended) :
Lower TCS_threshold to 0.70-0.75 (allows more counter-trend)
Lower exhaustion_required to 0.40 (easier override)
Disable Strong Trend Filter entirely (very risky)
Better Approach :
TRUST THE FILTER โ it's preventing costly mistakes
Wait for exhaustion >0.75 (yellow shading) before counter-trending strong TCS
Focus on continuation signals (hidden divs) in high-TCS environments
Use Advisory mode to see what CAE is blocking and learn from outcomes
Problem: Adversarial Blocking Seems Wrong
Symptoms : You see a divergence that "looks good" visually, but CAE blocks with "Adversarial bearish/bullish" warning.
Diagnosis :
Check dashboard Bull Case and Bear Case scores at that moment
Look at Differential value
Check adversarial bar colors โ was there strong coloring against your intended direction?
Understanding :
Adversarial catches "obvious" opposing momentum that's easy to miss
Example: Bullish divergence at a local low, BUT price is deeply below EMA50, bearish momentum is strong, and RSI shows knife-catching conditions
Bull Case might be 0.20 while Bear Case is 0.55
Differential = -0.35, far beyond threshold
Block is CORRECT โ you'd be fighting overwhelming opposing flow
If You Disagree Consistently
Review blocked signals on chart โ scroll back and check outcomes
Did those blocked signals actually work, or did they fail as adversarial predicted?
Raise adv_threshold to 0.15-0.20 (more permissive, allows closer battles)
Disable Adversarial Validation temporarily (diagnostic) to isolate its effect
Use Advisory mode to learn adversarial patterns over 50-100 signals
Remember : Adversarial is conservative BY DESIGN. It prevents "obvious" bad trades where you're fighting strong strength the other way.
Problem: Dashboard Not Showing or Incomplete
Solutions :
Toggle "Show Dashboard" to ON in settings
Try different dashboard sizes (Small/Normal/Large)
Try different positions (Top Left/Right, Bottom Left/Right) โ might be off-screen
Some sections require CAE Enable = ON (Cognitive Engine section won't appear if CAE is disabled)
Statistics section requires at least 1 lifetime signal to populate
Check that visual theme is set (dashboard colors adapt to theme)
Problem: Performance Lag, Chart Freezing
Symptoms : Chart loading is slow, indicator calculations cause delays, pinch-to-zoom lags.
Diagnosis : Visual features are computationally expensive, especially adversarial bar coloring (recalculates every bar).
Solutions (In Order of Impact) :
Disable Adversarial Bar Coloring (MOST EXPENSIVE):
Turn OFF "Adversarial Bar Coloring" in settings
This is the single biggest performance drain
Immediate improvement
Reduce Vertical Lines :
Lower "Keep last N vertical lines" to 20-30
Or set to 0 to disable entirely
Moderate improvement
Disable Bifurcation Zones :
Turn OFF "Draw Bifurcation Zones"
Reduces box drawing calculations
Moderate improvement
Set Dashboard Size to Small :
Smaller dashboard = fewer cells = less rendering
Minor improvement
Use Shorter Max Lookback :
Reduce max_lookback to 40-50 (from 60+)
Fewer bars to scan for divergences
Minor improvement
Disable Exhaustion Shading :
Turn OFF "Show Market State"
Removes background coloring calculations
Minor improvement
Extreme Performance Mode :
Disable ALL visual enhancements
Keep only triangle markers
Dashboard Small or OFF
Use Minimal theme if available
Problem: Realtime Signals Repainting
Symptoms : You see a signal appear, but on next bar it disappears or moves.
Explanation :
Realtime mode detects peaks 1 bar ago: high > high AND high > high
On the FORMING bar (before close), this condition can change as new prices arrive
Example: At 10:05, high (10:04 bar) was 100, current high is 99 โ peak detected
At 10:05:30, new high of 101 arrives โ peak condition breaks โ signal disappears
At 10:06 (bar close), final high is 101 โ no peak at 10:04 anymore โ signal gone permanently
This is expected behavior for realtime responsiveness. You get preview/early warning, but it's not locked until bar confirms.
Solutions :
Use Confirmed Timing :
Switch to "Confirmed (lookforward)" mode
ZERO repainting โ pivot must be fully validated
5-bar delay (pivot_lookforward)
What you see in history is exactly what would have appeared live
Accept Realtime Repaint as Tradeoff :
Keep Realtime mode for speed and alerts
Understand that pre-confirmation signals may vanish
Only trade signals that CONFIRM at bar close (check barstate.isconfirmed)
Use for live monitoring, NOT for backtesting
Trade Only After Confirmation :
In Realtime mode, wait 1 full bar after signal appears before entering
If signal survives that bar close, it's locked
This adds 1-bar delay but removes repaint risk
Recommendation : Use Confirmed for backtesting and conservative trading. Use Realtime only for active monitoring with full understanding of preview behavior.
Risk Management Integration
BZ-CAE is a signal generation system, not a complete trading strategy. You must integrate proper risk management:
Position Sizing by Confidence
Confidence 0.70-1.00 (Premium) :
Risk: 1.5-2.0% of account (MAXIMUM)
Reasoning: High-quality setup across all factors
Still cap at 2% โ even premium setups can fail
Confidence 0.50-0.70 (High Quality) :
Risk: 1.0-1.5% of account
Reasoning: Standard good setup
Your bread-and-butter risk level
Confidence 0.35-0.50 (Moderate Quality) :
Risk: 0.5-1.0% of account
Reasoning: Marginal setup, passes minimum threshold
Reduce size or skip if you're selective
Confidence <0.35 (Low Quality) :
Risk: 0% (blocked in Filtering mode)
Reasoning: Insufficient quality factors
System protects you by not showing these
Stop Placement Strategies
For Reversal Signals (Regular Divergences) :
Place stop beyond the divergence pivot plus buffer
Bullish : Stop below the divergence low - 1.0-1.5 ร ATR
Bearish : Stop above the divergence high + 1.0-1.5 ร ATR
Reasoning: If price breaks the pivot, divergence structure is invalidated
For Continuation Signals (Hidden Divergences) :
Place stop beyond recent swing in opposite direction
Bullish continuation : Stop below recent swing low (not the divergence pivot itself)
Bearish continuation : Stop above recent swing high
Reasoning: You're trading with trend, allow more breathing room
ATR-Based Stops :
1.5-2.0 ร ATR is standard
Scale by timeframe:
Scalping (1-5m): 1.0-1.5 ร ATR (tight)
Day trading (15m-1H): 1.5-2.0 ร ATR (balanced)
Swing (4H-D): 2.0-3.0 ร ATR (wide)
Never Use Fixed Dollar/Pip Stops :
Markets have different volatility
50-pip stop on EUR/USD โ 50-pip stop on GBP/JPY
Always normalize by ATR or pivot structure
Profit Targets and Scaling
Primary Target :
2-3 ร ATR from entry (minimum 2:1 reward-risk)
Example : Entry at 100, ATR = 2, stop at 97 (1.5 ร ATR) โ target at 106 (3 ร ATR) = 2:1 R:R
Scaling Out Strategy :
Take 50% off at 1.5 ร ATR (secure partial profit)
Move stop to breakeven
Trail remaining 50% with 1.0 ร ATR trailing stop
Let winners run if trend persists
Targets by Confidence :
High Confidence (>0.70) : Aggressive targets (3-4 ร ATR), trail wider (1.5 ร ATR)
Standard Confidence (0.50-0.70) : Normal targets (2-3 ร ATR), standard trail (1.0 ร ATR)
Low Confidence (0.35-0.50) : Conservative targets (1.5-2 ร ATR), tight trail (0.75 ร ATR)
Use Bifurcation Zones :
If opposite-side zone is visible on chart (from previous signal), use it as target
Example : Bullish signal at 100, prior supply zone at 110 โ use 110 as target
Zones mark institutional resistance/support
Exhaustion-Based Exits :
If you're in a trade and exhaustion >0.75 develops (yellow shading), consider early exit
Market is overextended โ reversal risk is high
Take profit even if target not reached
Trade Management by TCS
High TCS + Counter-Trend Trade (Risky) :
Use very tight stops (1.0-1.5 ร ATR)
Conservative targets (1.5-2 ร ATR)
Quick exit if trade doesn't work immediately
You're fading momentum โ respect it
Low TCS + Reversal Trade (Safer) :
Use wider stops (2.0-2.5 ร ATR)
Aggressive targets (3-4 ร ATR)
Trail with patience
Genuine reversal potential in weak trend
High TCS + Continuation Trade (Safest) :
Standard stops (1.5-2.0 ร ATR)
Very aggressive targets (4-5 ร ATR)
Trail wide (1.5-2.0 ร ATR)
You're with institutional momentum โ let it run
Educational Value โ Learning Machine Intelligence
BZ-CAE is designed as a learning platform, not just a tool:
Advisory Mode as Teacher
Most indicators are binary: signal or no signal. You don't learn WHY certain setups are better.
BZ-CAE's Advisory mode shows you EVERY potential divergence, then annotates the ones that would be blocked in Filtering mode with specific reasons:
"Bull: strong downtrend (TCS=0.87)" teaches you that TCS >0.85 makes counter-trend very risky
"Adversarial bearish" teaches you that the opposing case was dominating
"Low confidence 32%" teaches you that the setup lacked quality across multiple factors
"Bull spacing: wait 8 bars" teaches you that signals need breathing room
After 50-100 signals in Advisory mode, you internalize the CAE's decision logic. You start seeing these factors yourself BEFORE the indicator does.
Dashboard Transparency
Most "intelligent" indicators are black boxes โ you don't know how they make decisions.
BZ-CAE shows you ALL metrics in real-time:
TCS tells you trend strength
DMA tells you momentum alignment
Exhaustion tells you overextension
Adversarial shows both sides of the debate
Confidence shows composite quality
You learn to interpret market state holistically, a skill applicable to ANY trading system beyond this indicator.
Divergence Quality Education
Not all divergences are equal. BZ-CAE teaches you which conditions produce high-probability setups:
Quality divergence : Regular bullish div at a low, TCS <0.50 (weak trend), exhaustion >0.75 (overextended), positive adversarial differential, confidence >0.70
Low-quality divergence : Regular bearish div at a high, TCS >0.85 (strong uptrend), exhaustion <0.30 (not overextended), negative adversarial differential, confidence <0.40
After using the system, you can evaluate divergences manually with similar intelligence.
Risk Management Discipline
Confidence-based position sizing teaches you to adjust risk based on setup quality, not emotions:
Beginners often size all trades identically
Or worse, size UP on marginal setups to "make up" for losses
BZ-CAE forces systematic sizing: premium setups get larger size, marginal setups get smaller size
This creates a probabilistic approach where your edge compounds over time.
What This Indicator Is NOT
Complete transparency about limitations and positioning:
Not a Prediction System
BZ-CAE does not predict future prices. It identifies structural divergences (price-momentum disagreements) and assesses current market state (trend, exhaustion, adversarial conditions). It tells you WHEN conditions favor a potential reversal or continuation, not WHAT WILL HAPPEN.
Markets are probabilistic. Even premium-confidence setups fail ~30-40% of the time. The system improves your probability distribution over many trades โ it doesn't eliminate risk.
Not Fully Automated
This is a decision support tool, not a trading robot. You must:
Execute trades manually based on signals
Manage positions (stops, targets, trailing)
Apply discretionary judgment (news events, liquidity, context)
Integrate with your broader strategy and risk rules
The confidence scores guide position sizing, but YOU determine final risk allocation based on your account size, risk tolerance, and portfolio context.
Not Beginner-Friendly
BZ-CAE requires understanding of:
Divergence trading concepts (regular vs hidden, reversal vs continuation)
Market state interpretation (trend vs range, momentum, exhaustion)
Basic technical analysis (pivots, support/resistance, EMAs)
Risk management fundamentals (position sizing, stops, R:R)
This is designed for intermediate to advanced traders willing to invest time learning the system. If you want "buy the arrow" simplicity, this isn't the tool.
Not a Holy Grail
There is no perfect indicator. BZ-CAE filters noise and improves signal quality significantly, but:
Losing trades are inevitable (even at 70% win rate, 30% still fail)
Market conditions change rapidly (yesterday's strong trend becomes today's chop)
Black swan events occur (fundamentals override technicals)
Execution matters (slippage, fees, emotional discipline)
The system provides an EDGE, not a guarantee. Your job is to execute that edge consistently with proper risk management over hundreds of trades.
Not Financial Advice
BZ-CAE is an educational and analytical tool. All trading decisions are your responsibility. Past performance (backtested or live) does not guarantee future results. Only risk capital you can afford to lose. Consult a licensed financial advisor for investment advice specific to your situation.
Ideal Market Conditions
Best Performance Characteristics
Liquid Instruments :
Major forex pairs (EUR/USD, GBP/USD, USD/JPY)
Large-cap stocks and index ETFs (SPY, QQQ, AAPL, MSFT)
High-volume crypto (BTC, ETH)
Major commodities (Gold, Oil, Natural Gas)
Reasoning: Clean price structure, clear pivots, meaningful oscillator behavior
Trending with Consolidations :
Markets that trend for 20-40 bars, then consolidate 10-20 bars, repeat
Creates divergences at consolidation boundaries (reversals) and within trends (continuations)
Both regular and hidden divs find opportunities
5-Minute to Daily Timeframes :
Below 5m: too much noise, false pivots, CAE metrics unstable
Above daily: too few signals, edge diminishes (fundamentals dominate)
Sweet spot: 15m to 4H for most traders
Consistent Volume and Participation :
Regular trading sessions (not holidays or thin markets)
Predictable volatility patterns
Avoid instruments with sudden gaps or circuit breakers
Challenging Conditions
Extremely Low Liquidity :
Penny stocks, exotic forex pairs, low-volume crypto
Erratic pivots, unreliable oscillator readings
CAE metrics can't assess market state properly
Very Low Timeframes (1-Minute or Below) :
Dominated by market microstructure noise
Divergences are everywhere but meaningless
CAE filtering helps but still unreliable
Extended Sideways Consolidation :
100+ bars of tight range with no clear pivots
Oscillator hugs midpoint (45-55 range)
No divergences to detect
Fundamentally-Driven Gap Markets :
Earnings releases, economic data, geopolitical events
Price gaps over stops and targets
Technical structure breaks down
Recommendation: Disable trading around known events
Calculation Methodology โ Technical Depth
For users who want to understand the math:
Oscillator Computation
Each oscillator type calculates differently, but all normalize to 0-100:
RSI : ta.rsi(close, length) โ Standard Relative Strength Index
Stochastic : ta.stoch(high, low, close, length) โ %K calculation
CCI : (ta.cci(hlc3, length) + 100) / 2 โ Normalized from -100/+100 to 0-100
MFI : ta.mfi(hlc3, length) โ Volume-weighted RSI equivalent
Williams %R : ta.wpr(length) + 100 โ Inverted stochastic adjusted to 0-100
Smoothing: If smoothing > 1, apply ta.sma(oscillator, smoothing)
Divergence Detection Algorithm
Identify Pivots :
Price high pivot: ta.pivothigh(high, lookback, lookforward)
Price low pivot: ta.pivotlow(low, lookback, lookforward)
Oscillator high pivot: ta.pivothigh(osc, lookback, lookforward)
Oscillator low pivot: ta.pivotlow(osc, lookback, lookforward)
Store Recent Pivots :
Maintain arrays of last 10 pivots with bar indices
When new pivot confirmed, unshift to array, pop oldest if >10
Scan for Slope Disagreements :
Loop through last 5 pivots
For each pair (current pivot, historical pivot):
Check if within max_lookback bars
Calculate slopes: (current - historical) / bars_between
Regular bearish: price_slope > 0, osc_slope < 0, |osc_slope| > min_threshold
Regular bullish: price_slope < 0, osc_slope > 0, |osc_slope| > min_threshold
Hidden bearish: price_slope < 0, osc_slope > 0, osc_slope > min_threshold
Hidden bullish: price_slope > 0, osc_slope < 0, |osc_slope| > min_threshold
Important Disclaimers and Terms
Performance Disclosure
Past performance, whether backtested or live-traded, does not guarantee future results. Markets change. What works today may not work tomorrow. Hypothetical or simulated performance results have inherent limitations and do not represent actual trading.
Risk of Loss
Trading involves substantial risk of loss. Only trade with risk capital you can afford to lose entirely. The high degree of leverage often available in trading can work against you as well as for you. Leveraged trading may result in losses exceeding your initial deposit.
Not Financial Advice
BZ-CAE is an educational and analytical tool for technical analysis. It is not financial advice, investment advice, or a recommendation to buy or sell any security or instrument. All trading decisions are your sole responsibility. Consult a licensed financial advisor for advice specific to your circumstances.
Technical Indicator Limitations
BZ-CAE is a technical analysis tool based on price and volume data. It does not account for:
Fundamental analysis (earnings, economic data, financial health)
Market sentiment and positioning
Geopolitical events and news
Liquidity conditions and market microstructure changes
Regulatory changes or exchange rules
Integrate with broader analysis and strategy. Do not rely solely on technical indicators for trading decisions.
Repainting Acknowledgment
As disclosed throughout this documentation:
Realtime mode may repaint on forming bars before confirmation (by design for preview functionality)
Confirmed mode has zero repainting (fully validated pivots only)
Choose timing mode appropriate for your use case. Understand the tradeoffs.
Testing Recommendation
ALWAYS test on demo/paper accounts before committing real capital. Validate the indicator's behavior on your specific instruments and timeframes. Learn the system thoroughly in Advisory mode before using Filtering mode.
Learning Resources :
In-indicator tooltips (hover over setting names for detailed explanations)
This comprehensive publishing statement (save for reference)
User guide in script comments (top of code)
Final Word โ Philosophy of BZ-CAE
BZ-CAE is not designed to replace your judgment โ it's designed to enhance it.
The indicator identifies structural inflection points (bifurcations) where price and momentum disagree. The Cognitive Engine evaluates market state to determine if this disagreement is meaningful or noise. The Adversarial model debates both sides of the trade to catch obvious bad setups. The Confidence system ranks quality so you can choose your risk appetite.
But YOU still execute. YOU still manage risk. YOU still learn from outcomes.
This is intelligence amplification, not intelligence replacement.
Use Advisory mode to learn how expert traders evaluate market state. Use Filtering mode to enforce discipline when emotions run high. Use the dashboard to develop a systematic approach to reading markets. Use confidence scores to size positions probabilistically.
The system provides an edge. Your job is to execute that edge with discipline, patience, and proper risk management over hundreds of trades.
Markets are probabilistic. No system wins every trade. But a systematic edge + disciplined execution + proper risk management compounds over time. That's the path to consistent profitability. BZ-CAE gives you the edge. The discipline and risk management are on you.
Taking you to school. โ Dskyz, Trade with insight. Trade with anticipation.
CNN Fear and Greed StrategyAdaptation of the CNN Fear and Greed Index Indicator (Original by EdgeTools)
The following changes have been implemented:
Put/Call Ratio Data Source: The data source for the Put/Call Ratio has been updated.
Bond Data Source: The data sources for the bond components (Safe Haven Demand and Junk Bond Demand) have been updated.
Normalization Adjustment: The normalization method has been adjusted to allow the CNN Fear and Greed Index to display over a longer historical period, optimizing it for backtesting purposes.
Style Modification: The display style has been modified for a simpler and cleaner appearance.
Strategy Logic Addition: Added a new strategy entry condition: index >= 25 AND index crosses over its 5-period Simple Moving Average (SMA), and a corresponding exit condition of holding the position for 252 bars (days).
CNN Fear & Greed Backtest Strategy (Adapted)
This script is an adaptation of the popular CNN Fear & Greed Index, originally created by EdgeTools, with significant modifications to optimize it for long-term backtesting on the TradingView platform.
The core function of the Fear & Greed Index is to measure the current emotional state of the stock market, ranging from 0 (Extreme Fear) to 100 (Extreme Greed). It operates on the principle that excessive fear drives prices too low (a potential buying opportunity), and excessive greed drives them too high (a potential selling opportunity).
Key Components of the Index (7 Factors)
The composite index is calculated as a weighted average of seven market indicators, each normalized to a score between 0 and 100:
Market Momentum: S&P 500's current level vs. its 125-day Moving Average.
Stock Price Strength: Stocks hitting 52-week highs vs. those hitting 52-week lows.
Stock Price Breadth: Measured by the McClellan Volume Summation Index (or similar volume/breadth metric).
Put/Call Ratio: The relationship between volume of put options (bearish bets) and call options (bullish bets).
Market Volatility: The CBOE VIX Index relative to its 50-day Moving Average.
Safe Haven Demand: The relative performance of stocks (S&P 500) vs. bonds.
Junk Bond Demand: The spread between high-yield (junk) bonds and U.S. Treasury yields.
Critical Adaptations for Backtesting
To improve the index's utility for quantitative analysis, the following changes were made:
Long-Term Normalization: The original normalization method (ta.stdev over a short LENGTH) has been replaced or adjusted to use longer historical data. This change ensures the index generates consistent and comparable sentiment scores across decades of market history, which is crucial for reliable backtesting results.
Updated Data Sources: Specific ticker requests for the Put/Call Ratio and Bond components (Safe Haven and Junk Bond Demand) have been updated to use the most reliable and long-running data available on TradingView, reducing data gaps and improving chart continuity.
Simplified Visuals: The chart display is streamlined, focusing only on the final Fear & Greed Index line and key threshold levels (25, 50, 75) for quick visual assessment.
Integrated Trading Strategy
This script also includes a simple, rules-based strategy designed to test the counter-trend philosophy of the index:
Entry Logic (Long Position): A long position is initiated when the market shows increasing fear, specifically when the index score is less than or equal to the configurable FEAR_LEVEL (default 25) and the index crosses above its own short-term 5-period Simple Moving Average (SMA). This crossover acts as a confirmation that sentiment may be starting to turn around from peak fear.
Exit Logic (Time-Based): All positions are subject to a time-based exit after holding for 252 trading days (approximately one year). This fixed holding period aims to capture the typical duration of a cyclical market recovery following a major panic event.
Advanced Multi-Timeframe Trading System (Risk Managed)Description:
This strategy is an original approach that combines two main analytical components to identify potential trade opportunities while simulating realistic trading conditions:
1. Market Trend Analysis via an Approximate Hurst Exponent
โข What It Does:
The strategy computes a rough measure of market trending using an approximate Hurst exponent. A value above 0.5 suggests persistent, trending behavior, while a value below 0.5 indicates a tendency toward mean-reversion.
โข How Itโs Used:
The Hurst exponent is calculated on both the chartโs current timeframe and a higher timeframe (default: Daily) to capture both local and broader market dynamics.
2. Fibonacci Retracement Levels
โข What It Does:
Using daily high and low data from a selected timeframe (default: Daily), the script computes key Fibonacci retracement levels.
โข How Itโs Used:
โข The 61.8% level (Golden Ratio) serves as a key threshold:
โข A long entry is signaled when the price crosses above this level if the daily Hurst exponent confirms a trending market.
โข The 38.2% level is used to identify short-entry opportunities when the price crosses below it and the daily Hurst indicates non-trending conditions.
Signal Logic:
โข Long Entry:
When the price crosses above the 61.8% Fibonacci level (Golden Ratio) and the daily Hurst exponent is greater than 0.5, suggesting a trending market.
โข Short Entry:
When the price crosses below the 38.2% Fibonacci level and the daily Hurst exponent is less than 0.5, indicating a less trending or potentially reversing market.
Risk Management & Trade Execution:
โข Stop-Loss:
Each trade is risk-managed with a stop-loss set at 2% below (for longs) or above (for shorts) the entry price. This ensures that no single trade risks more than a small, sustainable portion of the account.
โข Take Profit:
A take profit order targets a risk-reward ratio of 1:2 (i.e., the target profit is twice the amount risked).
โข Position Sizing:
Trades are executed with a fixed position size equal to 10% of account equity.
โข Trade Frequency Limits:
โข Daily Limit: A maximum of 5 trades per day
โข Overall Limit: No more than 510 trades during the backtesting period (e.g., since 2019)
These limits are imposed to simulate realistic trading frequency and to avoid overtrading in backtest results.
Backtesting Parameters:
โข Initial Capital: $10,000
โข Commission: 0.1% per trade
โข Slippage: 1 tick per bar
These settings aim to reflect the conditions faced by the average trader and help ensure that the backtesting results are realistic and not misleading.
Chart Overlays & Visual Aids:
โข Fibonacci Levels:
The key Fibonacci retracement levels are plotted on the chart, and the zone between the 61.8% and 38.2% levels is highlighted to show a key retracement area.
โข Market Trend Background:
The chart background is tinted green when the daily Hurst exponent indicates a trending market (value > 0.5) and red otherwise.
โข Information Table:
An on-chart table displays key parameters such as the current Hurst exponent, daily Hurst value, the number of trades executed today, and the global trade count.
Disclaimer:
Past performance is not indicative of future results. This strategy is experimental and provided solely for educational purposes. It is essential that you backtest and paper trade using your own settings before considering any live deployment. The Hurst exponent calculation is an approximation and should be interpreted as a rough gauge of market behavior. Adjust the parameters and risk management settings according to your personal risk tolerance and market conditions.
Additional Notes:
โข Originality & Usefulness:
This script is an original mashup that combines trend analysis with Fibonacci retracement methods. The description above explains how these components work together to provide trading signals.
โข Realistic Results:
The strategy uses realistic account sizes, commission rates, slippage, and risk management rules to generate backtesting results that are representative of real-world trading.
โข Educational Purpose:
This script is intended to support the TradingView community by offering insights into combining multiple analysis techniques in one strategy. It is not a โget-rich-quickโ system but rather an educational tool to help traders understand risk management and trade signal logic.
By using this script, you acknowledge that trading involves risk and that you are responsible for testing and adjusting the strategy to fit your own trading environment. This publication is fully open source, and any modifications should include proper attribution if significant portions of the code are reused.
ICT Judas Swing | Flux Charts๐ GENERAL OVERVIEW
Introducing our new ICT Judas Swing Indicator! This indicator is built around the ICT's "Judas Swing" strategy. The strategy looks for a liquidity grab around NY 9:30 session and a Fair Value Gap for entry confirmation. For more information about the process, check the "HOW DOES IT WORK" section.
Features of the new ICT Judas Swing :
Implementation of ICT's Judas Swing Strategy
2 Different TP / SL Methods
Customizable Execution Settings
Customizable Backtesting Dashboard
Alerts for Buy, Sell, TP & SL Signals
๐ HOW DOES IT WORK ?
The strategy begins by identifying the New York session from 9:30 to 9:45 and marking recent liquidity zones. These liquidity zones are determined by locating high and low pivot points: buyside liquidity zones are identified using high pivots that haven't been invalidated, while sellside liquidity zones are found using low pivots. A break of either buyside or sellside liquidity must occur during the 9:30-9:45 session, which is interpreted as a liquidity grab by smart money. The strategy assumes that after this liquidity grab, the price will reverse and move in the opposite direction. For entry confirmation, a fair value gap (FVG) in the opposite direction of the liquidity grab is required. A buyside liquidity grab calls for a bearish FVG, while a sellside grab requires a bullish FVG. Based on the type of FVGโbullish for buys and bearish for sellsโthe indicator will then generate a Buy or Sell signal.
After the Buy or Sell signal, the indicator immediately draws the take-profit (TP) and stop-loss (SL) targets. The indicator has three different TP & SL modes, explained in the "Settings" section of this write-up.
You can set up alerts for entry and TP & SL signals, and also check the current performance of the indicator and adjust the settings accordingly to the current ticker using the backtesting dashboard.
๐ฉ UNIQUENESS
This indicator is an all-in-one suit for the ICT's Judas Swing concept. It's capable of plotting the strategy, giving signals, a backtesting dashboard and alerts feature. Different and customizable algorithm modes will help the trader fine-tune the indicator for the asset they are currently trading. Three different TP / SL modes are available to suit your needs. The backtesting dashboard allows you to see how your settings perform in the current ticker. You can also set up alerts to get informed when the strategy is executable for different tickers.
โ๏ธ SETTINGS
1. General Configuration
Swing Length -> The swing length for pivot detection. Higher settings will result in
FVG Detection Sensitivity -> You may select between Low, Normal, High or Extreme FVG detection sensitivity. This will essentially determine the size of the spotted FVGs, with lower sensitivies resulting in spotting bigger FVGs, and higher sensitivies resulting in spotting all sizes of FVGs.
2. TP / SL
TP / SL Method ->
a) Dynamic: The TP / SL zones will be auto-determined by the algorithm based on the Average True Range (ATR) of the current ticker.
b) Fixed : You can adjust the exact TP / SL ratios from the settings below.
Dynamic Risk -> The risk you're willing to take if "Dynamic" TP / SL Method is selected. Higher risk usually means a better winrate at the cost of losing more if the strategy fails. This setting is has a crucial effect on the performance of the indicator, as different tickers may have different volatility so the indicator may have increased performance when this setting is correctly adjusted.
ICT Unicorn | Flux Charts๐ GENERAL OVERVIEW
Introducing our new ICT Unicorn Indicator! This indicator is built around the ICT's "Unicorn" strategy. The strategy uses Breaker Blocks and Fair Value Gaps for entry confirmation. For more information about the process, check the "HOW DOES IT WORK" section.
Features of the new ICT Unicorn Indicator :
Implementation of ICT's Unicorn Strategy
Toggleable Retracement Entry Method
3 Different TP / SL Methods
Customizable Execution Settings
Customizable Backtesting Dashboard
Alerts for Buy, Sell, TP & SL Signals
๐ HOW DOES IT WORK ?
The ICT Unicorn entry model merges the concepts of Breaker Blocks and Fair Value Gaps (FVGs), offering a distinct method for identifying trade opportunities. By integrating these two elements, we can have a position entry with stop-loss and take-profit targets on the potential support & resistance zones. This model is particularly reliable for trade entry, as it combines two powerful entry techniques.
An ICT Unicorn Model consists of a FVG which is overlapping with a Breaker Block of the same type. Here is an example :
When a FVG overlaps with a Breaker Block of the same type, the indicator gives a Buy or Sell signal depending on the FVG type (Bullish & Bearish). If the "Require Retracement" option is enabled in the settings, the signals are not given immediately. Instead, the current price of the ticker will need to touch the FVG once more before the signals are given.
After the Buy or Sell signal, the indicator immediately draws the take-profit (TP) and stop-loss (SL) targets. The indicator has three different TP & SL modes, explained in the "Settings" section of this write-up.
You can set up alerts for entry and TP & SL signals, and also check the current performance of the indicator and adjust the settings accordingly to the current ticker using the backtesting dashboard.
๐ฉ UNIQUENESS
This indicator is an all-in-one suit for the ICT's Unicorn concept. It's capable of plotting the strategy, giving signals, a backtesting dashboard and alerts feature. Different and customizable algorithm modes will help the trader fine-tune the indicator for the asset they are currently trading. Three different TP / SL modes are available to suit your needs. The backtesting dashboard allows you to see how your settings perform in the current ticker. You can also set up alerts to get informed when the strategy is executable for different tickers.
โ๏ธ SETTINGS
1. General Configuration
FVG Detection Sensitivity -> You may select between Low, Normal, High or Extreme FVG detection sensitivity. This will essentially determine the size of the spotted FVGs, with lower sensitivies resulting in spotting bigger FVGs, and higher sensitivies resulting in spotting all sizes of FVGs.
Swing Length -> Swing length is used when finding order block formations. Smaller values will result in finding smaller order & breaker blocks.
Require Retracement ->
a) Disabled : The entry signal is given immediately once a FVG overlaps with a Breaker Block of the same type.
b) Enabled : The current price of the ticker will need to touch the FVG once more before the entry signal is given.
2. TP / SL
TP / SL Method ->
a) Unicorn : This is the default option. The SL will be set to the lowest low of the last 100 bars with an extra offset in a Buy signal. For Sell signals, the SL will be set to the highest high of the last 100 bars with an extra offset. The TP is then set to a value using the SL value and maintaining a risk-reward ratio.
b) Dynamic: The TP / SL zones will be auto-determined by the algorithm based on the Average True Range (ATR) of the current ticker.
c) Fixed : You can adjust the exact TP / SL ratios from the settings below.
Dynamic Risk -> The risk you're willing to take if "Dynamic" TP / SL Method is selected. Higher risk usually means a better winrate at the cost of losing more if the strategy fails. This setting is has a crucial effect on the performance of the indicator, as different tickers may have different volatility so the indicator may have increased performance when this setting is correctly adjusted.
Negroni Opening Range StrategyStrategy Summary:
This tool can be used to help identify breakouts from a range during a time-zone of your choosing. It plots a pre-market range, an opening range, it also includes moving average levels that can be used as confluence, as well as plotting previous day SESSION highs and lows.
There are several options on how you wish to close out the trades, all described in more detail below.
Back-testing Inputs:
You define your timezone.
You define how many trades to open on any given day.
You decide to go: long only, short only, or long & short (CAREFUL: "Long & Short" can open trades that effectively closes-out existing ones, for better AND worse!)
You define between which times the strategy will open trades.
You define when it closes any open trades (preventing overnight trades, or leaving trades open into US data times!!).
This hopefully helps make back-testing reflect YOUR trading hours.
NOTE: Renko or Heikin-Ashi charts
For ALL strategies, donโt use Renko or Heikin-Ashi charts unless you know EXACTLY the implications.
Specific to my strategy, using a renko chart can make this 85-90% profitable (I wish it was!!) Although they can be useful, renko charts donโt always capture real wicks, so the renko chart may show your trade up-only but your broker (who is not using renko!!) will have likely stopped you out on a wick somewhere along the line.
NOTE: TradingView โDeep backtestingโ
For ALL strategies, be cynical of all backtesting (e.g. repainting issues etc) as well as โDeep backtestingโ results.
Specific to this strategy, the default settings here SHOULD BE OK, but unfortunately at the time of writing, we canโt see on the chart what exactly โdeep backtestingโ is calculating. In the past I have noted a number of trades that were not closed at the end of the day, despite my โend of dayโ trade closing being enabled, so there were big winners and losers that would not have materialized otherwise. As I say, this seems ok at these settings but just always be cynical!!
Opening Range Inputs
You define a pre-market range (example: 08:00 - 09:00).
You define an opening range (example: 09:00 - 09:30).
The strategy will give an update at the close of the opening range to let you know if the opening range has broken out the pre-market range (OR Breakout), or if it has remained inside (OR Inside). The label appears at the end of the opening range NOT at the bar that โbroke-outโ.
This is just a visual cue for you, it has no bearing on what the strategy will do.
The strategy default will trade off the pre-market range, but you can untick this if you prefer to trade off the opening range.
Opening Trades:
Strategy goes long when the bar (CLOSE) crosses-over the โpre-marketโ high (not the โopening rangeโ high); and the time is within your trading session, and you have not maxed out your number of trades for the day!
Strategy goes short when the bar (CLOSE) crosses-under the โpre-marketโ low (not the โopening range low); and the time is within your trading session, and you have not maxed out your number of trades for the day!
Remember, you can untick this if you prefer to trade off the opening range instead.
NOTES:
Using momentum indicators can help (RSI and MACD): especially to trade range plays in failed breakouts, when momentum shiftsโฆ but the strategy wonโt do this for you!
Using an anchored vwap at the session open can also provide nice confluence, as well as take-profit levels at the upper/lower of 3x standard deviation.
CLOSING TRADES:
You have 6 take-profit (TP) options:
1) Full TP: uses ATR Multiplier - Full TP at the ATR parameters as defined in inputs.
2) Take Partial profits: ATR Multiplier - Takes partial profits based on parameters as defined in inputs (i.e close 40% of original trade at TP1, close another 40% of original trade at TP2, then the remainder at Full TP as set in option 1.).
3) Full TP: Trailing Stop - Applies a Trailing Stop at the number of points, as defined in inputs.
4) Full TP: MA cross - Takes profit when price crosses โTrend MAโ as defined in inputs.
5) Scalp: Points - closes at a set number of points, as defined in inputs.
6) Full TP: PMKT Multiplier - places a SL at opposite pre-market Hi/Low (we go long at a break-out of the pre-market high, 50% would place a SL at the pre-market range mid-point; 100% would place a SL at the pre-market low)'. This takes profit at the input set in option 1).
Dual Chain StrategyDual Chain Strategy - Technical Overview
How It Works:
The Dual Chain Strategy is a unique approach to trading that utilizes Exponential Moving Averages (EMAs) across different timeframes, creating two distinct "chains" of trading signals. These chains can work independently or together, capturing both long-term trends and short-term price movements.
Chain 1 (Longer-Term Focus):
Entry Signal: The entry signal for Chain 1 is generated when the closing price crosses above the EMA calculated on a weekly timeframe. This suggests the start of a bullish trend and prompts a long position.
bullishChain1 = enableChain1 and ta.crossover(src1, entryEMA1)
Exit Signal: The exit signal is triggered when the closing price crosses below the EMA on a daily timeframe, indicating a potential bearish reversal.
exitLongChain1 = enableChain1 and ta.crossunder(src1, exitEMA1)
Parameters: Chain 1's EMA length is set to 10 periods by default, with the flexibility for user adjustment to match various trading scenarios.
Chain 2 (Shorter-Term Focus):
Entry Signal: Chain 2 generates an entry signal when the closing price crosses above the EMA on a 12-hour timeframe. This setup is designed to capture quicker, shorter-term movements.
bullishChain2 = enableChain2 and ta.crossover(src2, entryEMA2)
Exit Signal: The exit signal occurs when the closing price falls below the EMA on a 9-hour timeframe, indicating the end of the shorter-term trend.
exitLongChain2 = enableChain2 and ta.crossunder(src2, exitEMA2)
Parameters: Chain 2's EMA length is set to 9 periods by default, and can be customized to better align with specific market conditions or trading strategies.
Key Features:
Dual EMA Chains: The strategy's originality shines through its dual-chain configuration, allowing traders to monitor and react to both long-term and short-term market trends. This approach is particularly powerful as it combines the strengths of trend-following with the agility of momentum trading.
Timeframe Flexibility: Users can modify the timeframes for both chains, ensuring the strategy can be tailored to different market conditions and individual trading styles. This flexibility makes it versatile for various assets and trading environments.
Independent Trade Logic: Each chain operates independently, with its own set of entry and exit rules. This allows for simultaneous or separate execution of trades based on the signals from either or both chains, providing a robust trading system that can handle different market phases.
Backtesting Period: The strategy includes a configurable backtesting period, enabling thorough performance assessment over a historical range. This feature is crucial for understanding how the strategy would have performed under different market conditions.
time_cond = time >= startDate and time <= finishDate
What It Does:
The Dual Chain Strategy offers traders a distinctive trading tool that merges two separate EMA-based systems into one cohesive framework. By integrating both long-term and short-term perspectives, the strategy enhances the ability to adapt to changing market conditions. The originality of this script lies in its innovative dual-chain design, providing traders with a unique edge by allowing them to capitalize on both significant trends and smaller, faster price movements.
Whether you aim to capture extended market trends or take advantage of more immediate price action, the Dual Chain Strategy provides a comprehensive solution with a high degree of customization and strategic depth. Its flexibility and originality make it a valuable tool for traders seeking to refine their approach to market analysis and execution.
How to Use the Dual Chain Strategy
Step 1: Access the Strategy
Add the Script: Start by adding the Dual Chain Strategy to your TradingView chart. You can do this by searching for the script by name or using the link provided.
Select the Asset: Apply the strategy to your preferred trading pair or asset, such as #BTCUSD, to see how it performs.
Step 2: Configure the Settings
Enable/Disable Chains:
The strategy is designed with two independent chains. You can choose to enable or disable each chain depending on your trading style and the market conditions.
enableChain1 = input.bool(true, title='Enable Chain 1')
enableChain2 = input.bool(true, title='Enable Chain 2')
By default, both chains are enabled. If you prefer to focus only on longer-term trends, you might disable Chain 2, or vice versa if you prefer shorter-term trades.
Set EMA Lengths:
Adjust the EMA lengths for each chain to match your trading preferences.
Chain 1: The default EMA length is 10 periods. This chain uses a weekly timeframe for entry signals and a daily timeframe for exits.
len1 = input.int(10, minval=1, title='Length Chain 1 EMA', group="Chain 1")
Chain 2: The default EMA length is 9 periods. This chain uses a 12-hour timeframe for entries and a 9-hour timeframe for exits.
len2 = input.int(9, minval=1, title='Length Chain 2 EMA', group="Chain 2")
Customize Timeframes:
You can customize the timeframes used for entry and exit signals for both chains.
Chain 1:
Entry Timeframe: Weekly
Exit Timeframe: Daily
tf1_entry = input.timeframe("W", title='Chain 1 Entry Timeframe', group="Chain 1")
tf1_exit = input.timeframe("D", title='Chain 1 Exit Timeframe', group="Chain 1")
Chain 2:
Entry Timeframe: 12 Hours
Exit Timeframe: 9 Hours
tf2_entry = input.timeframe("720", title='Chain 2 Entry Timeframe (12H)', group="Chain 2")
tf2_exit = input.timeframe("540", title='Chain 2 Exit Timeframe (9H)', group="Chain 2")
Set the Backtesting Period:
Define the period over which you want to backtest the strategy. This allows you to see how the strategy would have performed historically.
startDate = input.time(timestamp('2015-07-27'), title="StartDate")
finishDate = input.time(timestamp('2026-01-01'), title="FinishDate")
Step 3: Analyze the Signals
Understand the Entry and Exit Signals:
Buy Signals: When the price crosses above the entry EMA, the strategy generates a buy signal.
bullishChain1 = enableChain1 and ta.crossover(src1, entryEMA1)
Sell Signals: When the price crosses below the exit EMA, the strategy generates a sell signal.
bearishChain2 = enableChain2 and ta.crossunder(src2, entryEMA2)
Review the Visual Indicators:
The strategy plots buy and sell signals on the chart with labels for easy identification:
BUY C1/C2 for buy signals from Chain 1 and Chain 2.
SELL C1/C2 for sell signals from Chain 1 and Chain 2.
This visual aid helps you quickly understand when and why trades are being executed.
Step 4: Optimize the Strategy
Backtest Results:
Review the strategyโs performance over the backtesting period. Look at key metrics like net profit, drawdown, and trade statistics to evaluate its effectiveness.
Adjust the EMA lengths, timeframes, and other settings to see how changes affect the strategyโs performance.
Customize for Live Trading:
Once satisfied with the backtest results, you can apply the strategy settings to live trading. Remember to continuously monitor and adjust as needed based on market conditions.
Step 5: Implement Risk Management
Use Realistic Position Sizing:
Keep your risk exposure per trade within a comfortable range, typically between 1-2% of your trading capital.
Set Alerts:
Set up alerts for buy and sell signals, so you donโt miss trading opportunities.
Paper Trade First:
Consider running the strategy in a paper trading account to understand its behavior in real market conditions before committing real capital.
This dual-layered approach offers a distinct advantage: it enables the strategy to adapt to varying market conditions by capturing both broad trends and immediate price action without one chain's activity impacting the other's decision-making process. The independence of these chains in executing transactions adds a level of sophistication and flexibility that is rarely seen in more conventional trading systems, making the Dual Chain Strategy not just unique, but a powerful tool for traders seeking to navigate complex market environments.
CCI and MACD Auto Trading Strategy with Risk/RewardOverview:
This strategy combines the Commodity Channel Index (CCI) and the Moving Average Convergence Divergence (MACD) indicators to automate trading decisions. It dynamically sets stop-loss and take-profit levels based on recent lows and highs, ensuring a risk/reward ratio of 1:1.5. This script aims to leverage trend and momentum signals while maintaining effective risk management.
Originality and Usefulness:
This script is not just a simple mashup of CCI and MACD indicators; it incorporates dynamic risk management by setting stop-loss and take-profit levels based on recent price action. This approach helps traders to:
ใปIdentify potential trend reversals using the combination of CCI and MACD signals.
ใปManage trades effectively by setting realistic stop-loss and take-profit levels based on recent market data.
ใปMaintain a balanced risk/reward ratio, which is essential for sustainable trading.
Indicators Used:
ใปCCI (Commodity Channel Index):
ใใปMeasures the deviation of the price from its average over a specified period, typically ranging from -100 to +100.
ใใปHelps identify overbought and oversold conditions.
ใปMACD (Moving Average Convergence Divergence):
ใใปUtilizes the difference between short-term and long-term moving averages to indicate trend strength and direction.
ใใปProvides momentum signals that can be used for timing entries and exits.
How It Works:
Entry Conditions:
Long Entry:
ใใปThe MACD histogram is above zero.
ใใปThe CCI crosses above the -100 line.
Short Entry:
ใใปThe MACD histogram is below zero.
ใใปThe CCI crosses below the +100 line.
Exit Conditions:
Long Positions:
ใใปThe stop-loss is set at the recent low.
ใใปThe take-profit is set at 1.5 times the distance between the entry price and the stop-loss.
Short Positions:
ใใปThe stop-loss is set at the recent high.
ใใปThe take-profit is set at 1.5 times the distance between the entry price and the stop-loss.
Risk Management:
ใปThe script dynamically adjusts stop-loss and take-profit levels based on recent market data, ensuring that the risk/reward ratio is maintained at 1:1.5.
ใใปThis approach helps in managing the risk effectively while aiming for consistent profits.
Strategy Properties:
ใใปAccount Size: Configured for a realistic account size suitable for the average trader.
ใใปCommission and Slippage: Includes settings for realistic commission and slippage to reflect real market conditions.
ใใปRisk per Trade: Designed to risk no more than 5-10% of equity per trade, aligning with sustainable trading practices.
ใใปBacktesting Results: Configured to generate a sufficient sample size (ideally more than 100 trades) for reliable backtesting results.
Revised Backtesting Settings
Ensure that your backtesting settings are realistic:
ใปAccount Size: Set a realistic initial capital suitable for the average trader.
ใปCommission and Slippage: Include realistic commission fees and slippage.
ใปRisk Management: Ensure that each trade risks no more than 5-10% of the account equity.
ใปSufficient Sample Size: Choose a dataset that will generate more than 100 trades to provide a ใใใใใใrobust sample size.
Versatile Moving Average StrategyVersatile Moving Average Strategy (VMAS)
Overview:
The Versatile Moving Average Strategy (VMAS) is designed to provide traders with a flexible approach to trend-following, utilizing multiple types of moving averages. This strategy allows for customization in choosing the moving average type and length, catering to various market conditions and trading styles.
Key Features:
- Multiple Moving Average Types: Choose from SMA, EMA, SMMA (RMA), WMA, VWMA, HULL, LSMA, and ALMA to best suit your trading needs.
- Customizable Inputs: Adjust the moving average length, source of price data, and stop-loss source to fine-tune the strategy.
- Target Percent: Set the percentage difference between successive profit targets to manage your risk and rewards effectively.
- Position Management: Enable or disable long and short positions, allowing for versatility in different market conditions.
- Commission and Slippage: The strategy includes realistic commission settings to ensure accurate backtesting results.
Strategy Logic:
1. Moving Average Calculation: The selected moving average is calculated based on user-defined parameters.
2. Entry Conditions:
- A long position is entered when the entry source crosses over the moving average, if long positions are enabled.
- A short position is entered when the entry source crosses under the moving average, if short positions are enabled.
3. Stop-Loss: Positions are closed if the stop-loss source crosses the moving average in the opposite direction.
4. Profit Targets: Multiple profit targets are defined, with each target set at an incremental percentage above (for long positions) or below (for short positions) the entry price.
Default Properties:
- Account Size: $10000
- Commission: 0.01% per trade
- Risk Management: Positions are sized to risk 80% of the equity per trade, because we get very tight stoploss when position is open.
- Sample Size: Backtesting has been conducted to ensure a sufficient sample size of trades, ideally more than 100 trades.
How to Use:
1. Configure Inputs: Set your preferred moving average type, length, and other input parameters.
2. Enable Positions: Choose whether to enable long, short, or both types of positions.
3. Backtest and Analyze: Run backtests with realistic settings and analyze the results to ensure the strategy aligns with your trading goals.
4. Deploy and Monitor: Once satisfied with the backtesting results, deploy the strategy in a live environment and monitor its performance.
This strategy is suitable for traders looking to leverage moving averages in a versatile and customizable manner. Adjust the parameters to match your trading style and market conditions for optimal results.
Note: Ensure the strategy settings used for publication are the same as those described here. Always conduct thorough backtesting before deploying any strategy in a live trading environment.
CNTLibraryLibrary "CNTLibrary"
Custom Functions To Help Code In Pinescript V5
Coded By Christian Nataliano
First Coded In 10/06/2023
Last Edited In 22/06/2023
Huge Shout Out To ยฉ ZenAndTheArtOfTrading and his ZenLibrary V5, Some Of The Custom Functions Were Heavily Inspired By Matt's Work & His Pine Script Mastery Course
Another Shout Out To The TradingView's Team Library ta V5
//====================================================================================================================================================
// Custom Indicator Functions
//====================================================================================================================================================
GetKAMA(KAMA_lenght, Fast_KAMA, Slow_KAMA)
โโCalculates An Adaptive Moving Average Based On Perry J Kaufman's Calculations
โโParameters:
โโโโ KAMA_lenght (int) : Is The KAMA Lenght
โโโโ Fast_KAMA (int) : Is The KAMA's Fastes Moving Average
โโโโ Slow_KAMA (int) : Is The KAMA's Slowest Moving Average
โโReturns: Float Of The KAMA's Current Calculations
GetMovingAverage(Source, Lenght, Type)
โโGet Custom Moving Averages Values
โโParameters:
โโโโ Source (float) : Of The Moving Average, Defval = close
โโโโ Lenght (simple int) : Of The Moving Average, Defval = 50
โโโโ Type (string) : Of The Moving Average, Defval = Exponential Moving Average
โโReturns: The Moving Average Calculation Based On Its Given Source, Lenght & Calculation Type (Please Call Function On Global Scope)
GetDecimals()
โโCalculates how many decimals are on the quote price of the current market ยฉ ZenAndTheArtOfTrading
โโReturns: The current decimal places on the market quote price
Truncate(number, decimalPlaces)
โโTruncates (cuts) excess decimal places ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ number (float)
โโโโ decimalPlaces (simple float)
โโReturns: The given number truncated to the given decimalPlaces
ToWhole(number)
โโConverts pips into whole numbers ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ number (float)
โโReturns: The converted number
ToPips(number)
โโConverts whole numbers back into pips ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ number (float)
โโReturns: The converted number
GetPctChange(value1, value2, lookback)
โโGets the percentage change between 2 float values over a given lookback period ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ value1 (float)
โโโโ value2 (float)
โโโโ lookback (int)
BarsAboveMA(lookback, ma)
โโCounts how many candles are above the MA ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ lookback (int)
โโโโ ma (float)
โโReturns: The bar count of how many recent bars are above the MA
BarsBelowMA(lookback, ma)
โโCounts how many candles are below the MA ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ lookback (int)
โโโโ ma (float)
โโReturns: The bar count of how many recent bars are below the EMA
BarsCrossedMA(lookback, ma)
โโCounts how many times the EMA was crossed recently ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ lookback (int)
โโโโ ma (float)
โโReturns: The bar count of how many times price recently crossed the EMA
GetPullbackBarCount(lookback, direction)
โโCounts how many green & red bars have printed recently (ie. pullback count) ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ lookback (int)
โโโโ direction (int)
โโReturns: The bar count of how many candles have retraced over the given lookback & direction
GetSwingHigh(Lookback, SwingType)
โโCheck If Price Has Made A Recent Swing High
โโParameters:
โโโโ Lookback (int) : Is For The Swing High Lookback Period, Defval = 7
โโโโ SwingType (int) : Is For The Swing High Type Of Identification, Defval = 1
โโReturns: A Bool - True If Price Has Made A Recent Swing High
GetSwingLow(Lookback, SwingType)
โโCheck If Price Has Made A Recent Swing Low
โโParameters:
โโโโ Lookback (int) : Is For The Swing Low Lookback Period, Defval = 7
โโโโ SwingType (int) : Is For The Swing Low Type Of Identification, Defval = 1
โโReturns: A Bool - True If Price Has Made A Recent Swing Low
//====================================================================================================================================================
// Custom Risk Management Functions
//====================================================================================================================================================
CalculateStopLossLevel(OrderType, Entry, StopLoss)
โโCalculate StopLoss Level
โโParameters:
โโโโ OrderType (int) : Is To Determine A Long / Short Position, Defval = 1
โโโโ Entry (float) : Is The Entry Level Of The Order, Defval = na
โโโโ StopLoss (float) : Is The Custom StopLoss Distance, Defval = 2x ATR Below Close
โโReturns: Float - The StopLoss Level In Actual Price As A
CalculateStopLossDistance(OrderType, Entry, StopLoss)
โโCalculate StopLoss Distance In Pips
โโParameters:
โโโโ OrderType (int) : Is To Determine A Long / Short Position, Defval = 1
โโโโ Entry (float) : Is The Entry Level Of The Order, NEED TO INPUT PARAM
โโโโ StopLoss (float) : Level Based On Previous Calculation, NEED TO INPUT PARAM
โโReturns: Float - The StopLoss Value In Pips
CalculateTakeProfitLevel(OrderType, Entry, StopLossDistance, RiskReward)
โโCalculate TakeProfit Level
โโParameters:
โโโโ OrderType (int) : Is To Determine A Long / Short Position, Defval = 1
โโโโ Entry (float) : Is The Entry Level Of The Order, Defval = na
โโโโ StopLossDistance (float)
โโโโ RiskReward (float)
โโReturns: Float - The TakeProfit Level In Actual Price
CalculateTakeProfitDistance(OrderType, Entry, TakeProfit)
โโGet TakeProfit Distance In Pips
โโParameters:
โโโโ OrderType (int) : Is To Determine A Long / Short Position, Defval = 1
โโโโ Entry (float) : Is The Entry Level Of The Order, NEED TO INPUT PARAM
โโโโ TakeProfit (float) : Level Based On Previous Calculation, NEED TO INPUT PARAM
โโReturns: Float - The TakeProfit Value In Pips
CalculateConversionCurrency(AccountCurrency, SymbolCurrency, BaseCurrency)
โโGet The Conversion Currecny Between Current Account Currency & Current Pair's Quoted Currency (FOR FOREX ONLY)
โโParameters:
โโโโ AccountCurrency (simple string) : Is For The Account Currency Used
โโโโ SymbolCurrency (simple string) : Is For The Current Symbol Currency (Front Symbol)
โโโโ BaseCurrency (simple string) : Is For The Current Symbol Base Currency (Back Symbol)
โโReturns: Tuple Of A Bollean (Convert The Currency ?) And A String (Converted Currency)
CalculateConversionRate(ConvertCurrency, ConversionRate)
โโGet The Conversion Rate Between Current Account Currency & Current Pair's Quoted Currency (FOR FOREX ONLY)
โโParameters:
โโโโ ConvertCurrency (bool) : Is To Check If The Current Symbol Needs To Be Converted Or Not
โโโโ ConversionRate (float) : Is The Quoted Price Of The Conversion Currency (Input The request.security Function Here)
โโReturns: Float Price Of Conversion Rate (If In The Same Currency Than Return Value Will Be 1.0)
LotSize(LotSizeSimple, Balance, Risk, SLDistance, ConversionRate)
โโGet Current Lot Size
โโParameters:
โโโโ LotSizeSimple (bool) : Is To Toggle Lot Sizing Calculation (Simple Is Good Enough For Stocks & Crypto, Whilst Complex Is For Forex)
โโโโ Balance (float) : Is For The Current Account Balance To Calculate The Lot Sizing Based Off
โโโโ Risk (float) : Is For The Current Risk Per Trade To Calculate The Lot Sizing Based Off
โโโโ SLDistance (float) : Is The Current Position StopLoss Distance From Its Entry Price
โโโโ ConversionRate (float) : Is The Currency Conversion Rate (Used For Complex Lot Sizing Only)
โโReturns: Float - Position Size In Units
ToLots(Units)
โโConverts Units To Lots
โโParameters:
โโโโ Units (float) : Is For How Many Units Need To Be Converted Into Lots (Minimun 1000 Units)
โโReturns: Float - Position Size In Lots
ToUnits(Lots)
โโConverts Lots To Units
โโParameters:
โโโโ Lots (float) : Is For How Many Lots Need To Be Converted Into Units (Minimun 0.01 Units)
โโReturns: Int - Position Size In Units
ToLotsInUnits(Units)
โโConverts Units To Lots Than Back To Units
โโParameters:
โโโโ Units (float) : Is For How Many Units Need To Be Converted Into Lots (Minimun 1000 Units)
โโReturns: Float - Position Size In Lots That Were Rounded To Units
ATRTrail(OrderType, SourceType, ATRPeriod, ATRMultiplyer, SwingLookback)
โโCalculate ATR Trailing Stop
โโParameters:
โโโโ OrderType (int) : Is To Determine A Long / Short Position, Defval = 1
โโโโ SourceType (int) : Is To Determine Where To Calculate The ATR Trailing From, Defval = close
โโโโ ATRPeriod (simple int) : Is To Change Its ATR Period, Defval = 20
โโโโ ATRMultiplyer (float) : Is To Change Its ATR Trailing Distance, Defval = 1
โโโโ SwingLookback (int) : Is To Change Its Swing HiLo Lookback (Only From Source Type 5), Defval = 7
โโReturns: Float - Number Of The Current ATR Trailing
DangerZone(WinRate, AvgRRR, Filter)
โโCalculate Danger Zone Of A Given Strategy
โโParameters:
โโโโ WinRate (float) : Is The Strategy WinRate
โโโโ AvgRRR (float) : Is The Strategy Avg RRR
โโโโ Filter (float) : Is The Minimum Profit It Needs To Be Out Of BE Zone, Defval = 3
โโReturns: Int - Value, 1 If Out Of Danger Zone, 0 If BE, -1 If In Danger Zone
IsQuestionableTrades(TradeTP, TradeSL)
โโChecks For Questionable Trades (Which Are Trades That Its TP & SL Level Got Hit At The Same Candle)
โโParameters:
โโโโ TradeTP (float) : Is The Trade In Question Take Profit Level
โโโโ TradeSL (float) : Is The Trade In Question Stop Loss Level
โโReturns: Bool - True If The Last Trade Was A "Questionable Trade"
//====================================================================================================================================================
// Custom Strategy Functions
//====================================================================================================================================================
OpenLong(EntryID, LotSize, LimitPrice, StopPrice, Comment, CommentValue)
โโOpen A Long Order Based On The Given Params
โโParameters:
โโโโ EntryID (string) : Is The Trade Entry ID, Defval = "Long"
โโโโ LotSize (float) : Is The Lot Size Of The Trade, Defval = 1
โโโโ LimitPrice (float) : Is The Limit Order Price To Set The Order At, Defval = Na / Market Order Execution
โโโโ StopPrice (float) : Is The Stop Order Price To Set The Order At, Defval = Na / Market Order Execution
โโโโ Comment (string) : Is The Order Comment, Defval = Long Entry Order
โโโโ CommentValue (string) : Is For Custom Values In The Order Comment, Defval = Na
โโReturns: Void
OpenShort(EntryID, LotSize, LimitPrice, StopPrice, Comment, CommentValue)
โโOpen A Short Order Based On The Given Params
โโParameters:
โโโโ EntryID (string) : Is The Trade Entry ID, Defval = "Short"
โโโโ LotSize (float) : Is The Lot Size Of The Trade, Defval = 1
โโโโ LimitPrice (float) : Is The Limit Order Price To Set The Order At, Defval = Na / Market Order Execution
โโโโ StopPrice (float) : Is The Stop Order Price To Set The Order At, Defval = Na / Market Order Execution
โโโโ Comment (string) : Is The Order Comment, Defval = Short Entry Order
โโโโ CommentValue (string) : Is For Custom Values In The Order Comment, Defval = Na
โโReturns: Void
TP_SLExit(FromID, TPLevel, SLLevel, PercentageClose, Comment, CommentValue)
โโExits Based On Predetermined TP & SL Levels
โโParameters:
โโโโ FromID (string) : Is The Trade ID That The TP & SL Levels Be Palced
โโโโ TPLevel (float) : Is The Take Profit Level
โโโโ SLLevel (float) : Is The StopLoss Level
โโโโ PercentageClose (float) : Is The Amount To Close The Order At (In Percentage) Defval = 100
โโโโ Comment (string) : Is The Order Comment, Defval = Exit Order
โโโโ CommentValue (string) : Is For Custom Values In The Order Comment, Defval = Na
โโReturns: Void
CloseLong(ExitID, PercentageClose, Comment, CommentValue, Instant)
โโExits A Long Order Based On A Specified Condition
โโParameters:
โโโโ ExitID (string) : Is The Trade ID That Will Be Closed, Defval = "Long"
โโโโ PercentageClose (float) : Is The Amount To Close The Order At (In Percentage) Defval = 100
โโโโ Comment (string) : Is The Order Comment, Defval = Exit Order
โโโโ CommentValue (string) : Is For Custom Values In The Order Comment, Defval = Na
โโโโ Instant (bool) : Is For Exit Execution Type, Defval = false
โโReturns: Void
CloseShort(ExitID, PercentageClose, Comment, CommentValue, Instant)
โโExits A Short Order Based On A Specified Condition
โโParameters:
โโโโ ExitID (string) : Is The Trade ID That Will Be Closed, Defval = "Short"
โโโโ PercentageClose (float) : Is The Amount To Close The Order At (In Percentage) Defval = 100
โโโโ Comment (string) : Is The Order Comment, Defval = Exit Order
โโโโ CommentValue (string) : Is For Custom Values In The Order Comment, Defval = Na
โโโโ Instant (bool) : Is For Exit Execution Type, Defval = false
โโReturns: Void
BrokerCheck(Broker)
โโChecks Traded Broker With Current Loaded Chart Broker
โโParameters:
โโโโ Broker (string) : Is The Current Broker That Is Traded
โโReturns: Bool - True If Current Traded Broker Is Same As Loaded Chart Broker
OpenPC(LicenseID, OrderType, UseLimit, LimitPrice, SymbolPrefix, Symbol, SymbolSuffix, Risk, SL, TP, OrderComment, Spread)
โโCompiles Given Parameters Into An Alert String Format To Open Trades Using Pine Connector
โโParameters:
โโโโ LicenseID (string) : Is The Users PineConnector LicenseID
โโโโ OrderType (int) : Is The Desired OrderType To Open
โโโโ UseLimit (bool) : Is If We Want To Enter The Position At Exactly The Previous Closing Price
โโโโ LimitPrice (float) : Is The Limit Price Of The Trade (Only For Pending Orders)
โโโโ SymbolPrefix (string) : Is The Current Symbol Prefix (If Any)
โโโโ Symbol (string) : Is The Traded Symbol
โโโโ SymbolSuffix (string) : Is The Current Symbol Suffix (If Any)
โโโโ Risk (float) : Is The Trade Risk Per Trade / Fixed Lot Sizing
โโโโ SL (float) : Is The Trade SL In Price / In Pips
โโโโ TP (float) : Is The Trade TP In Price / In Pips
โโโโ OrderComment (string) : Is The Executed Trade Comment
โโโโ Spread (float) : is The Maximum Spread For Execution
โโReturns: String - Pine Connector Order Syntax Alert Message
ClosePC(LicenseID, OrderType, SymbolPrefix, Symbol, SymbolSuffix)
โโCompiles Given Parameters Into An Alert String Format To Close Trades Using Pine Connector
โโParameters:
โโโโ LicenseID (string) : Is The Users PineConnector LicenseID
โโโโ OrderType (int) : Is The Desired OrderType To Close
โโโโ SymbolPrefix (string) : Is The Current Symbol Prefix (If Any)
โโโโ Symbol (string) : Is The Traded Symbol
โโโโ SymbolSuffix (string) : Is The Current Symbol Suffix (If Any)
โโReturns: String - Pine Connector Order Syntax Alert Message
//====================================================================================================================================================
// Custom Backtesting Calculation Functions
//====================================================================================================================================================
CalculatePNL(EntryPrice, ExitPrice, LotSize, ConversionRate)
โโCalculates Trade PNL Based On Entry, Eixt & Lot Size
โโParameters:
โโโโ EntryPrice (float) : Is The Trade Entry
โโโโ ExitPrice (float) : Is The Trade Exit
โโโโ LotSize (float) : Is The Trade Sizing
โโโโ ConversionRate (float) : Is The Currency Conversion Rate (Used For Complex Lot Sizing Only)
โโReturns: Float - The Current Trade PNL
UpdateBalance(PrevBalance, PNL)
โโUpdates The Previous Ginve Balance To The Next PNL
โโParameters:
โโโโ PrevBalance (float) : Is The Previous Balance To Be Updated
โโโโ PNL (float) : Is The Current Trade PNL To Be Added
โโReturns: Float - The Current Updated PNL
CalculateSlpComm(PNL, MaxRate)
โโCalculates Random Slippage & Commisions Fees Based On The Parameters
โโParameters:
โโโโ PNL (float) : Is The Current Trade PNL
โโโโ MaxRate (float) : Is The Upper Limit (In Percentage) Of The Randomized Fee
โโReturns: Float - A Percentage Fee Of The Current Trade PNL
UpdateDD(MaxBalance, Balance)
โโCalculates & Updates The DD Based On Its Given Parameters
โโParameters:
โโโโ MaxBalance (float) : Is The Maximum Balance Ever Recorded
โโโโ Balance (float) : Is The Current Account Balance
โโReturns: Float - The Current Strategy DD
CalculateWR(TotalTrades, LongID, ShortID)
โโCalculate The Total, Long & Short Trades Win Rate
โโParameters:
โโโโ TotalTrades (int) : Are The Current Total Trades That The Strategy Has Taken
โโโโ LongID (string) : Is The Order ID Of The Long Trades Of The Strategy
โโโโ ShortID (string) : Is The Order ID Of The Short Trades Of The Strategy
โโReturns: Tuple Of Long WR%, Short WR%, Total WR%, Total Winning Trades, Total Losing Trades, Total Long Trades & Total Short Trades
CalculateAvgRRR(WinTrades, LossTrades)
โโCalculates The Overall Strategy Avg Risk Reward Ratio
โโParameters:
โโโโ WinTrades (int) : Are The Strategy Winning Trades
โโโโ LossTrades (int) : Are The Strategy Losing Trades
โโReturns: Float - The Average RRR Values
CAGR(StartTime, StartPrice, EndTime, EndPrice)
โโCalculates The CAGR Over The Given Time Period ยฉ TradingView
โโParameters:
โโโโ StartTime (int) : Is The Starting Time Of The Calculation
โโโโ StartPrice (float) : Is The Starting Price Of The Calculation
โโโโ EndTime (int) : Is The Ending Time Of The Calculation
โโโโ EndPrice (float) : Is The Ending Price Of The Calculation
โโReturns: Float - The CAGR Values
//====================================================================================================================================================
// Custom Plot Functions
//====================================================================================================================================================
EditLabels(LabelID, X1, Y1, Text, Color, TextColor, EditCondition, DeleteCondition)
โโEdit / Delete Labels
โโParameters:
โโโโ LabelID (label) : Is The ID Of The Selected Label
โโโโ X1 (int) : Is The X1 Coordinate IN BARINDEX Xloc
โโโโ Y1 (float) : Is The Y1 Coordinate IN PRICE Yloc
โโโโ Text (string) : Is The Text Than Wants To Be Written In The Label
โโโโ Color (color) : Is The Color Value Change Of The Label Text
โโโโ TextColor (color)
โโโโ EditCondition (int) : Is The Edit Condition of The Line (Setting Location / Color)
โโโโ DeleteCondition (bool) : Is The Delete Condition Of The Line If Ture Deletes The Prev Itteration Of The Line
โโReturns: Void
EditLine(LineID, X1, Y1, X2, Y2, Color, EditCondition, DeleteCondition)
โโEdit / Delete Lines
โโParameters:
โโโโ LineID (line) : Is The ID Of The Selected Line
โโโโ X1 (int) : Is The X1 Coordinate IN BARINDEX Xloc
โโโโ Y1 (float) : Is The Y1 Coordinate IN PRICE Yloc
โโโโ X2 (int) : Is The X2 Coordinate IN BARINDEX Xloc
โโโโ Y2 (float) : Is The Y2 Coordinate IN PRICE Yloc
โโโโ Color (color) : Is The Color Value Change Of The Line
โโโโ EditCondition (int) : Is The Edit Condition of The Line (Setting Location / Color)
โโโโ DeleteCondition (bool) : Is The Delete Condition Of The Line If Ture Deletes The Prev Itteration Of The Line
โโReturns: Void
//====================================================================================================================================================
// Custom Display Functions (Using Tables)
//====================================================================================================================================================
FillTable(TableID, Column, Row, Title, Value, BgColor, TextColor, ToolTip)
โโFilling The Selected Table With The Inputed Information
โโParameters:
โโโโ TableID (table) : Is The Table ID That Wants To Be Edited
โโโโ Column (int) : Is The Current Column Of The Table That Wants To Be Edited
โโโโ Row (int) : Is The Current Row Of The Table That Wants To Be Edited
โโโโ Title (string) : Is The String Title Of The Current Cell Table
โโโโ Value (string) : Is The String Value Of The Current Cell Table
โโโโ BgColor (color) : Is The Selected Color For The Current Table
โโโโ TextColor (color) : Is The Selected Color For The Current Table
โโโโ ToolTip (string) : Is The ToolTip Of The Current Cell In The Table
โโReturns: Void
DisplayBTResults(TableID, BgColor, TextColor, StartingBalance, Balance, DollarReturn, TotalPips, MaxDD)
โโFilling The Selected Table With The Inputed Information
โโParameters:
โโโโ TableID (table) : Is The Table ID That Wants To Be Edited
โโโโ BgColor (color) : Is The Selected Color For The Current Table
โโโโ TextColor (color) : Is The Selected Color For The Current Table
โโโโ StartingBalance (float) : Is The Account Starting Balance
โโโโ Balance (float)
โโโโ DollarReturn (float) : Is The Account Dollar Reture
โโโโ TotalPips (float) : Is The Total Pips Gained / loss
โโโโ MaxDD (float) : Is The Maximum Drawdown Over The Backtesting Period
โโReturns: Void
DisplayBTResultsV2(TableID, BgColor, TextColor, TotalWR, QTCount, LongWR, ShortWR, InitialCapital, CumProfit, CumFee, AvgRRR, MaxDD, CAGR, MeanDD)
โโFilling The Selected Table With The Inputed Information
โโParameters:
โโโโ TableID (table) : Is The Table ID That Wants To Be Edited
โโโโ BgColor (color) : Is The Selected Color For The Current Table
โโโโ TextColor (color) : Is The Selected Color For The Current Table
โโโโ TotalWR (float) : Is The Strategy Total WR In %
โโโโ QTCount (int) : Is The Strategy Questionable Trades Count
โโโโ LongWR (float) : Is The Strategy Total WR In %
โโโโ ShortWR (float) : Is The Strategy Total WR In %
โโโโ InitialCapital (float) : Is The Strategy Initial Starting Capital
โโโโ CumProfit (float) : Is The Strategy Ending Cumulative Profit
โโโโ CumFee (float) : Is The Strategy Ending Cumulative Fee (Based On Randomized Fee Assumptions)
โโโโ AvgRRR (float) : Is The Strategy Average Risk Reward Ratio
โโโโ MaxDD (float) : Is The Strategy Maximum DrawDown In Its Backtesting Period
โโโโ CAGR (float) : Is The Strategy Compounded Average GRowth In %
โโโโ MeanDD (float) : Is The Strategy Mean / Average Drawdown In The Backtesting Period
โโReturns: Void
//====================================================================================================================================================
// Custom Pattern Detection Functions
//====================================================================================================================================================
BullFib(priceLow, priceHigh, fibRatio)
โโCalculates A Bullish Fibonacci Value (From Swing Low To High) ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ priceLow (float)
โโโโ priceHigh (float)
โโโโ fibRatio (float)
โโReturns: The Fibonacci Value Of The Given Ratio Between The Two Price Points
BearFib(priceLow, priceHigh, fibRatio)
โโCalculates A Bearish Fibonacci Value (From Swing High To Low) ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ priceLow (float)
โโโโ priceHigh (float)
โโโโ fibRatio (float)
โโReturns: The Fibonacci Value Of The Given Ratio Between The Two Price Points
GetBodySize()
โโGets The Current Candle Body Size IN POINTS ยฉ ZenAndTheArtOfTrading
โโReturns: The Current Candle Body Size IN POINTS
GetTopWickSize()
โโGets The Current Candle Top Wick Size IN POINTS ยฉ ZenAndTheArtOfTrading
โโReturns: The Current Candle Top Wick Size IN POINTS
GetBottomWickSize()
โโGets The Current Candle Bottom Wick Size IN POINTS ยฉ ZenAndTheArtOfTrading
โโReturns: The Current Candle Bottom Wick Size IN POINTS
GetBodyPercent()
โโGets The Current Candle Body Size As A Percentage Of Its Entire Size Including Its Wicks ยฉ ZenAndTheArtOfTrading
โโReturns: The Current Candle Body Size IN PERCENTAGE
GetTopWickPercent()
โโGets The Current Top Wick Size As A Percentage Of Its Entire Body Size
โโReturns: Float - The Current Candle Top Wick Size IN PERCENTAGE
GetBottomWickPercent()
โโGets The Current Bottom Wick Size As A Percentage Of Its Entire Bodu Size
โโReturns: Float - The Current Candle Bottom Size IN PERCENTAGE
BullishEC(Allowance, RejectionWickSize, EngulfWick, NearSwings, SwingLookBack)
โโChecks If The Current Bar Is A Bullish Engulfing Candle
โโParameters:
โโโโ Allowance (int) : To Give Flexibility Of Engulfing Pattern Detection In Markets That Have Micro Gaps, Defval = 0
โโโโ RejectionWickSize (float) : To Filter Out long (Upper And Lower) Wick From The Bullsih Engulfing Pattern, Defval = na
โโโโ EngulfWick (bool) : To Specify If We Want The Pattern To Also Engulf Its Upper & Lower Previous Wicks, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Pattern To Be Near A Recent Swing Low, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing Low, Defval = 10
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Bullish Engulfing Candle
BearishEC(Allowance, RejectionWickSize, EngulfWick, NearSwings, SwingLookBack)
โโChecks If The Current Bar Is A Bearish Engulfing Candle
โโParameters:
โโโโ Allowance (int) : To Give Flexibility Of Engulfing Pattern Detection In Markets That Have Micro Gaps, Defval = 0
โโโโ RejectionWickSize (float) : To Filter Out long (Upper And Lower) Wick From The Bearish Engulfing Pattern, Defval = na
โโโโ EngulfWick (bool) : To Specify If We Want The Pattern To Also Engulf Its Upper & Lower Previous Wicks, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Pattern To Be Near A Recent Swing High, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing High, Defval = 10
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Bearish Engulfing Candle
Hammer(Fib, ColorMatch, NearSwings, SwingLookBack, ATRFilterCheck, ATRPeriod)
โโChecks If The Current Bar Is A Hammer Candle
โโParameters:
โโโโ Fib (float) : To Specify Which Fibonacci Ratio To Use When Determining The Hammer Candle, Defval = 0.382 Ratio
โโโโ ColorMatch (bool) : To Filter Only Bullish Closed Hammer Candle Pattern, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Doji To Be Near A Recent Swing Low, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing Low, Defval = 10
โโโโ ATRFilterCheck (float) : To Filter Smaller Hammer Candles That Might Be Better Classified As A Doji Candle, Defval = 1
โโโโ ATRPeriod (simple int) : To Change ATR Period Of The ATR Filter, Defval = 20
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Hammer Candle
Star(Fib, ColorMatch, NearSwings, SwingLookBack, ATRFilterCheck, ATRPeriod)
โโChecks If The Current Bar Is A Hammer Candle
โโParameters:
โโโโ Fib (float) : To Specify Which Fibonacci Ratio To Use When Determining The Hammer Candle, Defval = 0.382 Ratio
โโโโ ColorMatch (bool) : To Filter Only Bullish Closed Hammer Candle Pattern, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Doji To Be Near A Recent Swing Low, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing Low, Defval = 10
โโโโ ATRFilterCheck (float) : To Filter Smaller Hammer Candles That Might Be Better Classified As A Doji Candle, Defval = 1
โโโโ ATRPeriod (simple int) : To Change ATR Period Of The ATR Filter, Defval = 20
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Hammer Candle
Doji(MaxWickSize, MaxBodySize, DojiType, NearSwings, SwingLookBack)
โโChecks If The Current Bar Is A Doji Candle
โโParameters:
โโโโ MaxWickSize (float) : To Specify The Maximum Lenght Of Its Upper & Lower Wick, Defval = 2
โโโโ MaxBodySize (float) : To Specify The Maximum Lenght Of Its Candle Body IN PERCENT, Defval = 0.05
โโโโ DojiType (int)
โโโโ NearSwings (bool) : To Specify If We Want The Doji To Be Near A Recent Swing High / Low (Only In Dragonlyf / Gravestone Mode), Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing High / Low (Only In Dragonlyf / Gravestone Mode), Defval = 10
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Doji Candle
BullishIB(Allowance, RejectionWickSize, EngulfWick, NearSwings, SwingLookBack)
โโChecks If The Current Bar Is A Bullish Harami Candle
โโParameters:
โโโโ Allowance (int) : To Give Flexibility Of Harami Pattern Detection In Markets That Have Micro Gaps, Defval = 0
โโโโ RejectionWickSize (float) : To Filter Out long (Upper And Lower) Wick From The Bullsih Harami Pattern, Defval = na
โโโโ EngulfWick (bool) : To Specify If We Want The Pattern To Also Engulf Its Upper & Lower Previous Wicks, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Pattern To Be Near A Recent Swing Low, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing Low, Defval = 10
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Bullish Harami Candle
BearishIB(Allowance, RejectionWickSize, EngulfWick, NearSwings, SwingLookBack)
โโChecks If The Current Bar Is A Bullish Harami Candle
โโParameters:
โโโโ Allowance (int) : To Give Flexibility Of Harami Pattern Detection In Markets That Have Micro Gaps, Defval = 0
โโโโ RejectionWickSize (float) : To Filter Out long (Upper And Lower) Wick From The Bearish Harami Pattern, Defval = na
โโโโ EngulfWick (bool) : To Specify If We Want The Pattern To Also Engulf Its Upper & Lower Previous Wicks, Defval = false
โโโโ NearSwings (bool) : To Specify If We Want The Pattern To Be Near A Recent Swing High, Defval = true
โโโโ SwingLookBack (int) : To Specify How Many Bars Back To Detect A Recent Swing High, Defval = 10
โโReturns: Bool - True If The Current Bar Matches The Requirements of a Bearish Harami Candle
//====================================================================================================================================================
// Custom Time Functions
//====================================================================================================================================================
BarInSession(sess, useFilter)
โโDetermines if the current price bar falls inside the specified session ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ sess (simple string)
โโโโ useFilter (bool)
โโReturns: A boolean - true if the current bar falls within the given time session
BarOutSession(sess, useFilter)
โโDetermines if the current price bar falls outside the specified session ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ sess (simple string)
โโโโ useFilter (bool)
โโReturns: A boolean - true if the current bar falls outside the given time session
DateFilter(startTime, endTime)
โโDetermines if this bar's time falls within date filter range ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ startTime (int)
โโโโ endTime (int)
โโReturns: A boolean - true if the current bar falls within the given dates
DayFilter(monday, tuesday, wednesday, thursday, friday, saturday, sunday)
โโChecks if the current bar's day is in the list of given days to analyze ยฉ ZenAndTheArtOfTrading
โโParameters:
โโโโ monday (bool)
โโโโ tuesday (bool)
โโโโ wednesday (bool)
โโโโ thursday (bool)
โโโโ friday (bool)
โโโโ saturday (bool)
โโโโ sunday (bool)
โโReturns: A boolean - true if the current bar's day is one of the given days
AUSSess()
โโChecks If The Current Australian Forex Session In Running
โโReturns: Bool - True If Currently The Australian Session Is Running
ASIASess()
โโChecks If The Current Asian Forex Session In Running
โโReturns: Bool - True If Currently The Asian Session Is Running
EURSess()
โโChecks If The Current European Forex Session In Running
โโReturns: Bool - True If Currently The European Session Is Running
USSess()
โโChecks If The Current US Forex Session In Running
โโReturns: Bool - True If Currently The US Session Is Running
UNIXToDate(Time, ConversionType, TimeZone)
โโConverts UNIX Time To Datetime
โโParameters:
โโโโ Time (int) : Is The UNIX Time Input
โโโโ ConversionType (int) : Is The Datetime Output Format, Defval = DD-MM-YYYY
โโโโ TimeZone (string) : Is To Convert The Outputed Datetime Into The Specified Time Zone, Defval = Exchange Time Zone
โโReturns: String - String Of Datetime
Optimized Zhaocaijinbao strategyIntroduction:
The Optimized Zhaocaijinbao strategy is a mid and long-term quantitative trading strategy that combines momentum and trend factors. It generates buy and sell signals by using a combination of exponential moving averages, moving averages, volume and slope indicators. It generates buy signals when the stock is above the 35-day moving average, the trading volume is higher than the 20-day moving average, and the stock is in an upward trend on a weekly timeframe."ๆ่ดข่ฟๅฎ" is a Chinese phrase that can be translated to "Attract Wealth and Bring in Treasure" in English. It is a common expression used to wish for good luck and prosperity in various contexts, such as in business or personal finances.
Highlights:
The strategy has several special optimizations that make it unique.
Firstly, the strategy is optimized for T+1 trading in the Chinese stock market and is only suitable for long positions. The optimizations are also applicable to international stock markets.
Secondly, the trend strategy is optimized to only show indicators on the right side and oscillations. This helps to prevent false signals in choppy markets.
Thirdly, the strategy uses a risk factor for dynamic position sizing to ensure position sizes are adjusted according to the current net asset value and risk preferences. This helps to lower drawdown risks.
The strategy has good resilience even without using stop loss modules in backtesting, making it suitable for trading hourly, 2-hourly, and daily K-line charts (depending on the stock being traded). We recommend experimenting with backtesting using SSE 1-hour or 2-hour or daily Kline charts.
Backtesting outcomes:
The strategy was backtested over the period from October 13th, 2005 to April 14th, 2023, using daily candlestick charts for the commodity code SSE:600763, with a currency of CNY and tick size of 0.01. The strategy used an initial capital of 1,000,000 CNY, with order sizes set to 10% equity and a pyramid of 1 order. The strategy also had a Max Position Size of 0.01 and a Risk Factor of 2.
Here is a summary of the performance of the trading strategy:
Total net profit: 288,577.32 CNY, representing a return of 128.86%
Total number of closed trades: 61
Winning trades: 37, representing a win rate of 60.66%
Profit factor: 2.415
Largest losing trade: 222,021.46 CNY, representing a loss of 14.08%
Average trade: 21,124.22 CNY, representing a return of 3.1%
Average holding period for all trades: 12 days
Conclusion:
In conclusion, the Optimized Zhaocaijinbao strategy is a mid and long-term quantitative trading strategy that combines momentum and trend factors. It is suitable for both Chinese stocks and global stocks. While the Optimized Zhaocaijinbao strategy has performed well in backtesting, it is important to note that past performance is not a guarantee of future results. Traders should conduct their own research and analysis and exercise caution when using any trading strategy.
Heikin Ashi Candle Startegy for Long PositionThis strategy utilize Heikin-Ashi candlestick chart.
Heikin-Ashi technique is a Japanese candlestick-based technical trading tool that uses candlestick charts to represent and visualize market price data.
Heikin-Ashi candle is essentially taking an average of the movement.
There is a tendency with Heikin-Ashi for the candles to stay red during a downtrend and green during an uptrend.
This strategy only apply for long trading position.
The idea is trader will waiting 3 green candles for validation period (confirmation) before entering long position.
Different timeframe will result different result.
Number of validation period can be changed to see different result
This strategy has parameter for take profit percentage, trailing stop and stop loss.
User can set maximum active position to minimize risk and qty order.
This tool is useful for user who wants to backtest Heikin-Ashi trading strategy.
Script will emit alert when long position is opened and closed.
Warning of Backtesting
Backtesting is backward-looking. As the name implies, you are testing how something would have worked if you traded it perfectly in the past.
Past performance does not indicate future performance and you should not assume it does.
Backtesting assumes you never miss-fire, that you get in and out at the exactly perfect moment each time.
Backtesting assumes you have perfect liquidity, and your limit orders fill at a specific, pre-defined price every time (either the open, close, low, high, or some average of these).
Disclaimer
Do your own research and consider fundamental price of asset.
The indicators provided on this script is for educational purposes only.
Author does not offer advisory or brokerage services, nor does it recommend or advise users to buy or sell particular stocks or securities.
Please examined script and give feedback for further improvement.
Script are open to public, everyone see and clone source code or just apply to chart. Please make comment for improvement.
Patient Trendfollower (7)(alpha)Patient Trendfollower consists of 21 and 55 EMA, Commodity Channel Index and Supertrend indicator. It confirms a trend and gives you a signal on a pullback. Original creation worked on 1h EURUSD chart.
โบLong setup:
โข 21 EMA is above 55 EMA, which is above the Supertrend indicator.
โข Commodity Channel Index is an oscillator, which prints into the chart if extreme levels are reached. Green is for a level above 100 or below -100, red is above 140 or below -140 and black is above 180 or below -180.
โข If 21 EMA > 55EMA > Supertrend and an oversold signal appear, you can buy into the trend.
โข When backtesting on 1h EURUSD, profit target 400 pips worked best with a stop-loss below Supertrend's bottom and the size of your spread.
โข A picture shows two valid entries.
: This part still malfunctions and shows red dots over some green ones. It is important to disable red ones in the settings to see green ones.
Some more long signals:
Some short signals:
โบBacktesting data with default settings and trading only green CCI signals with mentioned risk management strategy:
โข 212 closed trades
โข 58.96% profitable with average win trade 348 USD and average loss trade 263 USD when only green signals are followed.
โข Profit factor 1.903, Sharpee 0.792
โข 20 bars is average for all trades, short trades were 18 bars long on average.
With given data, you can see the strategy is profitable by itself. However, original risk management settings do work only on 1h charts of EURUSD and would need to be adjusted for other instruments based on average volatility.
Even though the profitability is low, you can increase your odds by a great margin, if you properly use price action (impulsive and corrective moves, patterns, bar analysis), if you trade when major exchanges are open, you may also use wave analysis such as Elliot Waves or Market Profiles to predict whether the next day might be a trending day. My backtesting program didn't consider these ideas.
Unfortunately, I won't be making backtesting strategy public with it anytime soon, because it still has some parts that do not work. I am ok with that since I understand the code and know what does malfunction and how. Then, there are parts which I am not sure how to fix yet. This is why the indicator is still considered alpha.
In the future when a strategy is published, you will also be able to set your own overbought/oversold values without entering the code itself and probably some other features. But I am not in a hurry for that. You can give me feedback on UX and try to figure out the best setups for other symbols, it might help to improve the automatic testing script when I know what I should achieve. My main point is to make this public for friends who can already be using it on EURUSD at least.
Close doesn't always have to be 400 pips, you might want to close on a logical level such as strong resistance or a trendline too.
Thanks to:
โข @everget for providing Supertrend solution.
โข Satik FX who hand-tested the system by hand and reported results in this article . He is my main inspiration for creating the complete indicator as one because I want to be able to show and hide it with a single click. My future scripts will also work as a whole strategy each by itself.
โข The number in the script's name comes from Satik's numbering. A mentioned article was his seventh shared strategy.
HatiKO EnvelopesPublished source code is subject to the terms of the GNU Affero General Public License v3.0
This script describes and provides backtesting functionality to internal strategy of algorithmic crypto trading software "HatiKO bot".
Suitable for backtesting any Cryptocurrency Pair on any Exchange/Platform, any Timeframe.
Core Mechanics of this strategy are based on theory of price always returning to Moving Average + Envelopes indicator (Moving_average_envelope from Wiki)
Developement of this script and trading software is inspired by:
"Essential Technical Analysis: Tools and Techniques to Spot Market Trends" by Leigh Stevens (published on 12th of April 2002)
"Moving Average Envelopes" by ChartSchool, StockCharts platform (published on 13th of April 2015 or earlier)
"ะะพะปั ะะพะปะตัะฝัะบ" from Crypto Times channel ("ะะตัะพะด ัะตัะบะฐ", published on 19th of August 2018)
"3 ways to use Moving Average Envelopes" by Rich Fitton, published on Trader's Nest (published on 28st of November 2018 or earlier)
noro's "Robot WhiteBox ShiftMA" strategy v1 script, published on TradingView platform (published on 29th of August 2018)
"Moving Average Envelopes: A Popular Trading Tool" Investopedia article (published 25th of June 2019)
and KROOL1980's blogpost on Argolabs ("ะัะธะดะตัััะฒะพ ะธะปะธ ะกะตัะบะฐ ะบะฐะบ ะธััะพัะฝะธะบ ะฟัะธะฑัะปะธ ะฝะฐ ัะพัะตะบั", published on 27th of February 2015)
Core Features:
1) Up to 4 Envelopes in each direction (Long/Short)
2) Use any of 6 different basis MAs, optionally use different MAs for Opening and Closure
3) Use different Timeframes for MA calculation, without any repainting and lookahead bias.
4) Fixed order size, not Martingale strategy
5) Close open position earlier by using Deviation parameter
6) PineScript v4 code
Options description:
Lot - % from your initial balance to use for order size calculation
Timeframe Short - Timeframe to use for Short Opening MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Short - Type of MA to use for Short Opening MA calculation, can be chosen from dropdown list, default is SMA
Data Short - Source of Price for Short Opening MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Short - Period used for Short Opening MA calculation, should be >=1, default is 3
MA offset Short - Offset for MA value used for Short Envelopes calculation, should be >= 0, default is 0
Timeframe Long - Timeframe to use for Long Opening MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Long - Type of MA to use for Long Opening MA calculation, can be chosen from dropdown list, default is SMA
Data Long - Source of Price for Long Opening MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Long - Period used for Long Opening MA calculation, should be >=1, default is 3
MA offset Long - Offset for MA value used for Long Envelopes calculation, should be >= 0, default is 0
Mode close MA Short - Enable different MA for Short position Closure, default is "false". If false, Closure MA = Opening MA
Timeframe Short Close - Timeframe to use for Short Position Closure MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Close Short - Type of MA to use for Short Position Closure MA calculation, can be chosen from dropdown list, default is SMA
Data Short Close - Source of Price for Short Closure MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Short Close - Period used for Short Opening MA calculation, should be >=1, default is 3
Short Deviation - % to move from MA value, used to close position above or beyond MA, can be negative, default is 0
MA offset Short Close - Offset for MA value used for Short Position Closure calculation, should be >= 0, default is 0
Mode close MA Long - Enable different MA for Long position Closure, default is "false". If false, Closure MA = Opening MA
Timeframe Long Close - Timeframe to use for Long Position Closure MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Close Long - Type of MA to use for Long Position Closure MA calculation, can be chosen from dropdown list, default is SMA
Data Long Close - Source of Price for Long Closure MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Long Close - Period used for Long Opening MA calculation, should be >=1, default is 3
Long Deviation - % to move from MA value, used to close position above or beyond MA, can be negative, default is 0
MA offset Long Close - Offset for MA value used for Long Position Closure calculation, should be >= 0, default is 0
Short Shift 1..4 - % from MA value to put Envelopes at, for Shorts numbers should be positive, the higher is number, the higher should be Shift position, example: "Shift 1 = 1, shift 2 = 2, etc."
Long Shift 1..4 - % from MA value to put Envelopes at, for Longs numbers should be negative, the lower is number, the lower should be Shift position, example: "Shift 1 = -1, shift 2 = -2, etc."
From Year 20XX - Backtesting Starting Year number, only 20xx supported as script is cryptocurrency-oriented.
To Year 20XX - Backtesting Final Year number, only 20xx supported as script is cryptocurrency-oriented.
From Month - Years starting Month, optional tweaking, changing not recommended
To Month - Years ending Month, optional tweaking, changing not recommended
From day - Months starting day, optional tweaking, changing not recommended
To day - Months ending day, optional tweaking, changing not recommended
Graph notes:
Green lines - Long Envelopes.
Red lines - Short Envelopes.
Orange line - MA for closing of Short positions.
Lime line - MA for closing of Long positions.
**************************************************************************************************************************************************************************************************************
ะะฟัะฑะปะธะบะพะฒะฐะฝะฝัะน ะธัั
ะพะดะฝัะน ะบะพะด ัะตะณัะปะธััะตััั ะฃัะปะพะฒะธัะผะธ ะกัะฐะฝะดะฐััะฝะพะน ะะฑัะตััะฒะตะฝะฝะพะน ะะธัะตะฝะทะธะธ GNU Affero v3.0
ะญัะพั ัะบัะธะฟั ะพะฟะธััะฒะฐะตั ะธ ะฟัะตะดะพััะฐะฒะปัะตั ััะฝะบัะธะธ ะฑะตะบัะตััะฐ ะดะปั ะฒะฝัััะตะฝะฝะตะน ัััะฐัะตะณะธะธ ะฐะปะณะพัะธัะผะธัะตัะบะพะณะพ ะฟัะพะณัะฐะผะผะฝะพะณะพ ะพะฑะตัะฟะตัะตะฝะธั "HatiKO bot".
ะะพะดั
ะพะดะธั ะดะปั ัะตััะธัะพะฒะฐะฝะธั ะปัะฑะพะน ะบัะธะฟัะพะฒะฐะปััะฝะพะน ะฟะฐัั ะฝะฐ ะปัะฑะพะน ะฑะธัะถะต/ะฟะปะฐััะพัะผะต, ะฝะฐ ะปัะฑะพะผ ัะฐะนะผััะตะนะผะต.
ะะพั-ะผะตั
ะฐะฝะธะบะฐ ััะพะน ัััะฐัะตะณะธะธ ะพัะฝะพะฒะฐะฝะฐ ะฝะฐ ัะตะพัะธะธ ะฒัะตะณะดะฐ ะฒะพะทะฒัะฐัะฐััะตะนัั ะบ ะทะฝะฐัะตะฝะธั ะะ ัะตะฝั ั ะธัะฟะพะปัะทะพะฒะฐะฝะธะตะผ ะธะฝะดะธะบะฐัะพัะฐ Envelopes (Moving_average_envelope from Wiki)
ะ ะฐะทัะฐะฑะพัะบะฐ ััะพะณะพ ัะบัะธะฟัะฐ ะธ ะฟัะพะณัะฐะผะผะฝะพะณะพ ะพะฑะตัะฟะตัะตะฝะธั ะดะปั ัะพัะณะพะฒะปะธ ะฒะดะพั
ะฝะพะฒะปะตะฝะฐ ัะปะตะดัััะธะผะธ ะธััะพัะฝะธะบะฐะผะธ:
ะะฝะธะณะฐ "Essential Technical Analysis: Tools and Techniques to Spot Market Trends" ะะธ ะกัะธะฒะตะฝัะฐ (ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 12 ะฐะฟัะตะปั 2002 ะณะพะดะฐ)
ยซMoving Average Envelopesยป ะพั ChartSchool, ะฟะปะฐััะพัะผะฐ StockCharts (ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 13 ะฐะฟัะตะปั 2015 ะณะพะดะฐ ะธะปะธ ัะฐะฝััะต)
ยซะะพะปั ะะพะปะตัะฝัะบยป ั ะบะฐะฝะฐะปะฐ Crypto Times (ยซะะตัะพะด ัะตัะบะฐยป, ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 19 ะฐะฒะณัััะฐ 2018 ะณะพะดะฐ)
ยซ3 ways to use Moving Average Envelopesยป ะ ะธัะฐ ะคะธััะพะฝะฐ, ะพะฟัะฑะปะธะบะพะฒะฐะฝะฝัะต ะฒ ยซTrader's Nestยป (ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 28 ะฝะพัะฑัั 2018 ะณะพะดะฐ ะธะปะธ ัะฐะฝััะต)
ะกะบัะธะฟั ัััะฐัะตะณะธะธ noro "Robot WhiteBox ShiftMA" v1, ะพะฟัะฑะปะธะบะพะฒะฐะฝะฝัะน ะฝะฐ ะฟะปะฐััะพัะผะต TradingView(ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 29 ะฐะฒะณัััะฐ 2018 ะณะพะดะฐ)
ยซMoving Average Envelopes: A Popular Trading Toolยป, ััะฐััั Investopedia (ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 25 ะธัะฝั 2019 ะณะพะดะฐ)
ะะปะพะณ KROOL1980 ะธะท Argolabs (ยซะัะธะดะตัััะฒะพ ะธะปะธ ะกะตัะบะฐ ะบะฐะบ ะธััะพัะฝะธะบ ะฟัะธะฑัะปะธ ะฝะฐ ัะพัะตะบัยป, ะพะฟัะฑะปะธะบะพะฒะฐะฝะพ 27 ัะตะฒัะฐะปั 2015 ะณะพะดะฐ)
ะัะฝะพะฒะฝัะต ะพัะพะฑะตะฝะฝะพััะธ:
1) ะะพ 4-ั
ะัะดะตัะพะฒ ะฒ ะบะฐะถะดะพะผ ะธะท ะฝะฐะฟัะฐะฒะปะตะฝะธะธ (ะะพะฝะณ / ะจะพัั)
2) ะัะฑะพั ะธะท 6-ัะธ ัะฐะทะฝัั
ะฑะฐะทะพะฒัั
ะะ, ะพะฟัะธะพะฝะฐะปัะฝะพ ะธัะฟะพะปัะทัะนัะต ัะฐะทะฝัะต ะะ ะดะปั ะพัะบัััะธั ะธ ะทะฐะบัััะธั.
3) ะัะฟะพะปัะทัะนัะต ัะฐะทะฝัะต ัะฐะนะผััะตะนะผั ะดะปั ัะฐััะตัะฐ MA, ะฑะตะท ะฟะตัะตัะธัะพะฒะบะธ ะธ "ัััะตะบัะฐ ััะตะบะปัะฝะฝะพะณะพ ัะฐัะฐ".
4) ะคะธะบัะธัะพะฒะฐะฝะฝัะน ัะฐะทะผะตั ะพัะดะตัะฐ, ะฐ ะฝะต ัััะฐัะตะณะธั ะะฐััะธะฝะณะตะนะปะฐ
5) ะะพะทะผะพะถะฝะพััั ะทะฐะบัััะธั ะพัะบัััะพะน ะฟะพะทะธัะธะธ ะทะฐะฑะปะฐะณะพะฒัะตะผะตะฝะฝะพ, ะธัะฟะพะปัะทัั ะฟะฐัะฐะผะตัั Deviation
6) ะะพะด ัะตะฐะปะธะทะพะฒะฐะฝ ะฝะฐ PineScript v4
ะะฟะธัะฐะฝะธะต ะฟะฐัะฐะผะตััะพะฒ:
Lot - % ะพั ะฒะฐัะตะณะพ ะฟะตัะฒะพะฝะฐัะฐะปัะฝะพะณะพ ะฑะฐะปะฐะฝัะฐ, ะธัะฟะพะปัะทัะตััั ะฟัะธ ัะฐััะตัะต ัะฐะทะผะตัะฐ ะัะดะตัะฐ
Timeframe Short - ัะฐะนะผััะตะนะผ, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั - ัะฐะนะผััะตะนะผ ัะตะบััะตะณะพ ะณัะฐัะธะบะฐ
MA Type Short - ัะธะฟ MA, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั SMA
Data Short - ะธััะพัะฝะธะบ ัะตะฝั ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั OHLC4
MA Length Short - ะฟะตัะธะพะด, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะดะพะปะถะตะฝ ะฑััั >= 1, ะฟะพ ัะผะพะปัะฐะฝะธั 3
MA Offset Short - ัะผะตัะตะฝะธะต ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตะผะพะณะพ ะดะปั ัะฐััะตัะฐ ะจะพัั ะัะดะตัะพะฒ, ะดะพะปะถะฝะพ ะฑััั >= 0, ะฟะพ ัะผะพะปัะฐะฝะธั 0
Timeframe Long - ัะฐะนะผััะตะนะผ, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั - ัะฐะนะผััะตะนะผ ัะตะบััะตะณะพ ะณัะฐัะธะบะฐ
MA Type Long - ัะธะฟ MA, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั SMA
Data Long - ะธััะพัะฝะธะบ ัะตะฝั ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั OHLC4
MA Length Long - ะฟะตัะธะพะด, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะัะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะดะพะปะถะตะฝ ะฑััั >= 1, ะฟะพ ัะผะพะปัะฐะฝะธั 3
MA Offset Long - ัะผะตัะตะฝะธะต ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตะผะพะณะพ ะดะปั ัะฐััะตัะฐ ะะพะฝะณ ะัะดะตัะพะฒ, ะดะพะปะถะฝะพ ะฑััั >= 0, ะฟะพ ัะผะพะปัะฐะฝะธั 0
Mode close MA Short - ะะบะปััะฐะตั ะพัะดะตะปัะฝะพะต MA ะดะปั ะทะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะธ, ะฟะพ ัะผะพะปัะฐะฝะธั ยซfalseยป. ะัะปะธ false, MA ะะฐะบัััะธั = MA ะัะบัััะธั
Timeframe Short Close - ัะฐะนะผััะตะนะผ, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั - ัะฐะนะผััะตะนะผ ัะตะบััะตะณะพ ะณัะฐัะธะบะฐ
MA Type Close Short - ัะธะฟ MA, ะธัะฟะพะปัะทัะตะผัะน ะฟัะธ ัะฐััะตัะต ะะ ะะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะธ. Mะพะถะฝะพ ะฒัะฑัะฐัั ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั SMA
Data Short Close - ะธััะพัะฝะธะบ ัะตะฝั ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั OHLC4
MA Length Short Close - ะฟะตัะธะพะด, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะธ, ะดะพะปะถะตะฝ ะฑััั >= 1, ะฟะพ ัะผะพะปัะฐะฝะธั 3
Short Deviation - % ะพัะบะปะพะฝะตะฝะธั ะพั ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตััั ะดะปั ะทะฐะบัััะธั ะฟะพะทะธัะธะธ ะฒััะต ะธะปะธ ะฝะธะถะต ัะฐัััะธัะฐะฝะฝะพะณะพ ะทะฝะฐัะตะฝะธั MA, ะผะพะถะตั ะฑััั ะพััะธัะฐัะตะปัะฝัะผ, ะฟะพ ัะผะพะปัะฐะฝะธั 0
MA Offset Short Close - ัะผะตัะตะฝะธะต ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตะผะพะณะพ ะดะปั ัะฐััะตัะฐ ะทะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะธ, ะดะพะปะถะฝะพ ะฑััั >= 0, ะฟะพ ัะผะพะปัะฐะฝะธั 0
Mode close MA Long - ะะบะปััะฐะตั ัะฐะทะฝัะต MA ะดะปั ะทะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะธ, ะฟะพ ัะผะพะปัะฐะฝะธั ยซfalseยป. ะัะปะธ false, MA ะะฐะบัััะธั = MA ะัะบัััะธั
Timeframe Long Close - ัะฐะนะผััะตะนะผ, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั - ัะฐะนะผััะตะนะผ ัะตะบััะตะณะพ ะณัะฐัะธะบะฐ
MA Type Close Long - ัะธะฟ MA, ะธัะฟะพะปัะทัะตะผัะน ะฟัะธ ัะฐััะตัะต ะะ ะะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะธ. Mะพะถะฝะพ ะฒัะฑัะฐัั ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั SMA
Data Long Close - ะธััะพัะฝะธะบ ัะตะฝั ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน, ะผะพะถะตั ะฑััั ะฒัะฑัะฐะฝ ะธะท ัะฟะธัะบะฐ, ะฟะพ ัะผะพะปัะฐะฝะธั OHLC4
MA Length Long Close - ะฟะตัะธะพะด, ะธัะฟะพะปัะทัะตะผัะน ะดะปั ัะฐััะตัะฐ ะะ ะะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะธ, ะดะพะปะถะตะฝ ะฑััั >= 1, ะฟะพ ัะผะพะปัะฐะฝะธั 3
Long Deviation -% ะดะปั ะฟะตัะตั
ะพะดะฐ ะพั ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตััั ะดะปั ะทะฐะบัััะธั ะฟะพะทะธัะธะธ ะฒััะต ะธะปะธ ะฝะธะถะต ัะฐัััะธัะฐะฝะฝะพะณะพ ะทะฝะฐัะตะฝะธั MA, ะผะพะถะตั ะฑััั ะพััะธัะฐัะตะปัะฝัะผ, ะฟะพ ัะผะพะปัะฐะฝะธั 0
MA Offset Long Close - ัะผะตัะตะฝะธะต ะทะฝะฐัะตะฝะธั MA, ะธัะฟะพะปัะทัะตะผะพะณะพ ะดะปั ัะฐััะตัะฐ ะทะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะธ, ะดะพะปะถะฝะพ ะฑััั >= 0, ะฟะพ ัะผะพะปัะฐะฝะธั 0
Short Shift 1..4 - % ะพั ะทะฝะฐัะตะฝะธั MA ะดะปั ัะฐะทะผะตัะตะฝะธั ะัะดะตัะพะฒ, ะดะปั ะจะพัั ะัะดะตัะพะฒ ะดะพะปะถะตะฝ ะฑััั ะฟะพะปะพะถะธัะตะปัะฝัะผ, ัะตะผ ะฒััะต ะฝะพะผะตั, ัะตะผ ะฒััะต ะดะพะปะถะฝะฐ ัะฐัะฟะพะปะฐะณะฐัััั ะฟะพะทะธัะธั Shift, ะฝะฐะฟัะธะผะตั: ยซShift 1 = 1, Shift 2 = 2 ะธ ั.ะด. "
Long Shift 1..4 - % ะพั ะทะฝะฐัะตะฝะธั MA ะดะปั ัะฐะทะผะตัะตะฝะธั ะัะดะตัะพะฒ, ะดะปั ะะพะฝะณ ะัะดะตัะพะฒ ะดะพะปะถะฝะพ ะฑััั ะพััะธัะฐัะตะปัะฝัะผ, ัะตะผ ะฝะธะถะต ัะธัะปะพ, ัะตะผ ะฝะธะถะต ะดะพะปะถะฝะฐ ัะฐัะฟะพะปะฐะณะฐัััั ะฟะพะทะธัะธั Shift, ะฝะฐะฟัะธะผะตั: ยซShift 1 = -1, Shift 2 = -2, ะธ ั.ะด."
From Year 20XX - ะะพะด ะฝะฐัะฐะปะฐ ัะตััะธัะพะฒะฐะฝะธั, ะธะท-ะทะฐ ะพัะธะตะฝัะธัะพะฒะฐะฝะฝะพััะธ ะฝะฐ ะบัะธะฟัะพะฒะฐะปััั ะฟะพะดะดะตัะถะธะฒะฐัััั ัะพะปัะบะพ ะทะฝะฐัะตะฝะธั ัะพัะผะฐัะฐ 20ั
ั
.
To Year 20XX - ะะพะด ะพะบะพะฝัะฐะฝะธั ัะตััะธัะพะฒะฐะฝะธั, ะธะท-ะทะฐ ะพัะธะตะฝัะธัะพะฒะฐะฝะฝะพััะธ ะฝะฐ ะบัะธะฟัะพะฒะฐะปััั ะฟะพะดะดะตัะถะธะฒะฐัััั ัะพะปัะบะพ ะทะฝะฐัะตะฝะธั ัะพัะผะฐัะฐ 20ั
ั
.
From Month - ะะฐัะฐะปัะฝัะน ะผะตััั, ะพะฟัะธะพะฝะฐะปัะฝะพ, ะผะตะฝััั ะฝะต ัะตะบะพะผะตะฝะดัะตััั
To Month - ะะพะฝะตัะฝัะน ะผะตััั, ะพะฟัะธะพะฝะฐะปัะฝะพ, ะผะตะฝััั ะฝะต ัะตะบะพะผะตะฝะดัะตััั
From day - ะะฐัะฐะปัะฝัะน ะดะตะฝั ะผะตัััะฐ, ะพะฟัะธะพะฝะฐะปัะฝะพ, ะผะตะฝััั ะฝะต ัะตะบะพะผะตะฝะดัะตััั
To day - ะะพะฝะตัะฝัะน ะดะตะฝั ะผะตัััะฐ, ะพะฟัะธะพะฝะฐะปัะฝะพ, ะผะตะฝััั ะฝะต ัะตะบะพะผะตะฝะดัะตััั
ะะพััะฝะตะฝะธั ะบ ะณัะฐัะธะบั:
ะะตะปะตะฝัะต ะปะธะฝะธะธ - ะะพะฝะณ ะัะดะตัะฐ.
ะัะฐัะฝัะต ะปะธะฝะธะธ - ะจะพัั ะัะดะตัะฐ.
ะัะฐะฝะถะตะฒะฐั ะปะธะฝะธั - MA ะะฐะบัััะธั ะจะพัั ะฟะพะทะธัะธะน.
ะะฐะนะผะพะฒะฐั ะปะธะฝะธั - MA ะะฐะบัััะธั ะะพะฝะณ ะฟะพะทะธัะธะน.
SMA Cross Entry & Exit StrategyThis is a TradingView Strategy Script meaning you can't execute real trades using your exchange API connected to your TradingView account, it is designed for backtesting only
This is a basic backtesting script for charting the bullish and bearish cross of two user defined simple moving averages, select the cog next to the name of the script ON the price chart in the left hand corner. The script will print to the screen either "Long Entry" or "Short Entry" depending on the direction of the cross. The script using TradingView strategies will subsequently close the opposite of the position that is executed when the bullish or bearish cross occurs. Simply put, if you are short and a bullish cross occurs, your short trade will close and be logged in strategies and the long will fire. You can pyramid the long and short positions to continue entering as long as the trend doesn't flip. You will find this in the script settings. Since this script is for backtesting you can manually set the "backtesting range" for TradingView Strategies and firing the "Long Entry" and "Short Entry". This as well, is in the settings.
Notice: When the SMA cross occurs, you have to wait till the next candle before TradingView Strategy will print the "Long Entry" or "Short Entry" to the screen
TradingView - How To Use Strategies: www.tradingview.com
Noro's SILA v1.6L StrategyBacktesting
Backtesting (for all the time of existence of couple) only with software configurations to default (without optimization of parameters):
US = Uptrend-Sensivity
DS = Downtrend-Sensivity
It is recommended and by default:
- the normal market requires US=DS (for example US=5, DS=5)
- very bear market requires US DS, (for example US=5, DS=0)
- very bull market requires US DS, (US=0, DS=5)
Cryptocurrencies it is very bull market (US=0, DS=5)
Backtesting BTC/FIAT
D1 timeframe
identical parameters for all pairs
BTC/USD (Bitstamp) profit of +41805%
BTC/EUR (BTC-e) profit of +1147%
BTC/RUB (BTC-e) profit of +1162%
BTC/JPY (Bitflyer) profit of +215%
BTC/CNY (BTCChina) profit of 54948%
Backtesting ALTCOIN/BTC
D1 timeframe
identical parameters for all pairs
the exchange Poloniex
top-10 of cryptocurrencies on capitalization at the time of this text
NA = TradingView can't make backtest because of too low price of this cryptocurrency, or on the website there are no quotations of this cryptocurrency
ETH/BTC (Etherium) profit of +11690%
XRP/BTC (Ripple) loss of-100%
LTC/BTC (Litecoin) NA
ETC/BTC (Etherium Classic) profit of +214%
NEM/BTC loss of-49%
DASH/BTC profit of +106%
IOTA/BTC NA
XMR/BTC (Monero) profit of +96%
STRAT/BTC (Stratis) loss of-31%
ALTCOIN/ALTCOIN - not recomended
I don't need your money, I need reputation and likes.
Volatility Targeting: Single Asset [BackQuant]Volatility Targeting: Single Asset
An educational example that demonstrates how volatility targeting can scale exposure up or down on one symbol, then applies a simple EMA cross for long or short direction and a higher timeframe style regime filter to gate risk. It builds a synthetic equity curve and compares it to buy and hold and a benchmark.
Important disclaimer
This script is a concept and education example only . It is not a complete trading system and it is not meant for live execution. It does not model many real world constraints, and its equity curve is only a simplified simulation. If you want to trade any idea like this, you need a proper strategy() implementation, realistic execution assumptions, and robust backtesting with out of sample validation.
Single asset vs the full portfolio concept
This indicator is the single asset, long short version of the broader volatility targeted momentum portfolio concept. The original multi asset concept and full portfolio implementation is here:
That portfolio script is about allocating across multiple assets with a portfolio view. This script is intentionally simpler and focuses on one symbol so you can clearly see how volatility targeting behaves, how the scaling interacts with trend direction, and what an equity curve comparison looks like.
What this indicator is trying to demonstrate
Volatility targeting is a risk scaling framework. The core idea is simple:
If realized volatility is low relative to a target, you can scale position size up so the strategy behaves like it has a stable risk budget.
If realized volatility is high relative to a target, you scale down to avoid getting blown around by the market.
Instead of always being 1x long or 1x short, exposure becomes dynamic. This is often used in risk parity style systems, trend following overlays, and volatility controlled products.
This script combines that risk scaling with a simple trend direction model:
Fast and slow EMA cross determines whether the strategy is long or short.
A second, longer EMA cross acts as a regime filter that decides whether the system is ACTIVE or effectively in CASH.
An equity curve is built from the scaled returns so you can visualize how the framework behaves across regimes.
How the logic works step by step
1) Returns and simple momentum
The script uses log returns for the base return stream:
ret = log(price / price )
It also computes a simple momentum value:
mom = price / price - 1
In this version, momentum is mainly informational since the directional signal is the EMA cross. The lookback input is shared with volatility estimation to keep the concept compact.
2) Realized volatility estimation
Realized volatility is estimated as the standard deviation of returns over the lookback window, then annualized:
vol = stdev(ret, lookback) * sqrt(tradingdays)
The Trading Days/Year input controls annualization:
252 is typical for traditional markets.
365 is typical for crypto since it trades daily.
3) Volatility targeting multiplier
Once realized vol is estimated, the script computes a scaling factor that tries to push realized volatility toward the target:
volMult = targetVol / vol
This is then clamped into a reasonable range:
Minimum 0.1 so exposure never goes to zero just because vol spikes.
Maximum 5.0 so exposure is not allowed to lever infinitely during ultra low volatility periods.
This clamp is one of the most important โsanity railsโ in any volatility targeted system. Without it, very low volatility regimes can create unrealistic leverage.
4) Scaled return stream
The per bar return used for the equity curve is the raw return multiplied by the volatility multiplier:
sr = ret * volMult
Think of this as the return you would have earned if you scaled exposure to match the volatility budget.
5) Long short direction via EMA cross
Direction is determined by a fast and slow EMA cross on price:
If fast EMA is above slow EMA, direction is long.
If fast EMA is below slow EMA, direction is short.
This produces dir as either +1 or -1. The scaled return stream is then signed by direction:
avgRet = dir * sr
So the strategy return is volatility targeted and directionally flipped depending on trend.
6) Regime filter: ACTIVE vs CASH
A second EMA pair acts as a top level regime filter:
If fast regime EMA is above slow regime EMA, the system is ACTIVE.
If fast regime EMA is below slow regime EMA, the system is considered CASH, meaning it does not compound equity.
This is designed to reduce participation in long bear phases or low quality environments, depending on how you set the regime lengths. By default it is a classic 50 and 200 EMA cross structure.
Important detail, the script applies regime_filter when compounding equity, meaning it uses the prior bar regime state to avoid ambiguous same bar updates.
7) Equity curve construction
The script builds a synthetic equity curve starting from Initial Capital after Start Date . Each bar:
If regime was ACTIVE on the previous bar, equity compounds by (1 + netRet).
If regime was CASH, equity stays flat.
Fees are modeled very simply as a per bar penalty on returns:
netRet = avgRet - (fee_rate * avgRet)
This is not realistic execution modeling, it is just a simple turnover penalty knob to show how friction can reduce compounded performance. Real backtesting should model trade based costs, spreads, funding, and slippage.
Benchmark and buy and hold comparison
The script pulls a benchmark symbol via request.security and builds a buy and hold equity curve starting from the same date and initial capital. The buy and hold curve is based on benchmark price appreciation, not the strategyโs asset price, so you can compare:
Strategy equity on the chart symbol.
Buy and hold equity for the selected benchmark instrument.
By default the benchmark is TVC:SPX, but you can set it to anything, for crypto you might set it to BTC, or a sector index, or a dominance proxy depending on your study.
What it plots
If enabled, the indicator plots:
Strategy Equity as a line, colored by recent direction of equity change, using Positive Equity Color and Negative Equity Color .
Buy and Hold Equity for the chosen benchmark as a line.
Optional labels that tag each curve on the right side of the chart.
This makes it easy to visually see when volatility targeting and regime gating change the shape of the equity curve relative to a simple passive hold.
Metrics table explained
If Show Metrics Table is enabled, a table is built and populated with common performance statistics based on the simulated daily returns of the strategy equity curve after the start date. These include:
Net Profit (%) total return relative to initial capital.
Max DD (%) maximum drawdown computed from equity peaks, stored over time.
Win Rate percent of positive return bars.
Annual Mean Returns (% p/y) mean daily return annualized.
Annual Stdev Returns (% p/y) volatility of daily returns annualized.
Variance of annualized returns.
Sortino Ratio annualized return divided by downside deviation, using negative return stdev.
Sharpe Ratio risk adjusted return using the risk free rate input.
Omega Ratio positive return sum divided by negative return sum.
Gain to Pain total return sum divided by absolute loss sum.
CAGR (% p/y) compounded annual growth rate based on time since start date.
Portfolio Alpha (% p/y) alpha versus benchmark using beta and the benchmark mean.
Portfolio Beta covariance of strategy returns with benchmark returns divided by benchmark variance.
Skewness of Returns actually the script computes a conditional value based on the lower 5 percent tail of returns, so it behaves more like a simple CVaR style tail loss estimate than classic skewness.
Important note, these are calculated from the synthetic equity stream in an indicator context. They are useful for concept exploration, but they are not a substitute for professional backtesting where trade timing, fills, funding, and leverage constraints are accurately represented.
How to interpret the system conceptually
Vol targeting effect
When volatility rises, volMult falls, so the strategy de risks and the equity curve typically becomes smoother. When volatility compresses, volMult rises, so the system takes more exposure and tries to maintain a stable risk budget.
This is why volatility targeting is often used as a โrisk equalizerโ, it can reduce the โbiggest drawdowns happen only because vol expandedโ problem, at the cost of potentially under participating in explosive upside if volatility rises during a trend.
Long short directional effect
Because direction is an EMA cross:
In strong trends, the direction stays stable and the scaled return stream compounds in that trend direction.
In choppy ranges, the EMA cross can flip and create whipsaws, which is where fees and regime filtering matter most.
Regime filter effect
The 50 and 200 style filter tries to:
Keep the system active in sustained up regimes.
Reduce exposure during long down regimes or extended weakness.
It will always be late at turning points, by design. It is a slow filter meant to reduce deep participation, not to catch bottoms.
Common applications
This script is mainly for understanding and research, but conceptually, volatility targeting overlays are used for:
Risk budgeting normalize risk so your exposure is not accidentally huge in high vol regimes.
System comparison see how a simple trend model behaves with and without vol scaling.
Parameter exploration test how target volatility, lookback length, and regime lengths change the shape of equity and drawdowns.
Framework building as a reference blueprint before implementing a proper strategy() version with trade based execution logic.
Tuning guidance
Lookback lower values react faster to vol shifts but can create unstable scaling, higher values smooth scaling but react slower to regime changes.
Target volatility higher targets increase exposure and drawdown potential, lower targets reduce exposure and usually lower drawdowns, but can under perform in strong trends.
Signal EMAs tighter EMAs increase trade frequency, wider EMAs reduce churn but react slower.
Regime EMAs slower regime filters reduce false toggles but will miss early trend transitions.
Fees if you crank this up you will see how sensitive higher turnover parameter sets are to friction.
Final note
This is a compact educational demonstration of a volatility targeted, long short single asset framework with a regime gate and a synthetic equity curve. If you want a production ready implementation, the correct next step is to convert this concept into a strategy() script, add realistic execution and cost modeling, test across multiple timeframes and market regimes, and validate out of sample before making any decision based on the results.
ALT Risk Metric StrategyHere's a professional write-up for your ALT Risk Strategy script:
ALT/BTC Risk Strategy - Multi-Crypto DCA with Bitcoin Correlation Analysis
Overview
This strategy uses Bitcoin correlation as a risk indicator to time entries and exits for altcoins. By analyzing how your chosen altcoin performs relative to Bitcoin, the strategy identifies optimal accumulation periods (when alt/BTC is oversold) and profit-taking opportunities (when alt/BTC is overbought). Perfect for traders who want to outperform Bitcoin by strategically timing altcoin positions.
Key Innovation: Why Alt/BTC Matters
Most traders focus solely on USD price, but Alt/BTC ratios reveal true altcoin strength:
When Alt/BTC is low โ Altcoin is undervalued relative to Bitcoin (buy opportunity)
When Alt/BTC is high โ Altcoin has outperformed Bitcoin (take profits)
This approach captures the rotation between BTC and alts that drives crypto cycles
Key Features
๐ Advanced Technical Analysis
RSI (60% weight): Primary momentum indicator on weekly timeframe
Long-term MA Deviation (35% weight): Measures distance from 150-period baseline
MACD (5% weight): Minor confirmation signal
EMA Smoothing: Filters noise while maintaining responsiveness
All calculations performed on Alt/BTC pairs for superior market timing
๐ฐ 3-Tier DCA System
Level 1 (Risk โค 70): Conservative entry, base allocation
Level 2 (Risk โค 50): Increased allocation, strong opportunity
Level 3 (Risk โค 30): Maximum allocation, extreme undervaluation
Continuous buying: Executes every bar while below threshold for true DCA behavior
Cumulative sizing: L3 triggers = L1 + L2 + L3 amounts combined
๐ Smart Profit Management
Sequential selling: Must complete L1 before L2, L2 before L3
Percentage-based exits: Sell portions of position, not fixed amounts
Auto-reset on re-entry: New buy signals reset sell progression
Prevents premature full exits during volatile conditions
๐ค 3Commas Automation
Pre-configured JSON webhooks for Custom Signal Bots
Multi-exchange support: Binance, Coinbase, Kraken, Bitfinex, Bybit
Flexible quote currency: USD, USDT, or BUSD
Dynamic order sizing: Automatically adjusts to your tier thresholds
Full webhook documentation compliance
๐จ Multi-Asset Support
Pre-configured for popular altcoins:
ETH (Ethereum)
SOL (Solana)
ADA (Cardano)
LINK (Chainlink)
UNI (Uniswap)
XRP (Ripple)
DOGE
RENDER
Custom option for any other crypto
How It Works
Risk Metric Calculation (0-100 scale):
Fetches weekly Alt/BTC price data for stability
Calculates RSI, MACD, and deviation from 150-period MA
Normalizes MACD to 0-100 range using 500-bar lookback
Combines weighted components: (MACD ร 0.05) + (RSI ร 0.60) + (Deviation ร 0.35)
Applies 5-period EMA smoothing for cleaner signals
Color-Coded Risk Zones:
Green (0-30): Extreme buying opportunity - Alt heavily oversold vs BTC
Lime/Yellow (30-70): Accumulation range - favorable risk/reward
Orange (70-85): Caution zone - consider taking initial profits
Red/Maroon (85-100+): Euphoria zone - aggressive profit-taking
Entry Logic:
Buys execute every candle when risk is below threshold
As risk decreases, position sizing automatically scales up
Example: If risk drops from 60โ25, you'll be buying at L1 rate until it hits 50, then L2 rate, then L3 rate
Exit Logic:
Sells only trigger when in profit AND risk exceeds thresholds
Sequential execution ensures partial profit-taking
If new buy signal occurs before all sells complete, sell levels reset to L1
Configuration Guide
Choosing Your Altcoin:
Select crypto from dropdown (or use CUSTOM for unlisted coins)
Pick your exchange
Choose quote currency (USD, USDT, BUSD)
Risk Metric Tuning:
Long Term MA (default 150): Higher = more extreme signals, Lower = more frequent
RSI Length (default 10): Lower = more volatile, Higher = smoother
Smoothing (default 5): Increase for less noise, decrease for faster reaction
Buy Settings (Aggressive DCA Example):
L1 Threshold: 70 | Amount: $5
L2 Threshold: 50 | Amount: $6
L3 Threshold: 30 | Amount: $7
Total L3 buy = $18 per candle when deeply oversold
Sell Settings (Balanced Exit Example):
L1: 70 threshold, 25% position
L2: 85 threshold, 35% position
L3: 100 threshold, 40% position (final exit)
3Commas Setup
Bot Configuration:
Create Custom Signal Bot in 3Commas
Set trading pair to your altcoin/USD (e.g., ETH/USD, SOL/USDT)
Order size: Select "Send in webhook, quote" to use strategy's dollar amounts
Copy Bot UUID and Secret Token
Script Configuration:
Paste credentials into 3Commas section inputs
Check "Enable 3Commas Alerts"
Save and apply to chart
TradingView Alert:
Create Alert โ Condition: "alert() function calls only"
Webhook URL: api.3commas.io
Enable "Webhook URL" checkbox
Expiration: Open-ended
Strategy Advantages
โ
Outperform Bitcoin: Designed specifically to beat BTC by timing alt rotations
โ
Capture Alt Seasons: Automatically accumulates when alts lag, sells when they pump
โ
Risk-Adjusted Sizing: Buys more when cheaper (better risk/reward)
โ
Emotional Discipline: Systematic approach removes fear and FOMO
โ
Multi-Asset: Run same strategy across multiple altcoins simultaneously
โ
Proven Indicators: Combines RSI, MACD, and MA deviation - battle-tested tools
Backtesting Insights
Optimal Timeframes:
Daily chart: Best for backtesting and signal generation
Weekly data is fetched internally regardless of display timeframe
Historical Performance Characteristics:
Accumulates heavily during bear markets and BTC dominance periods
Captures explosive altcoin rallies when BTC stagnates
Sequential selling preserves capital during extended downtrends
Works best on established altcoins with multi-year history
Risk Considerations:
Requires capital reserves for extended accumulation periods
Some altcoins may never recover if fundamentals deteriorate
Past correlation patterns may not predict future performance
Always size positions according to personal risk tolerance
Visual Interface
Indicator Panel Displays:
Dynamic color line: GreenโLimeโYellowโOrangeโRed as risk increases
Horizontal threshold lines: Dashed lines mark your buy/sell levels
Entry/Exit labels: Green labels for buys, Orange/Red/Maroon for sells
Real-time risk value: Numerical display on price scale
Customization:
All threshold lines are adjustable via inputs
Color scheme clearly differentiates buy zones (green spectrum) from sell zones (red spectrum)
Line weights emphasize most extreme thresholds (L3 buy and L3 sell)
Strategy Philosophy
This strategy is built on the principle that altcoins move in cycles relative to Bitcoin. During Bitcoin rallies, alts often bleed against BTC (high sell, accumulate). When Bitcoin consolidates, alts pump (take profits). By measuring risk on the Alt/BTC chart instead of USD price, we time these rotations with precision.
The 3-tier system ensures you're always averaging in at better prices and scaling out at better prices, maximizing your Bitcoin-denominated returns.
Advanced Tips
Multi-Bot Strategy:
Run this on 5-10 different altcoins simultaneously to:
Diversify correlation risk
Capture whichever alt is pumping
Smooth equity curve through rotation
Pairing with BTC Strategy:
Use alongside the BTC DCA Risk Strategy for complete portfolio coverage:
BTC strategy for core holdings
ALT strategies for alpha generation
Rebalance between them based on BTC dominance
Threshold Calibration:
Check 2-3 years of historical data for your chosen alt
Note where risk metric sat during major bottoms (set buy thresholds)
Note where it peaked during euphoria (set sell thresholds)
Adjust for your risk tolerance and holding period
Credits
Strategy Development & 3Commas Integration: Claude AI (Anthropic)
Technical Analysis Framework: RSI, MACD, Moving Average theory
Implementation: pommesUNDwurst
Disclaimer
This strategy is for educational purposes only. Cryptocurrency trading involves substantial risk of loss. Altcoins are especially volatile and many fail completely. The strategy assumes liquid markets and reliable Alt/BTC price data. Always do your own research, understand the fundamentals of any asset you trade, and never risk more than you can afford to lose. Past performance does not guarantee future results. The authors are not financial advisors and assume no liability for trading decisions.
Additional Warning: Using leverage or trading illiquid altcoins amplifies risk significantly. This strategy is designed for spot trading of established cryptocurrencies with deep liquidity.
Tags: Altcoin, Alt/BTC, DCA, Risk Metric, Dollar Cost Averaging, 3Commas, ETH, SOL, Crypto Rotation, Bitcoin Correlation, Automated Trading, Alt Season
Feel free to modify any sections to better match your style or add specific backtesting results you've observed! ๐Claude is AI and can make mistakes. Please double-check responses. Sonnet 4.5
Advanced ICC Multi-Timeframe 1.0Advanced ICC Multi-Timeframe Trading System
A comprehensive implementation and interpretation of the Indication, Correction, Continuation (ICC) trading methodology made popular by Trades by Sci, enhanced with advanced multi-timeframe analysis and automation features.
โ ๏ธ CRITICAL TRADING WARNINGS:
DO NOT blindly follow BUY/SELL signals from this indicator
This indicator shows potential entry points but YOU must validate each trade
PAPER TRADE EXTENSIVELY before risking real capital
BACKTEST THOROUGHLY on your chosen instruments and timeframes
The ICC methodology requires understanding and discretion - automated signals are guidance only
This tool aids analysis but does not replace proper trade planning, risk management, or trader judgment
โ ๏ธ Important Disclaimers:
This indicator is not endorsed by or affiliated with Trades by Sci
This is an early implementation and interpretation of the ICC methodology
May not work exactly as Trades by Sci executes his trades and entries
Requires further debugging, backtesting, and real-world validation
Completely free to use - no purchase required
I'm just one person obsessed with this method and wanted some better visualization of the chart/entries
About ICC:
The ICC method identifies complete market cycles through three phases: Indication (breakout), Correction (pullback), and Continuation (entry). This indicator automates the identification of these phases and adds powerful features for modern traders.
Key Features:
Multi-Timeframe Capabilities:
Automatic timeframe detection with optimized settings for 5m, 15m, 30m, 1H, 4H, and Daily charts
Higher timeframe overlay to view HTF ICC levels on lower timeframe charts for precise entry timing
Smart defaults that adjust swing length and consolidation detection based on your timeframe
Advanced Phase Tracking:
Complete ICC cycle tracking: Indication, Correction, Consolidation, Continuation, and No Setup phases
Live structure detection shows potential peaks/troughs before full confirmation
Intelligent invalidation logic detects failed setups when market structure reverses
Dynamic phase backgrounds for instant visual confirmation
Three Types of Entry Signals:
Traditional Entries - Price crosses back through the original indication level (strongest signals)
"BUY" (green) / "SELL" (red)
Breakout Entries - Price breaks out of consolidation range in the same direction
"BUY" (green) / "SELL" (red)
Reversal Entries (Optional, can be toggled off) - Price breaks consolidation in opposite direction, indicating failed setup
"โ BUY" (yellow) / "โ SELL" (orange)
More aggressive, counter-trend signals
Can be disabled for more conservative trading
Professional Features:
Volatility-based support/resistance zones (ATR-adjusted) that adapt to market conditions
Historical zone tracking (0-3 configurable) with visual hierarchy
Comprehensive real-time info table displaying all key metrics
Full alert system for entries, indications, and consolidation detection
Visual distinction between high-confidence trend entries and cautionary reversal entries
๐ USAGE GUIDE
Entry Signal Types:
The indicator provides three types of entry signals with visual distinction:
Strong Entries (High Confidence):
"BUY" (bright green) / "SELL" (bright red)
Includes traditional entries (crossing back through indication level) and breakout entries (breaking consolidation in trend direction)
These are trend continuation or breakout signals with higher probability
Recommended for all traders
Reversal Entries (Caution - Counter-Trend):
"โ BUY" (yellow) / "โ SELL" (orange)
Triggered when price breaks out of correction/consolidation in the OPPOSITE direction
Indicates a failed setup and potential trend reversal
More aggressive, counter-trend plays
Can be toggled off in settings for more conservative trading
Recommended only for experienced traders or after thorough backtesting
Swing Length Settings:
The swing length determines how many bars on each side are needed to confirm a swing high/low. This is the most important setting for tuning the indicator to your style.
Auto Mode (Recommended for beginners): Toggle "Use Auto Timeframe Settings" ON
5-minute: 30 bars
15-minute: 20 bars
30-minute: 12 bars
1-hour: 7 bars
4-hour: 5 bars
Daily: 3 bars
Manual Mode: Toggle "Use Auto Timeframe Settings" OFF
Lower values (3-7): More aggressive, detects smaller swings
Pros: More signals, faster entries, catches smaller moves
Cons: More noise, more false signals, requires tighter stops
Best for: Scalping, active day trading, volatile markets
Higher values (12-20): More conservative, only major swings
Pros: More reliable signals, fewer false breakouts, clearer structure
Cons: Fewer signals, delayed entries, might miss smaller opportunities
Best for: Swing trading, position trading, trending markets
Default Manual Setting: 7 bars (balanced for 1H charts)
Minimum: 3 bars
Consolidation Bars Setting:
Determines how many bars without new structure are needed before flagging consolidation.
Lower values (3-10): Faster detection, catches brief pauses, more sensitive
Best for: Lower timeframes, volatile markets, avoiding any chop
Higher values (20-40): More reliable, only flags true extended consolidation
Best for: Higher timeframes, trending markets, patient traders
Current defaults scale with timeframe (more bars needed on shorter timeframes)
Historical S/R Zones:
Shows previous support and resistance levels to provide context.
Default: 2 historical zones (shows current + 2 previous)
Range: 0-3 zones
Visual Hierarchy: Older zones are more transparent with dashed borders
Usage: Higher numbers (2-3) show more historical context but can clutter the chart. Start with 2 and adjust based on your preference.
Live Structure Feature (Yellow Warning โ ):
Provides early warning of potential structure changes before full confirmation.
What it does: Detects potential swing highs/lows after just 2 bars instead of waiting for full swing_length confirmation
Live Peak: Shows when a high is followed by 2 lower closes (potential top forming)
Live Trough: Shows when a low is followed by 2 higher closes (potential bottom forming)
Important: These are UNCONFIRMED - they may be invalidated if price reverses
Use case: Get early awareness of potential reversals while waiting for confirmation
Displayed in: Info table only (no visual markers on chart to reduce clutter)
Only shows: Peaks higher than last swing high, or troughs lower than last swing low (filters out noise)
Higher Timeframe (HTF) Analysis:
View higher timeframe ICC structure while trading on lower timeframes.
How to enable: Toggle "Show Higher Timeframe ICC" ON
Setup: Set "Higher Timeframe" to your reference timeframe
Example: Trading on 15-minute? Set HTF to 240 (4-hour) or 60 (1-hour)
Example: Trading on 5-minute? Set HTF to 60 (1-hour) or 15 (15-minute)
What it shows:
HTF indication levels displayed as dashed lines
Blue = HTF Bullish Indication
Purple = HTF Bearish Indication
HTF phase and levels shown in info table
Trading workflow:
Check HTF phase for overall market direction
Wait for HTF correction phase
Drop to lower timeframe to find precise entries
Enter when lower TF shows continuation in alignment with HTF
Best practice: HTF should be 3-4x your trading timeframe for best results
Reversal Entries Toggle:
Default: ON (shows all signal types)
Toggle OFF for more conservative trading (only trend continuation signals)
Recommended: Backtest with both settings to see which works better for your style
New traders should consider disabling reversal entries initially
Volatility-Based Zones:
When enabled, support/resistance zones automatically adjust their height based on ATR (Average True Range).
More volatile = wider zones
Less volatile = tighter zones
Toggle OFF for fixed-width zones
Community Feedback Welcome:
This is an evolving project and your input is valuable! Please share:
Bug reports and issues you encounter
Feature requests and suggestions for improvement
Results from your backtesting and live trading experience
Feedback on the reversal entry feature (too aggressive? working well?)
Ideas for better aligning with the ICC methodology
Perfect for traders learning or implementing the ICC methodology with the benefit of modern automation, multi-timeframe analysis, and flexible entry signal options.
ATH๋๋น ์ง์ ํ๋ฝ๋ฅ ์ ๋์ฐฉ ์ ๋งค์ - ์ฅ๊ธฐํ๋ฉ ์ ๋ฌผ ์ ๋ต(ATH Drawdown Re-Buy Long Only)๋ณธ ์คํฌ๋ฆฝํธ๋ ๊ณผ๊ฑฐ ํ๋ฝ ๋ฐ์ดํฐ๋ฅผ ์ด์ฉํ์ฌ, ์ ํด์ง ํ๋ฝ %๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ ์๊ธฐ ์๋ณธ์ ์ ํด์ง %๋งํผ์ ์ง์
ํ๊ฒ ์ค๊ณ๋์ด์ง ์คํธ๋ ํฐ์ง์
๋๋ค.
๋ ๋ฒ๋ฆฌ์ง๋ฅผ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ ๊ธฐ๋ณธ์ ์ผ๋ก ์
ํ
ํด๋ ๊ฐ์ด ๋ด์ฅ๋์ด์์ต๋๋ค.(์์ ๋กญ๊ฒ ๋ฐ๊ฟ์ ์ฐ์๋ฉด ๋ฉ๋๋ค.) ์ถ๊ฐ์ ์ผ๋ก 2๋ฒ์ ์ง์
์ธ์๋ ๋ค๋ฅธ ์ง์
๊ธฐ์ค, ์ง์
%๋ฅผ ์ค์ ํ์ค ์ ์์ผ๋ฉฐ - ChatGPT์๊ฒ ์์ฒญํ๋ฉด ์์ ํด์ค ๊ฒ์
๋๋ค.
์ค์ ์ฌ์ฉ์ฉ๋๋ก๋ KillSwitch ๊ธฐ๋ฅ์ ๊บผ์ฃผ์ธ์. ๋ฐ ๋๋ณด๊ธฐ ๊ธฐ๋ฅ์ ์ผ์ฃผ์ธ์.
ATH Drawdown Re-Buy Long Only ์ ๋ต ์ค๋ช
1. ์ ๋ต ๊ฐ์
ATH Drawdown Re-Buy Long Only ์ ๋ต์ ์์ฐ์ ์ญ๋ ์ต๊ณ ๊ฐ(ATH, All-Time High)๋ฅผ ๊ธฐ์ค์ผ๋ก ํ ํ๋ฝํญ(๋๋ก์ฐ๋ค์ด)์ ํ์ฉํ์ฌ,
ํน์ ๊ตฌ๊ฐ๋ง๋ค ๋จ๊ณ์ ์ผ๋ก ๋กฑ ํฌ์ง์
์ ๊ตฌ์ถํ๋ ์๋ ์ฌ๋งค์(Long Only) ์ ๋ต์
๋๋ค.
๋ณธ ์ ๋ต์ ๋ค์๊ณผ ๊ฐ์ ๋ชฉ์ ์ ๊ฐ์ง๊ณ ์ค๊ณ๋์์ต๋๋ค.
๊ธ๊ฒฉํ ์กฐ์ ๊ตฌ๊ฐ์์ ์ฒด๊ณ์ ์ธ ๋ถํ ๋งค์ ๋ฐ ๋ ๋ฒ๋ฆฌ์ง ํ์ฉ
ATH๋ฅผ ๊ธฐ์ค์ผ๋ก ํ ๋ช
ํํ ์ง์
๊ท์น ์ ๊ณต
์ค์๊ฐ์ผ๋ก
ํ๋จ๊ฐ
๋ ๋ฒ๋ฆฌ์ง
์ฒญ์ฐ๊ฐ ์ถ์
๊ณ์ข MDD
์์ต๋ฅ
๋ฑ์ ์๊ฐ์ ์ผ๋ก ์ ๊ณตํ์ฌ ๋ฆฌ์คํฌ์ ํฌ์ง์
์ํ๋ฅผ ์ง๊ด์ ์ผ๋ก ํ์ธํ ์ ์๋๋ก ์ง์
โป ๋ณธ ์ ๋ต์ ๊ต์กยท์ฐ๊ตฌยท๋ฐฑํ
์คํธ ์ฉ๋๋ก ์ ๊ณต๋๋ฉฐ,
์ด๋ ํ ํํ์ ํฌ์ ๊ถ์ ๋๋ ์์ต์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
2. ์ ๋ต์ ํต์ฌ ๊ฐ๋
2-1. ATH(์ญ๋ ์ต๊ณ ๊ฐ) ๊ธฐ์ค ๋๋ก์ฐ๋ค์ด
์ ๋ต์ ์ฐจํธ ์์์ ํญ์ ๊ฐ์ฅ ๋์ ๊ณ ๊ฐ(High)๋ฅผ ATH๋ก ๊ธฐ๋กํฉ๋๋ค.
์๋ก์ด ๊ณ ์ ์ด ํ์ฑ๋ ๋๋ง๋ค ATH๋ฅผ ๊ฐฑ์ ํ๊ณ , ํด๋น ATH๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ค์์ ๊ณ์ฐํฉ๋๋ค.
ํ์ฌ ๋ฐ์ ์ ๊ฐ(Low)๊ฐ ATH์์ ๋ช % ํ๋ฝํ๋์ง
ํ์ฌ ๋ฐ์ ์ข
๊ฐ(Close)๊ฐ ATH์์ ๋ช % ํ๋ฝํ๋์ง
๊ทธ๋ฆฌ๊ณ ์ฌ์ ์ ์ค์ ํ ๋ ๊ฐ์ ๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ์์ ๋งค์๋ฅผ ์ํํฉ๋๋ค.
1์ฐจ ์ง์
๊ตฌ๊ฐ: ATH ๋๋น X% ํ๋ฝ ์
2์ฐจ ์ง์
๊ตฌ๊ฐ: ATH ๋๋น Y% ํ๋ฝ ์
๊ฐ ๊ตฌ๊ฐ์ ATH๊ฐ ์๋ก ๊ฐฑ์ ๋ ๋๋ง๋ค ํ ๋ฒ์ฉ๋ง ์๋ํ๋ฉฐ,
์๋ก์ด ATH๊ฐ ์์ฑ๋๋ฉด ๋ค์ โ1์ฐจ / 2์ฐจ ์ง์
๊ฐ๋ฅ ์ํโ๋ก ์ด๊ธฐํ๋ฉ๋๋ค.
2-2. ์ฒซ ํฌ์ง์
100% / 300% ํน์ ๊ท์น
์ด ์ ๋ต์ ์ค์ํ ํน์ง์ **โ์ฒซ ํฌ์ง์
์ง์
์์ ์์ธ ๊ท์นโ**์
๋๋ค.
์ ๋ต์ด ํ์ฌ ์ด๋ ํ ํฌ์ง์
๋ ๋ค๊ณ ์์ง ์์ ์ํ์์
์ต์ด๋ก ๋กฑ ํฌ์ง์
์ ์ง์
ํ๋ ์์ (์ฒซ ํฌ์ง์
)์ ๋ํด:
๊ธฐ๋ณธ์ ์ผ๋ก๋ **์์ฐ์ 100%**๋ฅผ ๊ธฐ์ค์ผ๋ก ํฌ์ง์
์ ๊ตฌ์ถํ์ง๋ง,
๋ง์ฝ ๊ทธ ์๊ฐ์ ๊ฐ๊ฒฉ์ด ATH ๋๋น ์ค์ ๊ฐ ์ด์(์: ์ฝ โ72.5% ์ด์ ํ๋ฝํ ์ํฉ) ์ด๋ผ๋ฉด
โ ์์ฐ์ 300% ๊ท๋ชจ๋ก ์ฒซ ํฌ์ง์
์ ์ง์
ํ๋๋ก ์ค๊ณ๋์ด ์์ต๋๋ค.
์ด ๊ท์น์ ๋ค์๊ณผ ๊ฐ์ด ๋์ํฉ๋๋ค.
์ฒซ ์ง์
์ด 1์ฐจ ๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ์์ ๋ฐ์ํ๋ ,
์ฒซ ์ง์
์ด 2์ฐจ ๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ์์ ๋ฐ์ํ๋ ,
ํ์ฌ ํ๋ฝํญ์ด ์ค์ ๋ ๊ธฐ์ค ์ด์(์: โ72.5% ์ด์) ์ด๋ผ๋ฉด
โ โ์ด ์ ๋ ํ๋ฝ์ด๋ฉด ์ฒซ ์ง์
๋ถํฐ ๋ ๊ณต๊ฒฉ์ ์ผ๋ก ๋ค์ด๊ฐ๋คโ๋ ์๋ฏธ๋ก 300% ๊ท๋ชจ๋ก ์ง์
๊ทธ ์ดํ์ ํ๋ฝํญ์ด๋ผ๋ฉด
โ ์ฒซ ์ง์
์ 100% ๊ท๋ชจ๋ก ์ ํ
์ฆ, ์ ๋ต์ ๋ค์ ๋ ๊ฐ์ง ๋ชจ๋๋ก ๋์ํฉ๋๋ค.
์ผ๋ฐ์ ์ธ ์ํฉ์ ์ฒซ ์ง์
: ์์ฐ์ 100%
์ฌ๊ฐํ ๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ์์์ ์ฒซ ์ง์
: ์์ฐ์ 300%
์ด ํน์ ๊ท์น์ ๊น์ ํ๋ฝ์์๋ ๊ณต๊ฒฉ์ ์ผ๋ก, ํ์์๋ ์๋์ ์ผ๋ก ๋ณด์์ ์ผ๋ก ์ง์
ํ๋๋ก ์ค๊ณ๋ ๊ฒ์
๋๋ค.
3. ์ ๋ต ๋์ ๊ตฌ์กฐ
3-1. ๋งค์ ์กฐ๊ฑด
์ฐจํธ ์ High ๊ธฐ์ค์ผ๋ก ATH๋ฅผ ์ถ์ ํฉ๋๋ค.
๊ฐ ๋ฐ๋ง๋ค ํด๋น ATH์์์ ํ๋ฝ๋ฅ ์ ๊ณ์ฐํฉ๋๋ค.
์ฌ์ฉ์๊ฐ ์ค์ ํ ๋ ๊ฐ์ ๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ(์์):
1์ฐจ ๊ตฌ๊ฐ: ์๋ฅผ ๋ค์ด ATH โ 50%
2์ฐจ ๊ตฌ๊ฐ: ์๋ฅผ ๋ค์ด ATH โ 72.5%
๊ฐ ๊ตฌ๊ฐ์ ๋ํด ๋ค์๊ณผ ๊ฐ์ ์กฐ๊ฑด์ ํ์ธํฉ๋๋ค.
โ์ด๋ฒ ATH ๊ตฌ๊ฐ์์ ์์ง ํด๋น ๊ตฌ๊ฐ ๋งค์๋ฅผ ํ ์ ์ด ์๋ ์ํโ์ด๊ณ ,
ํ์ฌ ๋ฐ์ ์ ๊ฐ(Low)๊ฐ ํด๋น ๊ตฌ๊ฐ ๊ฐ๊ฒฉ ์ดํ๋ฅผ ์ฐ๋ ์๊ฐ
โ ํด๋น ๋ฐ์์ ๋งค์ ์กฐ๊ฑด ์ถฉ์กฑ์ผ๋ก ๊ฐ์ฃผ
์ค์ ์ฃผ๋ฌธ์:
ํด๋น ๊ตฌ๊ฐ ๊ฐ๊ฒฉ์ ๋ง์ถฐ ๋กฑ ํฌ์ง์
์ง์
(๋ฆฌ๋ฐ/์์ฅ๊ฐ ๊ธฐ๋ฐ ์๋ฎฌ๋ ์ด์
) ์ผ๋ก ์ฒ๋ฆฌ๋ฉ๋๋ค.
3-2. ATH ๊ฐฑ์ ๊ณผ ์ง์
๊ธฐํ ๋ฆฌ์
์ฐจํธ ์์์ ์๋ก์ด ๊ณ ์ (High)์ด ๊ธฐ์กด ATH๋ฅผ ๋์ด์๋ ์๊ฐ,
ATH๊ฐ ๊ฐฑ์ ๋๊ณ ,
1์ฐจ / 2์ฐจ ์ง์
์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ ๋ด๋ถ ํ๋๊ทธ๊ฐ ์ด๊ธฐํ๋ฉ๋๋ค.
์ด๋ฅผ ํตํด, ์์ฅ์ด ์๋ก์ด ๊ณ ์ ์ ๋ํํด ๋๊ฐ ๋๋ง๋ค,
ํด๋น ๊ตฌ๊ฐ์์ ๋ค์ ํ ๋ฒ์ฉ 1์ฐจยท2์ฐจ ๋๋ก์ฐ๋ค์ด ์ง์
๊ธฐํ๋ฅผ ๊ฐ๊ฒ ๋ฉ๋๋ค.
4. ํฌ์ง์
์ฌ์ด์ง ๋ฐ ๋ ๋ฒ๋ฆฌ์ง
4-1. ๊ณ์ข ์์ฐ(Equity) ๊ธฐ์ค ํฌ์ง์
ํฌ๊ธฐ ๊ฒฐ์
์ ๋ต์ ํ์ฌ ๊ณ์ข ์์ฐ์ ๋ค์๊ณผ ๊ฐ์ด ์ ์ํ์ฌ ์ฌ์ฉํฉ๋๋ค.
ํ์ฌ ์์ฐ = ์ด๊ธฐ ์๋ณธ + ์คํ ์์ต + ๋ฏธ์คํ ์์ต
๊ฐ ์ง์
๊ตฌ๊ฐ์์์ ํฌ์ง์
๊ฐ์น๋ ๋ค์๊ณผ ๊ฐ์ด ๊ฒฐ์ ๋ฉ๋๋ค.
1์ฐจ ์ง์
๊ตฌ๊ฐ:
โ์์ฐ์ ๋ช %๋ฅผ ์ฌ์ฉํ ์งโ๋ฅผ ์ค์ ๊ฐ์ผ๋ก ์
๋ ฅ
์ค์ ๋ ํผ์ผํธ๋ฅผ ๊ณ์ข ์์ฐ์ ๊ณฑํ ๋ค,
๋ค์ ์ ๋ต ๋ด ๋ ๋ฒ๋ฆฌ์ง ๋ฐฐ์(Leverage) ๋ฅผ ๊ณฑํ์ฌ ์ค์ ํฌ์ง์
๊ฐ์น๋ฅผ ๊ณ์ฐ
2์ฐจ ์ง์
๊ตฌ๊ฐ:
๋์ผํ ๋ฐฉ์์ผ๋ก, ๋
๋ฆฝ๋ ํผ์ผํธ ์ค์ ๊ฐ์ ์ฌ์ฉ
์ฆ, ํฌ์ง์
๊ฐ์น๋ ๋ค์๊ณผ ๊ฐ์ด ๊ณ์ฐ๋ฉ๋๋ค.
ํฌ์ง์
๊ฐ์น = ํ์ฌ ์์ฐ ร (ํด๋น ๊ตฌ๊ฐ ์ค์ % / 100) ร ๋ ๋ฒ๋ฆฌ์ง ๋ฐฐ์
๊ทธ๋ฆฌ๊ณ ์ด๋ฅผ ํด๋น ๊ตฌ๊ฐ์ ์ง์
๊ฐ๊ฒฉ์ผ๋ก ๋๋์ด ์ค์ ์๋(ํ ํฐ ๋จ์) ๋ฅผ ์ฐ์ถํฉ๋๋ค.
4-2. ์ฒซ ํฌ์ง์
์ ์์ธ ์ฒ๋ฆฌ (100% / 300%)
์ฒซ ํฌ์ง์
์ ๋ํด์๋ ์์ ์ผ๋ฐ์ ์ธ ํผ์ผํธ ์ค์ ๋์ ,
๋ค์๊ณผ ๊ฐ์ ๊ณ ์ ๋น์จ์ด ์ฌ์ฉ๋ฉ๋๋ค.
๊ธฐ๋ณธ: ์์ฐ์ 100% ๊ท๋ชจ๋ก ์ฒซ ํฌ์ง์
์ง์
๋จ, ์ง์
์์ ์ ATH ๋๋น ํ๋ฝ๋ฅ ์ด ์ค์ ๊ฐ ์ด์(์: โ72.5% ์ด์) ์ผ ๊ฒฝ์ฐ
โ ์์ฐ์ 300% ๊ท๋ชจ๋ก ์ฒซ ํฌ์ง์
์ง์
์ด๋ ์ญ์ ๋ค์ ๊ณต์์ ์ฌ์ฉํฉ๋๋ค.
ํฌ์ง์
๊ฐ์น = ํ์ฌ ์์ฐ ร (100% ๋๋ 300%) ร ๋ ๋ฒ๋ฆฌ์ง
๊ทธ๋ฆฌ๊ณ ์ด๋ฅผ ๊ฐ๊ฒฉ์ผ๋ก ๋๋์ด ์ค์ ์ง์
์๋์ ๊ณ์ฐํฉ๋๋ค.
์ด ๊ท์น์:
์ฒซ ์ง์
์ด 1์ฐจ ๊ตฌ๊ฐ์ด๋ 2์ฐจ ๊ตฌ๊ฐ์ด๋ ๋์ผํ๊ฒ ์ ์ฉ๋๋ฉฐ,
โ์ถฉ๋ถํ ๊น์ ํ๋ฝ ๊ตฌ๊ฐ์์๋ ์ฒซ ์ง์
๋ถํฐ ๋ ํฌ๊ฒ,
ํ์์๋ ๋น๊ต์ ๋ณด์์ ์ผ๋กโ ๋ผ๋ ์ด์ฉ ์ฒ ํ์ ๋ฐ์ํฉ๋๋ค.
4-3. ์ค๋ ๋ฒ๋ฆฌ์ง(Real Leverage)์ ์ถ์
์ ๋ต์ ๊ฐ ๋ฐ ๋จ์๋ก ๋ค์์ ์ถ์ ํฉ๋๋ค.
๋ฐ๊ฐ ์์ํ ๋์ ๊ธฐ์กด ํฌ์ง์
ํฌ๊ธฐ
ํด๋น ๋ฐ์์ ์๋ก ์ง์
ํ ์๋
์ด๋ฅผ ๋ฐํ์ผ๋ก, ์ง์
์ด ๋ฐ์ํ ์์ ์ ๋ค์์ ๊ณ์ฐํฉ๋๋ค.
์ค์ ๋ ๋ฒ๋ฆฌ์ง = (ํฌ์ง์
๊ฐ์น / ํ์ฌ ์์ฐ)
๊ทธ๋ฆฌ๊ณ ์ฐจํธ ์์ ์๋ฅผ ๋ค์ด:
Lev 2.53x ์ ๊ฐ์ ํ์์ ๋ ์ด๋ธ๋ก ํ์ํฉ๋๋ค.
์ด๋ฅผ ํตํด, ๋งค์ ์์ ๋ง๋ค ์ค์ ๊ณ์ข ๋ ๋ฒ๋ฆฌ์ง๊ฐ ์ด๋ ์ ๋์๋์ง๋ฅผ ์ง๊ด์ ์ผ๋ก ํ์ธํ ์ ์์ต๋๋ค.
5. ์๊ฐํ ๋ฐ ๋ชจ๋ํฐ๋ง ์์
5-1. ์ฐจํธ ์ ์๊ฐ ์์
์ ๋ต์ ์ฐจํธ ์์ ๋ค์๊ณผ ๊ฐ์ ์ ๋ณด๋ฅผ ์ง์ ํ์ํฉ๋๋ค.
ATH ๋ผ์ธ
High ๊ธฐ์ค์ผ๋ก ๊ณ์ฐ๋ ์ญ๋ ์ต๊ณ ๊ฐ๋ฅผ ์ฃผํฉ์ ์ ์ผ๋ก ํ์
ํ๋จ๊ฐ(ํ๊ท ์ง์
๊ฐ) ๋ผ์ธ
ํ์ฌ ๋ณด์ ํฌ์ง์
์ด ์์ ๋,
ํด๋น ํฌ์ง์
์ ํ๊ท ์ง์
๊ฐ๋ฅผ ๋
ธ๋์ ์ ์ผ๋ก ํ์
์ถ์ ์ฒญ์ฐ๊ฐ(๊ณ ์ ํ ์ฒญ์ฐ๊ฐ) ๋ผ์ธ
ํฌ์ง์
์๋์ด ๋ณํํ๋ ์์ ์ ๊ฐ์งํ์ฌ,
๋น์์ ํ๋จ๊ฐ์ ์ค์ ๋ ๋ฒ๋ฆฌ์ง๋ฅผ ์ด์ฉํด ๊ทผ์ฌ์ ์ธ ์ฒญ์ฐ๊ฐ๋ฅผ ๊ณ์ฐ
์ด๋ฅผ ๋นจ๊ฐ์ ์ ์ผ๋ก ์ฐจํธ์ ๊ณ ์ ํ์
ํฌ์ง์
์ด ์๊ฑฐ๋ ๋ ๋ฒ๋ฆฌ์ง๊ฐ 1๋ฐฐ ์ดํ์ธ ๊ฒฝ์ฐ์๋ ์ฒญ์ฐ๊ฐ ๋ผ์ธ์ ์ ๊ฑฐ
๋งค์ ๋ง์ปค ๋ฐ ๋ ์ด๋ธ
1์ฐจ/2์ฐจ ๋งค์ ์กฐ๊ฑด์ด ์ถฉ์กฑ๋ ๋๋ง๋ค ํด๋น ์ง์ ์ ๋งค์ ๋ง์ปค๋ฅผ ํ์
"Buy XX% @ ๊ฐ๊ฒฉ", "Lev XXx" ํํ์ ๋ผ๋ฒจ๋ก
์ง์
๋น์จ๊ณผ ๋น์ ๋ ๋ฒ๋ฆฌ์ง๋ฅผ ํจ๊ป ์๊ฐํ
๋ ์ด๋ธ์ ์์น๋ ์ค์ ์์ ์ ํ ๊ฐ๋ฅ:
๋ฐ ์๋ (Below Bar)
๋ฐ ์ (Above Bar)
์ค์ ๊ฐ๊ฒฉ ์์น (At Price)
5-2. ์ฐ์ธก ์๋จ ์ ๋ณด ํ
์ด๋ธ
์ฐจํธ ์ฐ์ธก ์๋จ์๋ ํ์ฌ ๊ณ์ขยทํฌ์ง์
์ํ๋ฅผ ์์ฝํ ์ ๋ณด ํ
์ด๋ธ์ด ํ์๋ฉ๋๋ค.
๋ํ์ ์ผ๋ก ๋ค์ ํญ๋ชฉ๋ค์ด ํฌํจ๋ฉ๋๋ค.
Pos Qty (Token)
ํ์ฌ ๋ณด์ ์ค์ธ ํฌ์ง์
์๋(ํ ํฐ ๊ธฐ์ค, ์ ๋๊ฐ ๊ธฐ์ค)
Pos Value (USDT)
ํ์ฌ ํฌ์ง์
์ ์์ฅ ๊ฐ์น (์๋ ร ํ์ฌ ๊ฐ๊ฒฉ)
Leverage (Now)
ํ์ฌ ์ค๋ ๋ฒ๋ฆฌ์ง (ํฌ์ง์
๊ฐ์น / ํ์ฌ ์์ฐ)
DD from ATH (%)
ํ์ฌ ๊ฐ๊ฒฉ ๊ธฐ์ค, ์ต๊ทผ ATH์์์ ํ๋ฝ๋ฅ (%)
Avg Entry
ํ์ฌ ํฌ์ง์
์ ํ๊ท ์ง์
๊ฐ๊ฒฉ
PnL (%)
ํ์ฌ ํฌ์ง์
๊ธฐ์ค ๋ฏธ์คํ ์์ต๋ฅ (%)
Max DD (Equity %)
์ ๋ต ์ ์ฒด ๊ธฐ๊ฐ ๋์ ๊ธฐ๋ก๋ ๊ณ์ข ๊ธฐ์ค ์ต๋ ์์ค(MDD, Max Drawdown)
Last Entry Price
๊ฐ์ฅ ์ต๊ทผ์ ํฌ์ง์
์ ์ถ๊ฐ๋ก ์ง์
ํ ์งํ์ ํ๊ท ์ง์
๊ฐ๊ฒฉ
Last Entry Lev
์ โLast Entry Priceโ ์์ ์์์ ์ค๋ ๋ฒ๋ฆฌ์ง
Liq Price (Fixed)
์์์ ์ค๋ช
ํ ๊ณ ์ ํ ์ถ์ ์ฒญ์ฐ๊ฐ
Return from Start (%)
์ ๋ต ์์ ์์ (์ด๊ธฐ ์๋ณธ) ๋๋น ํ์ฌ ๊ณ์ข ์์ฐ์ ์ด ์์ต๋ฅ (%)
์ด ํ
์ด๋ธ์ ํตํด ์ฌ์ฉ์๋:
ํ์ฌ ๊ณ์ข์ ํฌ์ง์
์ ์ํ
๋ฆฌ์คํฌ ์์ค
๋์ ์ฑ๊ณผ
๋ฅผ ์ง๊ด์ ์ผ๋ก ํ์
ํ ์ ์์ต๋๋ค.
6. ์๊ฐ ํํฐ ๋ฐ ๋ผ๋ฒจ ์ต์
6-1. ์ ๋ต ๋์ ๊ธฐ๊ฐ ์ค์
์ ๋ต์ ์ต์
์ผ๋ก ํน์ ๊ธฐ๊ฐ์๋ง ์ ๋ต์ ๋์์ํค๋ ์๊ฐ ํํฐ๋ฅผ ์ ๊ณตํฉ๋๋ค.
โUse Date Rangeโ ์ต์
์ ํ์ฑํํ๋ฉด:
์์ ์๊ฐ๊ณผ ์ข
๋ฃ ์๊ฐ์ ์ง์ ํ์ฌ
ํด๋น ๊ตฌ๊ฐ์ ํํด์๋ง ๋งค๋งค๊ฐ ๋ฐ์ํ๋๋ก ์ ํ
์ต์
์ ๋นํ์ฑํํ๋ฉด:
์ ๋ต์ ์ ์ฒด ์ฐจํธ ๊ตฌ๊ฐ์์ ์์ ๋กญ๊ฒ ๋์
6-2. ์ง์
๋ผ๋ฒจ ์์น ์ค์
์ฌ์ฉ์๋ ๋งค์/๋ ๋ฒ๋ฆฌ์ง ๋ผ๋ฒจ์ ์์น๋ฅผ ์ ํํ ์ ์์ต๋๋ค.
๋ฐ ์๋ (Below Bar)
๋ฐ ์ (Above Bar)
์ค์ ๊ฐ๊ฒฉ ์์น (At Price)
์ด๋ฅผ ํตํด ๊ฐ์ธ ์ทจํฅ ๋ฐ ์ฐจํธ ๊ฐ๋
์ฑ์ ๋ง์ถ์ด
์๊ฐํ ๋ฐฉ์์ ์ ์ฐํ๊ฒ ์กฐ์ ํ ์ ์์ต๋๋ค.
7. ํ์ฉ ๋์ ๋ฐ ์ฌ์ฉ ์์
๋ณธ ์ ๋ต์ ๋ค์๊ณผ ๊ฐ์ ๋ชฉ์ ์ ์ ํฉํฉ๋๋ค.
ํ๋ฌผ ๋๋ ์ ๋ฌผ ๋กฑ ํฌ์ง์
๊ธฐ์ค ์ฅ๊ธฐยท์ค์ ๊ด์ ์ถ๋งค ์ ๋ต ๋ฐฑํ
์คํธ
โ๊ณ ์ ๋๋น ํ๋ฝ๋ฅ โ์ ๊ธฐ์ค์ผ๋ก ํ ๊ท์น ๊ธฐ๋ฐ ์ด์ฉ ์์ด๋์ด ๊ฒ์ฆ
๋ ๋ฒ๋ฆฌ์ง ์ฌ์ฉ ์
๊ณ์ข ๋ ๋ฒ๋ฆฌ์งยท์ฒญ์ฐ๊ฐยทMDD๋ฅผ ๋์์ ๋ชจ๋ํฐ๋งํ๊ณ ์ ํ๋ ๊ฒฝ์ฐ
ํน์ ์์ฐ์ ๋ํด
โ์๋ก์ด ๊ณ ์ ์ด ํ์ฑ๋ ๋๋ง๋ค
์ผ์ ํ ๊ท์น์ผ๋ก ๊น์ ์กฐ์ ๊ตฌ๊ฐ์์๋ง ๋ถํ ์ง์
ํ๊ณ ์ ํ ๋โ
์ค๊ฑฐ๋์ ๊ทธ๋๋ก ์ ์ฉํ๊ธฐ๋ณด๋ค๋,
์ ๋ต ์์ด๋์ด ๊ฒ์ฆ ๋ฐ ๋ฆฌ์คํฌ ํ๋กํ์ผ ๋ถ์,
์์ ์ ์ฑํฅ์ ๋ง๋ ํ๋ผ๋ฏธํฐ ํ์ ์ฉ๋๋ก ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
8. ํ๊ณ ๋ฐ ์ ์์ฌํญ
๋ฐฑํ
์คํธ ๊ฒฐ๊ณผ๋ ๋ฏธ๋ ์ฑ๊ณผ๋ฅผ ๋ณด์ฅํ์ง ์์ต๋๋ค.
๊ณผ๊ฑฐ ๋ฐ์ดํฐ์ ๊ธฐ๋ฐํ ์๋ฎฌ๋ ์ด์
์ผ ๋ฟ์ด๋ฉฐ,
์ค์ ์์ฅ์์๋
์ ๋์ฑ
์ฌ๋ฆฌํผ์ง
์์๋ฃ ์ฒด๊ณ
๊ฐ์ ์ฒญ์ฐ ๊ท์น
๋ฑ ๋ค์ํ ๋ณ์๊ฐ ์กด์ฌํฉ๋๋ค.
์ฒญ์ฐ๊ฐ๋ ๋จ์ํ๋ ๊ณต์์ ๋ฐ๋ฅธ ์ถ์ ์น์
๋๋ค.
๊ฑฐ๋์๋ณ ์ค์ ์ฒญ์ฐ ๊ท์น, ์ ์ง ์ฆ๊ฑฐ๊ธ, ์์๋ฃ, ํ๋ฉ๋น ๋ฑ์
๋ณธ ์ ๋ต์ ๊ณ์ฐ๊ณผ ๋ค๋ฅผ ์ ์์ผ๋ฉฐ,
์ฒญ์ฐ๊ฐ ์ถ์ ๋ผ์ธ์ ์ฐธ๊ณ ์ฉ ์งํ์ผ ๋ฟ์
๋๋ค.
๋ ๋ฒ๋ฆฌ์ง ๋ฐ ์ง์
๋น์จ ์ค์ ์ ๋ฐ๋ผ ์์ค ํญ์ด ๋งค์ฐ ์ปค์ง ์ ์์ต๋๋ค.
ํนํ **โ์ฒซ ํฌ์ง์
300% ์ง์
โ**๊ณผ ๊ฐ์ด ๋งค์ฐ ๊ณต๊ฒฉ์ ์ธ ์ค์ ์
์์ฅ ๊ธ๋ฝ ์ ๊ณ์ข ์์ค๊ณผ ์ฒญ์ฐ ๋ฆฌ์คํฌ๋ฅผ ํฌ๊ฒ ์ฆ๊ฐ์ํฌ ์ ์์ผ๋ฏ๋ก
์ ์คํ ๊ฒํ ๊ฐ ํ์ํฉ๋๋ค.
์ค๊ฑฐ๋ ์ฐ๋ ์์๋ ๋ณ๋์ ๋ฆฌ์คํฌ ๊ด๋ฆฌ๊ฐ ํ์์
๋๋ค.
๊ฐ๋ณ ์์ ๊ธฐ์ค
ํฌ์ง์
์ํ์
์ ์ฒด ํฌํธํด๋ฆฌ์ค ๋ด ๋น์ค ๊ด๋ฆฌ ๋ฑ
๋ณธ ์ ๋ต ์ธ๋ถ์์ ์ถ๊ฐ์ ์ธ ์์ ์ฅ์น๊ฐ ํ์ํฉ๋๋ค.
9. ๊ฒฐ๋ก
ATH Drawdown Re-Buy Long Only ์ ๋ต์ ๋จ์ํ โ์ ๊ฐ ๋งค์โ๋ฅผ ๋์ด์,
ATH ๊ธฐ์ค์ผ๋ก ๋๋ก์ฐ๋ค์ด์ ๊ตฌ์กฐ์ ์ผ๋ก ํ์ฉํ๊ณ ,
์ฒซ ํฌ์ง์
์ ๋ํ **ํน์ ๊ท์น(100% / 300%)**์ ์ ์ฉํ๋ฉฐ,
๋ ๋ฒ๋ฆฌ์งยท์ฒญ์ฐ๊ฐยทMDDยท์์ต๋ฅ ์ ํตํฉ์ ์ผ๋ก ์๊ฐํํจ์ผ๋ก์จ,
ํ๋ฝ ๊ตฌ๊ฐ์์์ ๊ท์น ๊ธฐ๋ฐ ๋กฑ ํฌ์ง์
๊ตฌ์ถ๊ณผ
๋ฆฌ์คํฌ ๋ชจ๋ํฐ๋ง์ ๋์์ ์ง์ํ๋ ์ ๋ต์
๋๋ค.
์ฌ์ฉ์๋ ๋ณธ ์ ๋ต์ ํตํด:
์์ ์ ์์ฅ ๊ด์ ๊ณผ ๋ฆฌ์คํฌ ํ์ฉ ๋ฒ์์ ๋ง๋
๋๋ก์ฐ๋ค์ด ๊ตฌ๊ฐ
์ง์
๋น์จ
๋ ๋ฒ๋ฆฌ์ง ์ค์
๋ค์ํ ์๋๋ฆฌ์ค์ ๋ํ ๋ฐฑํ
์คํธ์ ๋ถ์
์ ์ํํ ์ ์์ต๋๋ค.
๋ค์ ํ ๋ฒ ๊ฐ์กฐํ์ง๋ง,
๋ณธ ์ ๋ต์ ์ฐ๊ตฌยทํ์ตยท๋ฐฑํ
์คํธ๋ฅผ ์ํ ๋๊ตฌ์ด๋ฉฐ,
์ค์ ํฌ์ ํ๋จ๊ณผ ์ฑ
์์ ์ ์ ์ผ๋ก ์ฌ์ฉ์ ๋ณธ์ธ์๊ฒ ์์ต๋๋ค.
/ENG Version.
This script is designed to use historical drawdown data and automatically enter positions when a predefined percentage drop from the all-time high occurs, using a predefined percentage of your account equity.
You can use leverage, and default parameter values are provided out of the box (you can freely change them to suit your style).
In addition to the two main entry levels, you can add more entry conditions and custom entry percentages โ just ask ChatGPT to modify the script.
For actual/live usage, please turn OFF the KillSwitch function and turn ON the Bar Magnifier feature.
ATH Drawdown Re-Buy Long Only Strategy
1. Strategy Overview
The ATH Drawdown Re-Buy Long Only strategy is an automatic re-buy (Long Only) system that builds long positions step-by-step at specific drawdown levels, based on the assetโs all-time high (ATH) and its subsequent drawdown.
This strategy is designed with the following goals:
Systematic scaled buying and leverage usage during sharp correction periods
Clear, rule-based entry logic using drawdowns from ATH
Real-time visualization of:
Average entry price
Leverage
Estimated liquidation price
Account MDD (Max Drawdown)
Return / performance
This allows traders to intuitively monitor both risk and position status.
โป This strategy is provided for educational, research, and backtesting purposes only.
It does not constitute investment advice and does not guarantee any profits.
2. Core Concepts
2-1. Drawdown from ATH (All-Time High)
On the chart, the strategy always tracks the highest high as the ATH.
Whenever a new high is made, ATH is updated, and based on that ATH the following are calculated:
How many percent the current barโs Low is below the ATH
How many percent the current barโs Close is below the ATH
Using these, the strategy executes buys at two predefined drawdown zones:
1st entry zone: When price drops X% from ATH
2nd entry zone: When price drops Y% from ATH
Each zone is allowed to trigger only once per ATH cycle.
When a new ATH is created, the โ1st / 2nd entry possibleโ flags are reset, and new opportunities open up for that ATH leg.
2-2. Special Rule for the First Position (100% / 300%)
A key feature of this strategy is the special rule for the very first position.
When the strategy currently holds no position and is about to open the first long position:
Under normal conditions, it builds the position using 100% of account equity.
However, if at that moment the price has dropped by at least a predefined threshold from ATH (e.g. around โ72.5% or more),
โ the strategy will open the first position using 300% of account equity.
This rule works as follows:
Whether the first entry happens at the 1st drawdown zone or at the 2nd drawdown zone,
If the current drawdown from ATH is at or below the threshold (e.g. โ72.5% or worse),
โ the strategy interprets this as โa sufficiently deep crashโ and opens the initial position with 300% of equity.
If the drawdown is less severe than the threshold,
โ the first entry is capped at 100% of equity.
So the strategy has two modes for the first entry:
Normal market conditions: 100% of equity
Deep drawdown conditions: 300% of equity
This special rule is intended to be aggressive in extremely deep crashes while staying more conservative in normal corrections.
3. Strategy Logic & Execution
3-1. Entry Conditions
The strategy tracks the ATH using the High price.
For each bar, it calculates the drawdown from ATH.
The user defines two drawdown zones, for example:
1st zone: ATH โ 50%
2nd zone: ATH โ 72.5%
For each zone, the strategy checks:
If no buy has been executed yet for that zone in the current ATH leg, and
If the current barโs Low touches or falls below that zoneโs price level,
โ That bar is considered to have triggered a buy condition.
Order simulation:
The strategy simulates entering a long position at that zoneโs price level
(using a limit/market-like approximation for backtesting).
3-2. ATH Reset & Entry Opportunity Reset
When a new High goes above the previous ATH:
The ATH is updated to this new high.
Internal flags that track whether the 1st and 2nd entries have been used are reset.
This means:
Each time the market makes a new ATH,
The strategy once again has a fresh opportunity to execute 1st and 2nd drawdown entries for that new ATH leg.
4. Position Sizing & Leverage
4-1. Position Size Based on Account Equity
The strategy defines current equity as:
Current Equity = Initial Capital + Realized PnL + Unrealized PnL
For each entry zone, the position value is calculated as follows:
The user inputs:
โWhat % of equity to use at this zoneโ
The strategy:
Multiplies current equity by that percentage
Then multiplies by the strategyโs leverage factor
Thus:
Position Value = Current Equity ร (Zone % / 100) ร Leverage
Finally, this position value is divided by the entry price to determine the actual position size in tokens.
4-2. Exception for the First Position (100% / 300%)
For the very first position (when there is no open position),
the strategy does not use the zone % parameters. Instead, it uses fixed ratios:
Default: Enter the first position with 100% of equity.
If the drawdown from ATH at that moment is greater than or equal to a predefined threshold (e.g. โ72.5% or more)
โ Enter the first position with 300% of equity.
The position value is computed as:
Position Value = Current Equity ร (100% or 300%) ร Leverage
Then it is divided by the entry price to obtain the token quantity.
This rule:
Applies regardless of whether the first entry occurs at the 1st zone or 2nd zone.
Embeds the philosophy:
โIn very deep crashes, go much larger on the first entry; otherwise, stay more conservative.โ
4-3. Tracking Real Leverage
On each bar, the strategy tracks:
The existing position size at the start of the bar
The newly added size (if any) on that bar
When a new entry occurs, it calculates the real leverage at that moment:
Real Leverage = (Position Value / Current Equity)
This is then displayed on the chart as a label, for example:
Lev 2.53x
This makes it easy to see the actual leverage level at each entry point.
5. Visualization & Monitoring
5-1. On-Chart Visual Elements
The strategy plots the following directly on the chart:
ATH Line
The all-time high (based on High) is plotted as an orange line.
Average Entry Price Line
When a position is open, the average entry price of that position is plotted as a yellow line.
Estimated Liquidation Price (Fixed) Line
The strategy detects when the position size changes.
At each size change, it uses the current average entry price and real leverage to compute an approximate liquidation price.
This โfixed liquidation priceโ is then plotted as a red line on the chart.
If there is no position, or if leverage is 1x or lower, the liquidation line is removed.
Entry Markers & Labels
When 1st/2nd entry conditions are met, the strategy:
Marks the entry point on the chart.
Displays labels such as "Buy XX% @ Price" and "Lev XXx",
showing both entry percentage and real leverage at that time.
The label placement is configurable:
Below Bar
Above Bar
At Price
5-2. Information Table (Top-Right Panel)
In the top-right corner of the chart, the strategy displays a summary table of the current account and position status. It typically includes:
Pos Qty (Token)
Absolute size of the current position (in tokens)
Pos Value (USDT)
Market value of the current position (qty ร current price)
Leverage (Now)
Current real leverage (position value / current equity)
DD from ATH (%)
Current drawdown (%) from the latest ATH, based on current price
Avg Entry
Average entry price of the current position
PnL (%)
Unrealized profit/loss (%) of the current position
Max DD (Equity %)
The maximum equity drawdown (MDD) recorded over the entire backtest period
Last Entry Price
Average entry price immediately after the most recent add-on entry
Last Entry Lev
Real leverage at the time of the most recent entry
Liq Price (Fixed)
The fixed estimated liquidation price described above
Return from Start (%)
Total return (%) of equity compared to the initial capital
Through this table, users can quickly grasp:
Current account and position status
Current risk level
Cumulative performance
6. Time Filters & Label Options
6-1. Strategy Date Range Filter
The strategy provides an option to restrict trading to a specific time range.
When โUse Date Rangeโ is enabled:
You can specify start and end timestamps.
The strategy will only execute trades within that range.
When this option is disabled:
The strategy operates over the entire chart history.
6-2. Entry Label Placement
Users can customize where entry/leverage labels are drawn:
Below Bar (Below Bar)
Above Bar (Above Bar)
At the actual price level (At Price)
This allows you to adjust visualization according to personal preference and chart readability.
7. Use Cases & Applications
This strategy is suitable for the following purposes:
Long-term / swing-style re-buy strategies for spot or futures long positions
Testing rule-based strategies that rely on โdrawdown from ATHโ as a main signal
Monitoring account leverage, liquidation price, and MDD when using leverage
Handling situations where, for a given asset:
โEvery time a new ATH is formed,
you want to wait for deep corrections and enter only at specific drawdown zonesโ
It is generally recommended to use this strategy not as a direct plug-and-play live system, but as a tool for:
Strategy idea validation
Risk profile analysis
Parameter exploration to match your personal risk tolerance and style
8. Limitations & Warnings
Backtest results do not guarantee future performance.
They are based on historical data only.
In live markets, additional factors exist:
Liquidity
Slippage
Fee structures
Exchange-specific liquidation rules
Funding fees, etc.
The liquidation price is only an approximate estimate, derived from a simplified formula.
Actual liquidation rules, maintenance margin requirements, fees, and other details differ by exchange.
The liquidation line should be treated as a reference indicator, not an exact guarantee.
Depending on the configured leverage and entry percentages, losses can be very large.
In particular, extremely aggressive settings such as โfirst position 300% of equityโ can greatly increase the risk of large account drawdowns and liquidation during sharp market crashes.
Use such settings with extreme caution.
For live trading, additional risk management is essential:
Your own stop-loss rules
Maximum position size limits
Portfolio-level exposure controls
And other external safety mechanisms beyond this strategy
9. Conclusion
The ATH Drawdown Re-Buy Long Only strategy goes beyond simple โbuy the dipโ logic. It:
Systematically utilizes drawdowns from ATH as a structural signal
Applies a special first-position rule (100% / 300%)
Integrates visualization of leverage, liquidation price, MDD, and returns
All of this supports rule-based long position building in drawdown phases and comprehensive risk monitoring.
With this strategy, users can:
Explore different:
Drawdown zones
Entry percentages
Leverage levels
Run various backtests and scenario analyses
Better understand the risk/return profile that fits their own market view and risk tolerance
Once again, this strategy is intended for research, learning, and backtesting only.
All real trading decisions and their consequences are solely the responsibility of the user.
Trend Entry_0 [TS_Indie]Trend Entry_0 โ Mechanism Overview
The core structure of this strategy is based on a price action reversal pattern, as detailed below:
In the case of a Bullish Trend Reversal:
The price initially moves in a bearish direction. When candle A forms a low lower than the previous low, the high of candle A becomes a key reference point.โจIf the next candle closes above the high of candle A , it confirms a Bullish Trend Reversal.
* Upon a Bullish signal, a Long position is opened at the opening price of the next candle (candle B).
* When a subsequent Bearish signal occurs, the Long position is closed at the opening price of the next candle (candle C).
In the case of a Bearish Trend Reversal:
The price initially moves in a bullish direction. When candle A forms a high higher than the previous high, the low of candle A becomes a key reference point.โจIf the next candle closes below the low of candle A , it confirms a Bearish Trend Reversal.
* Upon a Bearish signal, a Short position is opened at the opening price of the next candle (candle B).
* When a subsequent Bullish signal occurs, the Short position is closed at the opening price of the next candle (candle C).
Options
* The start and end dates of the backtest can be customized.
* The swing lines of the trend can be displayed as an optional visual aid.
* The user can choose whether to open only Long or Short positions.
Backtest Results and Observations
Based on the backtesting results of this strategy across various assets and timeframes, it has been observed that this approach works best on trending assets such as Gold, BTC, and stocks.โจIt also performs well on higher timeframes, starting from the Daily timeframe and above, especially when taking Long positions only. โจ
However, when applied to currency pairs such as EUR/USD, the results tend to be less impressive.
I encourage everyone to try backtesting and further developing this strategy โ adding new conditions or filters may potentially lead to improved performance.
Disclaimer
This script is intended solely for backtesting purposes, based on a particular price action pattern.โจIt does not constitute financial or investment advice.โจBacktest results do not guarantee future performance.
Adaptive Trend 1m ### Overview
The "Adaptive Trend Impulse Parallel SL/TP 1m Realistic" strategy is a sophisticated trading system designed specifically for high-volatility markets like cryptocurrencies on 1-minute timeframes. It combines trend-following with momentum filters and adaptive parameters to dynamically adjust to market conditions, ensuring more reliable entries and risk management. This strategy uses SuperTrend for primary trend detection, enhanced by MACD, RSI, Bollinger Bands, and optional volume spikes. It incorporates parallel stop-loss (SL) and multiple take-profit (TP) levels based on ATR, with options for breakeven and trailing stops after the first TP. Optimized for realistic backtesting on short timeframes, it avoids over-optimization by adapting indicators to market speed and efficiency.
### Principles of Operation
The strategy operates on the principle of adaptive impulse trading, where entry signals are generated only when multiple conditions align to confirm a strong trend reversal or continuation:
1. **Trend Detection (SuperTrend)**: The core signal comes from an adaptive SuperTrend indicator. It calculates upper and lower bands using ATR (Average True Range) with dynamic periods and multipliers. A buy signal occurs when the price crosses above the lower band (from a downtrend), and a sell signal when it crosses below the upper band (from an uptrend). Adaptation is based on Rate of Change (ROC) to measure market speed, shortening periods in fast markets for quicker responses.
2. **Momentum and Trend Filters**:
- **MACD**: Uses adaptive fast and slow lengths. In "Trend Filter" mode (default when "Use MACD Cross" is false), it checks if the MACD line is above/below the signal for long/short. In cross mode, it requires a crossover/crossunder.
- **RSI**: Adaptive period RSI must be above 50 for longs and below 50 for shorts, confirming overbought/oversold conditions dynamically.
- **Bollinger Bands (BB)**: Depending on the mode ("Midline" by default), it requires the price to be above/below the BB midline for longs/shorts, or a breakout in "Breakout" mode. Deviation adapts to market efficiency.
- **Volume Spike Filter** (optional): Entries require volume to exceed an adaptive multiple of its SMA, signaling strong impulse.
3. **Volatility Filter**: Entries are only allowed if current ATR percentage exceeds a historical minimum (adaptive), preventing trades in low-volatility ranges.
4. **Risk Management (Parallel SL/TP)**:
- **Stop-Loss**: Set at an adaptive ATR multiple below/above entry for long/short.
- **Take-Profits**: Three levels at adaptive ATR multiples, with partial position closures (e.g., 51% at TP1, 25% at TP2, remainder at TP3).
- **Post-TP1 Features**: Optional breakeven moves SL to entry after TP1. Trailing SL uses BB midline as a dynamic trail.
- All levels are calculated per trade using the ATR at entry, making them "realistic" for 1m charts by widening SL and tightening initial TPs.
The strategy enters long on buy signals with all filters met, and short on sell signals. It uses pyramid margin (100% long/short) for full position sizing.
Adaptation is driven by:
- **Market Speed (normSpeed)**: Based on ROC, tightens multipliers in volatile periods.
- **Efficiency Ratio (ER)**: Measures trend strength, adjusting periods for trending vs. ranging markets.
This ensures the strategy "adapts" without manual tweaks, reducing false signals in varying conditions.
### Main Advantages
- **Adaptability**: Unlike static strategies, parameters dynamically adjust to market volatility and trend strength, improving performance across ranging and trending phases without over-optimization.
- **Realistic Risk Management for 1m**: Wider SL and tiered TPs prevent premature stops in noisy short-term charts, while partial profits lock in gains early. Breakeven/trailing options protect profits in extended moves.
- **Multi-Filter Confirmation**: Combines trend, momentum, and volume for high-probability entries, reducing whipsaws. The volatility filter avoids flat markets.
- **Debug Visualization**: Built-in plots for signals, levels, and component checks (when "Show Debug" is enabled) help users verify logic on charts.
- **Efficiency**: Low computational load, suitable for real-time trading on TradingView with alerts.
Backtesting shows robust results on volatile assets, with a focus on sustainable risk (e.g., SL at 3x ATR avoids excessive drawdowns).
### Uniqueness
What sets this strategy apart is its **fully adaptive framework** integrating multiple indicators with real-time market metrics (ROC for speed, ER for efficiency). Most trend strategies use fixed parameters, leading to poor adaptation; here, every key input (periods, multipliers, deviations) scales dynamically within bounds, creating a "self-tuning" system. The "parallel SL/TP with 1m realism" adds custom handling for micro-timeframes: tightened initial TPs for quick wins and adaptive min-ATR filter to skip low-vol bars. Unlike generic mashups, it justifies the combinationโSuperTrend for trend, MACD/RSI/BB for impulse confirmation, volume for convictionโworking synergistically to capture "trend impulses" while filtering noise. The post-TP1 breakeven/trailing tied to BB adds a unique profit-locking mechanism not common in open-source scripts.
### Recommended Settings
These settings are optimized and recommended for trading ASTER/USDT on Bybit, with 1-minute chart, x10 leverage, and cross margin mode. They provide a balanced risk-reward for this volatile pair:
- **Base Inputs**:
- Base ATR Period: 10
- Base SuperTrend ATR Multiplier: 2.5
- Base MACD Fast: 8
- Base MACD Slow: 17
- Base MACD Signal: 6
- Base RSI Period: 9
- Base Bollinger Period: 12
- Bollinger Deviation: 1.8
- Base Volume SMA Period: 19
- Base Volume Spike Multiplier: 1.8
- Adaptation Window: 54
- ROC Length: 10
- **TP/SL Settings**:
- Use Stop Loss: True
- Base SL Multiplier (ATR): 3
- Use Take Profits: True
- Base TP1 Multiplier (ATR): 5.5
- Base TP2 Multiplier (ATR): 10.5
- Base TP3 Multiplier (ATR): 19
- TP1 % Position: 51
- TP2 % Position: 25
- Breakeven after TP1: False
- Trailing SL after TP1: False
- Base Min ATR Filter: 0.001
- Use Volume Spike Filter: True
- BB Condition: Midline
- Use MACD Cross (false=Trend Filter): True
- Show Debug: True
For backtesting, use initial capital of 30 USD, base currency USDT, order size 100 USDT, pyramiding 1, commission 0.1%, slippage 0 ticks, long/short margin 0%.
Always backtest on your platform and use risk managementโrisk no more than 1-2% per trade. This is not financial advice; trade at your own risk.






















