VSA Simplified (Volume Spread Analysis)This indicator implements a simplified version of Volume Spread Analysis (VSA) to help traders identify key volume-based signals used by professional market participants.
It detects classic VSA patterns such as:
Climactic Volume: unusually high volume with wide price spread indicating potential buying/selling climax
No Demand / No Supply: low volume and small spreads signaling lack of interest or exhaustion
Stopping Volume: high volume with long wicks and neutral closes showing absorption or rejection
The indicator plots distinct shapes on the chart to highlight these conditions, assisting traders to read market intent and potential turning points.
Best used alongside market structure and support/resistance zones for confluence.
Padrões gráficos
Abnormal Volume DetectorAbnormal Volume Detector highlights volume spikes that exceed a moving average by a user-defined factor. It helps traders quickly identify moments of unusual activity that often precede significant price movement.
🔍 How it works:
Calculates a simple moving average (SMA) of volume.
Flags any candle where the current volume exceeds SMA × multiplier.
Visually plots spikes with a triangle under the candle.
Optional background highlight for strong alerts.
✅ Great for:
Spotting breakout attempts
Identifying news-driven volume surges
Filtering signals in momentum strategies
Customizable and lightweight — perfect for intraday or swing traders looking to add volume context to their analysis.
ORBIT🚀 Sndey ORBIT Strategy
(ORB Intraday Tactic for Indian Markets — 5-min Compatible)
by @sndey
🔹 Overview
Sndey ORBIT is a 5-minute Opening Range Breakout (ORB) intraday strategy tailored for the Indian stock market (NSE/BSE). It captures early market momentum with synced Stoploss, Profit Target, and optional Trailing Stoploss, making it ideal for disciplined intraday traders.
🔹 Why “ORBIT”?
ORBIT stands for:
Opening
Range
Breakout
Intraday
Tactic
Like a rocket breaking past gravity, this strategy aims to catch strong price moves that escape the morning consolidation range.
🔹 How It Works
Timeframe: Optimized for 5-minute charts
ORB Range: 9:15–9:30 AM IST (first 15 mins of Indian market)
Entry:
🔼 Buy: Breakout above ORB High
🔽 Sell: Breakdown below ORB Low
Exit:
On hitting Stoploss, Target, or Trailing SL
Fully automated trade reset logic
🔹 Features
✅ Auto-calculated SL & TP based on user-defined Risk %
✅ Optional Trailing Stoploss
✅ Smart daily reset
✅ Visual plots for ORB High/Low, SL, TP
✅ Clear Buy/Sell/Exit signals
✅ Alert-ready for automation or manual execution
🔹 Notes
Designed for Indian traders (works best on NSE/BSE equities and indices like NIFTY, BANKNIFTY)
Use with liquid instruments for reliable breakout behavior
Meant for intraday use only
📌 Important
Test thoroughly using TradingView’s strategy tester and paper trading before deploying with real capital. Adjust Risk % according to your personal risk profile.
Built with precision. Traded with discipline.
Happy Trading!
– @sndey
Failed 2U/2D + 50% Retrace ScannerScan Number 1 for SPY,SPX, QQQ, AAPL
📈 Multi-Ticker Failed 2U/2D Scanner with Daily Retrace & Market Breadth Table
This TradingView indicator is a multi-symbol price action scanner designed to catch high-probability reversal signals using The Strat’s failed 2U/2D patterns and daily 50% retrace logic, while also displaying market breadth metrics ( USI:TICK and USI:ADD ) for context.
Monitored Symbols:
SPY, SPX, QQQ, IWM, NVDA, AMD, AAPL, META, MSTR
🔍 Detection Logic
1. Failed 2U / Failed 2D Setups
Failed 2U: Price breaks above the previous candle’s high but closes back below the open → Bearish reversal
Failed 2D: Price breaks below the previous candle’s low but closes back above the open → Bullish reversal
Timeframes Monitored:
🕐 1-Hour (1H)
⏰ 4-Hour (4H)
2. Daily 50% Candle Retrace
Checks if price has retraced 50% or more of the previous day’s candle body
Highlights potential trend exhaustion or reversal confluence
3. Market Breadth Metrics (Display Only)
USI:TICK : Measures real-time NYSE up vs. down ticks
USI:ADD : Advance-Decline Line (net advancing stocks)
Not used in signal logic — just displayed in the table for overall market context
🖼️ Visual Elements
✅ Chart Markers
🔺 Red/Green Arrows for 1H Failed 2U/2D
🟨 Yellow Squares for 4H Failed 2U/2D
Visual markers are plotted directly on the relevant candles
📊 Signal Table
Lists all 9 tickers in rows
Columns for:
1H Signal
4H Signal
Daily 50% Retrace
USI:TICK Value
USI:ADD Value
Color-Coded Cells:
🔴 Red = Failed 2U
🟢 Green = Failed 2D
⚠️ Highlight if 50% Daily Retrace condition is true
🟦 Neutral-colored cells for TICK/ADD numeric display
🔔 Alerts
Hardcoded alerts fire when:
A 1H or 4H Failed 2U/2D is detected
The Daily 50% retrace condition is met
Each alert is labeled clearly by symbol and timeframe:
"SPY 4H Failed 2D"
"AAPL Daily 50% Retrace"
🎯 Use Case
Built for:
Reversal traders using The Strat
Swing or intraday traders watching hourly setups
Traders wanting quick visual context on market breadth without relying on it for confirmation
Monitoring multiple tickers in one clean view
1h can be used for Intraday trades
4h for possible short swing
Do your own ta
Wassim's Strat v2 (Full Auto: FVG + Asia + Fibo Zones + Alerts)This strat is from wassim where we use fvg retests as an entry and the fvg we find in discount or premium prices
SMA 200 close
The simple moving average is used to forecast demand. Therefore, demand data from previous periods can be used to estimate the next period using the simple moving average. We'll see how this is done below.
Mark specific candle (e.g. bar 20)This Pine Script indicator, "Mark specific candle (e.g. bar 20)" (short title "Mark candle"), is a simple yet powerful tool to visually highlight a particular candle on your chart.
What it does:
It marks a specific candle (e.g., the 20th, 10th, or any number you choose) counting backwards from the most recent candle on your chart. The marked candle will be colored in a subtle light grey and also feature a tiny, matching grey arrow pointing down from above it.
Why it's useful:
This indicator helps you quickly identify and track a consistent reference point in recent price action. It's great for strategies that depend on fixed look-back periods or for simply keeping an eye on a specific historical candle's position as new data comes in.
Key Features:
Adjustable Candle Number: Easily change which candle is marked (e.g., 20th, 10th, 5th) directly from the indicator settings using the "Candle Number to Mark (from end)" input.
Clear Visuals: Both the candle color and a small arrow provide a subtle, yet effective, visual cue.
How to use:
Simply add this script to your TradingView chart. Then, open the indicator's settings to set your desired candle number.
Fib-SMAs + 23↘38 Signal🧠 Fibonacci SMAs — and the Bearish Power of the 23↘38 Cross
This script plots a ribbon of 5 Simple Moving Averages (SMAs), each derived from Fibonacci retracement ratios:
23.6%, 38.2%, 50%, 61.8%, and 78.6% — all calculated as percentages of a base length (default: 100 bars).
It transforms the classical Fibonacci concept from static price levels into a dynamic trend structure based on time.
🔍 The Pattern I Discovered
When studying the Daily BTC chart, I found a powerful recurring signal:
When the 23.6% SMA (fuchsia) crosses below the 38.2% SMA (teal),
Bitcoin tends to pull back significantly in the following weeks.
This signal, which I call the 23↘38 cross, shows up at:
Major market tops
Bull market pauses
Local overextensions during trend runs
In backtested cases since 2014, this cross preceded corrections of 8–35%, usually playing out over the following 10–40 days.
⚠️ What’s Happening Now?
A fresh 23↘38 bearish cross has just occurred on the Daily BTC chart.
Historically, these setups often result in BTC pulling back into the zone where the 61.8% and 78.6% SMAs act as mean reversion targets.
That puts the next major support zone in the range of $94.5k to $79k — highlighted automatically on the chart when the signal appears.
💡 Why Use Fibonacci for Time?
Fibonacci levels (0.236, 0.382, 0.618...) are traditionally used on the price axis.
This tool flips that idea: it applies Fibonacci ratios to the time axis — calculating SMAs that reflect natural market timing rhythms, not just support/resistance lines.
The result is a ribbon of rhythm, where each line represents a unique retracement of time-based momentum.
🧰 Features Included
Besides the core 23↘38 bearish signal, the script includes optional toggleable modules:
Name Description
Ribbon Flip-and-Go Detects full bullish or bearish alignment and trend ignition
Pinch Breakout Flags volatility compression followed by expansion
Deep-Dip Buy/Sell Finds smart pullbacks in ongoing trends using the 61.8% SMA
Each one includes alertcondition() support, so you can automate strategies or trading bots.
🧭 How to Trade It
Use the 23↘38 cross as an early warning to:
Secure profits
De-risk exposure
Watch for pullbacks to the slower SMAs (61.8% / 78.6%)
It’s not a short signal by itself, but a macro timing filter that consistently front-runs volatility drops in overheated markets.
📉 Historical Examples (BTC 1D)
Nov 2021 top → -35% drop
April 2022 rally → -28% retracement
Mid-2023 local high → -15% correction
June 2025 cross → current signal, target zone: 94.5k–79k
⚠️ Disclaimer
This is not financial advice. It’s a tool for studying probability patterns in price action.
Use it alongside proper risk management and market context.
Last Candle Std Dev BandsSTandard deviation candles, very basic not much, can build into a larger mean reversion strategy
SMA 50 closeThe simple moving average is used to forecast demand. Therefore, demand data from previous periods can be used to estimate the next period using the simple moving average. We'll see how this is done below.
Weekly Day & Morning Session HighlighterThis is my Market Maker Method Daily Chart.
This paints red columns on the Weekends to remind you that Market Makers aren't active and anything can happen.
Each day of the week shows a different color to demonstrate the start and end of the day to more easily track patterns.
The black bar is the early morning setup period which typically results in an initial liquidity hunt fake out before a quick reversal.
This indicator is a work in progress inspired by TradeTravelChill.com
- Crypto Crow
MSTR vs BTCUSD % Movement ComparisonThe indicator, in its current form, is a custom Pine Script (version 6) tool named "MSTR vs BTCUSD % Movement Comparison" that visually compares the percentage price movements of MicroStrategy (MSTR) and Bitcoin (BTCUSD) over a user-defined lookback period. It plots the difference in their percentage changes (diff_pct = mstr_pct - btcusd_pct) as a line, with a zero line for reference, and uses green/red coloring to indicate whether MSTR is outperforming (green, above zero) or underperforming (red, below zero) BTCUSD. The area between the difference line and zero line is filled with semi-transparent green or red for clarity. Additionally, an adjustable-period Exponential Moving Average (EMA) of the percentage difference smooths the trend, helping identify momentum shifts. The indicator is fixed to compare MSTR and BTCUSD, ensuring consistent output regardless of the chart’s active symbol (e.g., MSTR, MTPLF, or others).
Key Features:
Percentage Difference: Shows MSTR’s percentage change minus BTCUSD’s, highlighting relative performance.
Zero Line: A gray solid line at 0 for reference.
Color Coding: Green line/fill when MSTR outperforms, red when it underperforms.
Adjustable EMA: User-defined EMA period (default: 26) smooths the percentage difference.
Fixed Comparison: Always compares MSTR vs. BTCUSD, unaffected by the chart’s symbol.
User Inputs: Lookback period (default: 50 bars) and EMA period (default: 26) are customizable.
Example: On a 1-hour chart, if MSTR rises 4% and BTCUSD rises 1% over 50 bars, the difference line plots at +3 (green) with green fill, and the 26-period EMA might be at +2.2, indicating MSTR’s outperformance trend.
🔔 Open Range Breakout Pro – Dashed Line FixedOpen Range Breakout Pro – Midpoint + Alerts
This advanced indicator captures the first 5-minute open range after the session begins and unlocks powerful intraday levels based on that structure. It’s ideal for traders looking to trade range breakouts, mean reversion, or high-volume trend confirmations.
🔍 What it does:
Locks in the first 5-min candle high/low after market open
Plots the upside and downside targets
Dynamically shows the range midpoint
Optional extension levels at 1.5x and 2x the opening range
Highlights breakouts with conditional background colors
Includes volume confirmation toggle to filter weak moves
Auto-resets daily for clean reinitialization
Compatible with stocks, futures, and crypto
🛎️ Built-in Alerts:
📈 Price crosses above high
📉 Price crosses below low
🔁 Price returns into the range
📦 Fully customizable and optimized for both discretionary and alert-based trading systems.
Failed 2U/2D + 50% Retrace Scanner📈 Multi-Ticker Failed 2U/2D Scanner with Daily Retrace & Market Breadth Table
This TradingView indicator is a multi-symbol price action scanner designed to catch high-probability reversal signals using The Strat’s failed 2U/2D patterns and daily 50% retrace logic, while also displaying market breadth metrics ( USI:TICK and USI:ADD ) for context.
Monitored Symbols:
SPY, SPX, QQQ, IWM, NVDA, AMD, AAPL, META, MSTR
🔍 Detection Logic
1. Failed 2U / Failed 2D Setups
Failed 2U: Price breaks above the previous candle’s high but closes back below the open → Bearish reversal
Failed 2D: Price breaks below the previous candle’s low but closes back above the open → Bullish reversal
Timeframes Monitored:
🕐 1-Hour (1H)
⏰ 4-Hour (4H)
2. Daily 50% Candle Retrace
Checks if price has retraced 50% or more of the previous day’s candle body
Highlights potential trend exhaustion or reversal confluence
3. Market Breadth Metrics (Display Only)
USI:TICK : Measures real-time NYSE up vs. down ticks
USI:ADD : Advance-Decline Line (net advancing stocks)
Not used in signal logic — just displayed in the table for overall market context
🖼️ Visual Elements
✅ Chart Markers
🔺 Red/Green Arrows for 1H Failed 2U/2D
🟨 Yellow Squares for 4H Failed 2U/2D
Visual markers are plotted directly on the relevant candles
📊 Signal Table
Lists all 9 tickers in rows
Columns for:
1H Signal
4H Signal
Daily 50% Retrace
USI:TICK Value
USI:ADD Value
Color-Coded Cells:
🔴 Red = Failed 2U
🟢 Green = Failed 2D
⚠️ Highlight if 50% Daily Retrace condition is true
🟦 Neutral-colored cells for TICK/ADD numeric display
🔔 Alerts
Hardcoded alerts fire when:
A 1H or 4H Failed 2U/2D is detected
The Daily 50% retrace condition is met
Each alert is labeled clearly by symbol and timeframe:
"META 4H Failed 2D"
"AAPL Daily 50% Retrace"
🎯 Use Case
Built for:
Reversal traders using The Strat
Swing or intraday traders watching hourly setups
Traders wanting quick visual context on market breadth without relying on it for confirmation
Monitoring multiple tickers in one clean view
This is scan 2
Add scan 1 for spx, spy, iwm, qqq, aapl
This indicator is not financial advice. Use the alerts to check out chart and when tickers trigger.
XRP Alert Strategy - 3X CycleBottom Watch → $1.60 and $1.50 triggers
Reversal Signals → RSI breakout & EMA crossover
Profit Zone Targets → $3.00 and $4.50 levels
(Optional): Volume spike logic for top signal
Previous Daily OHLCPrevious Daily OHLC Indicator
Overview:
This professional TradingView indicator displays the previous day's key price levels (Open, High, Low, Close, and 50% midpoint) as horizontal lines on your chart. These levels are essential for traders who use previous day data as support and resistance zones in their technical analysis.
What It Does
Displays Previous Day Levels: Automatically shows horizontal lines for yesterday's OHLC data
Real-Time Updates: Lines update dynamically each new trading day
Fully Customizable: Complete control over which levels to display and how they appear
Smart Line Management: Choose between showing lines for recent bars or across the entire chart
Professional Labels: Clear labels with optional price values for each level
Color Coded System: Distinct colors for each level type for instant recognition
Key Features
Five Important Price Levels
Previous Day Open: Yesterday's opening price - often acts as psychological level
Previous Day High: Yesterday's highest price - key resistance level for breakout trading
Previous Day Low: Yesterday's lowest price - important support level for breakdowns
Previous Day Close: Yesterday's closing price - significant reference point
50% Midpoint: Calculated midpoint between previous day's high and low - bias indicator
SMA 20 closeThe simple moving average is used to forecast demand. Therefore, demand data from previous periods can be used to estimate the next period using the simple moving average. We'll see how this is done below.
previous day H/L 15 minThis indicator visualizes critical daily price levels to support intraday and swing trading decisions. Specifically, it calculates and displays the Previous Day High (PDH), Previous Day Low (PDL), and the midpoint (PDM) — the average of the high and low — based on price data from the prior trading day.
Each level line is anchored to start precisely at 6 PM New York time, marking the start of the trading day for many major markets. The lines then extend forward for a fixed duration, ensuring these key support and resistance zones remain visible well into the current trading session, giving traders a persistent frame of reference.
This persistent extension helps traders monitor price interaction with important levels throughout the day without cluttering the chart with obsolete lines. Labels indicating PDH, PDL, and PDM are displayed clearly on the left or right side of the chart, customizable to user preference.
By using this indicator, traders can better gauge potential reversal points, breakout zones, and price consolidation areas grounded on significant daily market structure, improving timing and risk management in their trading strategies.
Indicador de Trading AvançadoIndicator for trading operations in Forex, cryptocurrencies, stocks and indices of the dollar and the Brazilian stock exchange, such as the mini index (b3) in the M1, M2, M3, M5, M15, M30 and D1 fractals.
This indicator sends signals in the form of a buy and sell arrow to the TradingViev analysis platform. Green for buy and red for sell. Enter the name "BUY" for buy operations and "SELL" for sell operations.
Its function is to be used in situations of breakout, reversal and retraction of structures and for each time fractal, mentioned above.
It should always prioritize the macro and micro trend (Support and Resistance, Prior Cut Adjustment, Automatic Volume Profile among others, aiming for the best possible confluence. The objective is 85% assertiveness.
This indicator uses the combination of trend, momentum, volatility, price logic, price action and SMC indicators.
This indicator aims to provide the command to operate in the direction of the next arrow-shaped candlestick .
Nenhum indicador substituirá o seu conhecimento. Utilize-o como confluência para seu operacional!
Failed 2U/2D + 50% Retrace Scannerbeta.. Failed 2u and 2d on the 1h and 4h
with tick and add for guidance on overall market
[alert-custome] direction-ema-dca-rsi-security
Below is a detailed description of the Pine Script v5 strategy titled direction-ema-dca-rsi-security. This strategy automates Long or Short trading on cryptocurrency pairs (e.g., BTCUSDT.P), leveraging technical indicators such as EMA, RSI, and ATR, combined with a Dollar Cost Averaging (DCA) approach. It integrates with OKX via alerts for automated trading execution.
Overview
Strategy Name: direction-ema-dca-rsi-security
Objective: Automate Long or Short trades using EMA, RSI, and ATR signals, with DCA to improve average position price when the market moves against the position. The strategy allows customization of trade direction (Long or Short) and integrates with OKX for automated execution.
Type: Supports both Long and Short trades, using leverage and flexible capital management.
Target Market: Designed for high-volatility cryptocurrency markets, particularly perpetual futures pairs like BTCUSDT.P.
Key Features:
Uses Fast and Slow EMAs to identify trends and entry points.
Combines RSI from the current timeframe and a user-defined timeframe (security RSI) to detect overbought/oversold conditions.
Implements DCA to add to positions when prices move unfavorably.
Integrates with OKX via JSON alerts for automated trading.
Supports Take Profit (TP) and Stop Loss (SL) based on ATR or percentage values.
Structure and Key Components
1. Strategy Configuration
Basic Settings:
Initial Capital: $1,000.
Leverage: Default 6x, adjustable from 1x to 10x.
Order Type: Cash-based, with a default quantity of 10.
Commission: 0.1% per trade.
Pyramiding: Allows up to 100 concurrent orders.
Slippage: 3 pips.
Backtest Fill Limits Assumption: 3 pips, ensuring limit orders are filled within a price range.
Calculate on Order Fills: Enabled (calc_on_order_fills = true).
Use Bar Magnifier: Enabled for detailed candle data calculations.
Fill Orders on Standard OHLC: Enabled, ensuring orders match standard open, high, low, close prices.
2. Input Parameters
The strategy offers customizable inputs, grouped as follows:
Strategy:
Fast/Slow EMA Length: Fast EMA (default 9), Slow EMA (default 21) for trend detection.
ATR Length: Default 14 for volatility measurement.
RSI Length: Default 14 for overbought/oversold detection.
RSI Security Timeframe: Default 15 minutes (options: 5m, 15m, 30m, 1h, 4h, D, W, M).
Direction Security Timeframe: Default daily (options: 4h, D, W, M).
Strategy Size:
Init Webhook Balance ($): Initial balance for webhook (default 0, uses strategy balance if unset).
Leverage: Financial leverage (default 6x).
Init Size Equity (%): Initial position size as a percentage of equity (default 2%).
Size Increase (%): Position size increase per DCA order (default 15%).
Max DCA Orders: Maximum DCA orders (default 15).
Strategy DCA:
Init Percent to DCA (%): Initial price drop/rise for DCA (default 2%).
Increase Step Percent to DCA (%): Incremental DCA price adjustment (default 1%).
Decrease DCA with ATR: ATR multiplier for DCA price (default 0, disabled).
Strategy DCA RSI:
RSI to DCA: RSI threshold for DCA (default 50, below for Long, above for Short).
Security RSI to DCA: RSI threshold for security timeframe (default 50).
Strategy Delay:
Off-Time Delays / Order (s): Delay between orders (default 1000 seconds).
Off-Time Active Stop Loss (Hour): Delay for activating Stop Loss (default 0, disabled).
Strategy TPSL (Take Profit/Stop Loss):
ATR Multiplier TP: ATR multiplier for Take Profit (default 2x).
Init TP (%): Initial Take Profit percentage (default 2%).
ATR Multiplier SL: ATR multiplier for Stop Loss (default 0, disabled).
Init SL (%): Initial Stop Loss percentage (default 0%, disabled).
Strategy Direction:
Trade Direction: Trade direction (default Long, options: Long, Short).
Strategy OKX:
OKX Signal Key: Signal key for OKX API integration.
3. Market Data
Technical Indicators:
EMA: Fast EMA (9) and Slow EMA (21) on the current timeframe for trend identification.
RSI: RSI (14) on the current timeframe and a user-defined timeframe (rsiSecurityTimeframe) for overbought/oversold signals.
ATR: ATR (14) for volatility-based calculations of TP, SL, and DCA prices.
External Library: Uses jason5480/chrono_utils/6 for time-related functions.
4. Entry Conditions
Long Position:
Condition 1: Fast EMA crosses above Slow EMA (ta.crossover(fastMA, slowMA)), or
Condition 2: RSI ≤ rsiTrigger (default 50), Fast EMA ≤ Slow EMA, and RSI security ≤ rsiSecurityTrigger (default 50).
Short Position:
Condition 1: Fast EMA crosses below Slow EMA (ta.crossunder(fastMA, slowMA)), or
Condition 2: RSI ≥ rsiTrigger, Fast EMA ≥ Slow EMA, and RSI security ≥ rsiSecurityTrigger.
Constraints:
Entries are allowed only if tradeDirection matches the signal (Long or Short).
Open trades ≤ maxDCAOrders (default 15).
Current price meets DCA conditions (if positions exist).
Time since last order ≥ offTimeMsOpen (default 1000 seconds).
5. Dollar Cost Averaging (DCA)
DCA Conditions:
Long: Current price ≤ DCA price, calculated as:
strategy.position_avg_price - (atrValue * decreaseDCAWithATR), or
strategy.position_avg_price * (1 - currentUnderPercentDCA) (default 2%, increasing by 1% per DCA).
Short: Current price ≥ DCA price, calculated similarly but for price increases.
DCA Management:
Position size increases by 15% per DCA (stepSizePercent).
DCA price distance increases by 1% per order (stepDecreasePercentDCA).
Maximum 15 DCA orders (maxDCAOrders).
6. Position Management
Position Size:
Initial size: 2% of equity (initSizeEquity).
Increases by 15% per DCA order.
Limited by leverage and current balance (currentBalance).
Current Balance:
If webhookInitBalance = 0, uses initial_capital + netprofit + openprofit.
If webhookInitBalance > 0, uses this value plus net and open profits.
Order Delay: Ensures a minimum gap of 1000 seconds between orders (offTimeMsOpen).
7. Exit Conditions
Take Profit (TP):
Long: strategy.position_avg_price + (atrValue * atrMultiplierTP) (default 2x ATR), or strategy.position_avg_price * (1 + initTP) (default 2%).
Short: strategy.position_avg_price - (atrValue * atrMultiplierTP), or strategy.position_avg_price * (1 - initTP).
Stop Loss (SL):
Long: strategy.position_avg_price - (atrValue * atrMultiplierSL), or strategy.position_avg_price * (1 - initSL).
Short: strategy.position_avg_price + (atrValue * atrMultiplierSL), or strategy.position_avg_price * (1 + initSL).
Currently, atrMultiplierSL and initSL = 0, meaning Stop Loss is disabled.
Exit Execution:
Uses strategy.order for Long TP and strategy.exit for Short TP, closing the entire position when TP is reached.
Sends OKX alerts for exits (EXIT_LONG or EXIT_SHORT).
8. Visualization
Plots:
Fast EMA: Red.
Slow EMA: Aqua.
Take Profit Price: Lime.
Position Average Price: Gray.
Background Color: Commented out, but can display green for Long or red for Short.
9. OKX Integration
Alerts:
Sends JSON alerts for entries (ENTER_LONG, ENTER_SHORT) and exits (EXIT_LONG, EXIT_SHORT), including:
Market position, size, order type (market), and investment percentage.
OKX signal key (okxSignalKeyInput) for API integration.
How the Strategy Works
Market Analysis:
Uses EMA (9, 21) for trend detection (crossover/crossunder).
Combines RSI from the current and security timeframes to confirm overbought/oversold conditions.
ATR measures volatility for TP, SL, and DCA price calculations.
Entry:
Long: Triggers on EMA crossover or RSI in oversold territory with a bearish trend.
Short: Triggers on EMA crossunder or RSI in overbought territory with a bullish trend.
Entries are restricted by tradeDirection setting.
DCA:
Adds positions when price moves against the trade (down for Long, up for Short) based on RSI or ATR conditions.
Increases position size and DCA price distance per order.
Exit:
Closes positions when price hits TP (ATR or percentage-based).
Stop Loss is currently disabled, posing a risk.
Risk Management:
Limits DCA orders to 15.
Enforces time delays between orders.
Caps leverage at 10x.
Strengths
Flexible Direction: Supports both Long and Short trades.
Effective DCA: Improves average position price in volatile markets.
OKX Integration: Automates trading via OKX API.
Multi-Timeframe Analysis: Uses RSI from a secondary timeframe for confirmation.
Customizable Capital Management: Adjustable position sizes and leverage.
Weaknesses
No Stop Loss: Disabled SL increases risk of large losses.
OKX Dependency: Requires accurate API configuration.
Simple Conditions: Relies primarily on EMA and RSI, potentially lacking depth.
Fixed Timeframes: Commented-out EMA security logic limits trend analysis flexibility.
Practical Applications
Target Market: High-volatility crypto markets, especially perpetual futures like BTCUSDT.P.
Trading Style: Suitable for short- to medium-term traders using DCA for risk management.
Optimization: Adjust fastMALen, slowMALen, rsiTrigger, or maxDCAOrders for specific markets.
Improvement Suggestions
Enable Stop Loss: Set atrMultiplierSL or initSL > 0 to protect capital.
Use EMA Security: Uncomment fastDirectionEMA and slowDirectionEMA code to enhance trend accuracy.
Optimize Parameters: Use TradingView’s optimization tool to fine-tune rsiTrigger, atrMultiplierTP, or maxDCAOrders.
Add Indicators: Incorporate Volume, ADX, or other indicators for robust entry signals.
Leverage Alerts: Add warnings for high-leverage risks in volatile conditions.
If you need further analysis, code optimization, or additional strategy development, let me know!