BB + RSI Strategy Optimized✅ Pine Script Version 5
✅ Complete Strategy: Long + Short
✅ Automatic Entry and Exit
✅ Visual Signals: Buy/Sell, Short/Cover
✅ Trailing Take Profit
✅ Progressive
Indicators and strategies
MVO - MA Signal StrategyStrategy Description: MA Signal Strategy with Heikin Ashi, Break-even and Trailing Stop
⸻
🔍 Core Concept
This strategy enters long or short trades based on Heikin Ashi candles crossing above or below a moving average (MA), with optional confirmation from the Money Flow Index (MFI). It includes:
• Dynamic stop loss and take profit levels based on ATR
• Optional break-even stop adjustment
• Optional trailing stop activation after breakeven
• Full visual feedback for trades and zones
⸻
⚙️ Indicators Used
• Heikin Ashi Candles: Smooth price action to reduce noise.
• Simple Moving Average (MA): Determines trend direction.
• Average True Range (ATR): Sets volatility-based SL/TP.
• Money Flow Index (MFI): Optional momentum filter for entries.
⸻
📈 Trade Entry Logic
✅ Long Entry:
Triggered if:
• Heikin Ashi close crosses above the MA
or
• MFI is below 20 and Heikin Ashi close is above the MA
❌ Short Entry:
Triggered if:
• Heikin Ashi close crosses below the MA
or
• MFI is above 90 and Heikin Ashi close is below the MA
⸻
🛑 Stop Loss & Take Profit
• SL is set using riskMult * ATR
• TP is set using rewardMult * ATR
Example:
• If ATR = 10, riskMult = 1, rewardMult = 5
→ SL = 10 points, TP = 50 points from entry
⸻
⚖️ Break-even Logic (Optional)
• If price moves in your favor by breakevenTicks * ATR, SL is moved to entry price.
• Enabled via checkbox Enable Break Even.
⸻
📉 Trailing Stop Logic (Optional)
• Once break-even is hit, a trailing stop starts moving behind price by trailATRmult * ATR.
• Trailing stop only activates after break-even is reached.
• Enabled via checkbox Enable Trailing Stop.
📊 Visual Elements
• Heikin Ashi candles are drawn on the main chart.
• Trade zones are shaded between SL and TP during open trades.
• Lines mark Entry, SL, TP, Break-even trigger.
• Markers show entries and exits:
• Green/red triangles = long/short entries
• ✅ = Take profit hit
• ❌ = Stop loss hit
✅ Best Use Case
• Trending markets with strong pullbacks
• Works on multiple timeframes
• Better suited for assets with consistent volatility (ATR behavior)
MACD + Stochastic Power Scalper Version 7.0MACD + Stochastic Hedge Scalping for Crypto Futures. Works across timeframes and asset classes.
Enhanced Market Structure StrategyATR-Based Risk Management:
Stop Loss: 2 ATR from entry (configurable)
Take Profit: 3 ATR from entry (configurable)
Dynamic Position Sizing: Based on ATR stop distance and max risk percentage
Advanced Signal Filters:
RSI Filter:
Long trades: RSI < 70 and > 40 (avoiding overbought)
Short trades: RSI > 30 and < 60 (avoiding oversold)
Volume Filter:
Requires volume > 1.2x the 20-period moving average
Ensures institutional participation
MACD Filter (Optional):
Long: MACD line above signal line and rising
Short: MACD line below signal line and falling
EMA Trend Filter:
50-period EMA for trend confirmation
Long trades require price above rising EMA
Short trades require price below falling EMA
Higher Timeframe Filter:
Uses 4H/Daily EMA for multi-timeframe confluence
Enhanced Entry Logic:
Regular Entries: IDM + BOS + ALL filters must pass
Sweep Entries: Failed breakouts with tighter stops (1.6 ATR)
High-Probability Focus: Only trades when multiple confirmations align
Visual Improvements:
Detailed Entry Labels: Show entry, stop, target, and risk percentage
SL/TP Lines: Visual representation of risk/reward
Filter Status: Bar coloring shows when all filters align
Comprehensive Statistics: Real-time performance metrics
Key Strategy Parameters:
pinescript// Recommended Settings for Different Markets:
// Forex (4H-Daily):
// - CHoCH Period: 50-75
// - ATR SL: 2.0, ATR TP: 3.0
// - All filters enabled
// Crypto (1H-4H):
// - CHoCH Period: 30-50
// - ATR SL: 2.5, ATR TP: 4.0
// - Volume filter especially important
// Indices (4H-Daily):
// - CHoCH Period: 50-100
// - ATR SL: 1.8, ATR TP: 2.7
// - EMA and MACD filters crucial
Expected Performance Improvements:
Win Rate: 55-70% (improved filtering)
Profit Factor: 2.0-3.5+ (better risk/reward with ATR)
Reduced Drawdown: Stricter filters reduce false signals
Consistent Risk: ATR-based stops adapt to volatility
This enhanced version provides much more robust signal filtering while maintaining the core market structure edge, resulting in higher-probability trades with consistent risk management.
XAUUSD SMC Strategy (FVG + BoS)This advanced TradingView strategy is built for serious traders who follow Smart Money Concepts (SMC), with a special focus on Fair Value Gaps (FVG) and Break of Structure (BoS). The script automates trade entries and visual signals based on clean price action, while also allowing for performance backtesting through the built-in Strategy Tester.
The purpose of this script is to combine high-probability SMC signals with a clear and flexible backtest engine. Traders can visually confirm institutional moves (like imbalances and structure breaks) while simultaneously analyzing strategy performance, risk-reward, and execution logic — all from one chart.
⚙️ Key Features
FVG Detection: Automatically identifies bullish and bearish fair value gaps, highlighting imbalance zones between institutional buying and selling activity.
Break of Structure (BoS): Clearly shows bullish and bearish structure breaks, helping traders confirm directional bias and spot trend shifts with clarity.
Trade Execution Logic: Designed with actual strategy.entry() and strategy.exit() functions, this script simulates trades using risk-controlled logic with stop loss and take profit targeting.
Spaced Signal Visualization: Avoids chart clutter by spacing FVG and BoS signals, making the visual output clean and readable — even on fast-moving charts like XAUUSD.
Risk-Reward Customization: Easily set your own risk:reward ratio and stop-loss buffer, ensuring each trade is simulated according to your personal strategy or trading plan.
Cool-Down System: Add a delay between trades using the “Bars Between Trades” setting to prevent overtrading during volatile periods.
Live and Historical Insights: Signals appear in real-time, while also being plotted historically — making it easy to scroll back and study how the market behaved under this logic.
Fully Editable Parameters: Customize FVG size, structure lookback, spacing intervals, and more to fit your unique interpretation of SMC methodology.
🧠 How It Works
This strategy combines two key concepts:
FVG (Fair Value Gaps): Price zones where the market moved too quickly and left an imbalance between buyers and sellers. These gaps often act as magnets for price or areas of reversal.
BoS (Break of Structure): Points where the price breaks through a significant high or low, indicating a potential shift in market direction.
When both FVG and BoS align under certain conditions — and the cooldown requirement is satisfied — the strategy places a trade. A take profit and stop loss are automatically applied based on your inputs.
📈 Practical Use Cases
Trend Confirmation: Use BoS signals to validate trend continuation trades, especially when FVG confirms the imbalance.
Reversal Zones: Spot potential turning points when price fills an FVG and breaks previous structure in the opposite direction.
Backtest SMC Logic: Validate your theory by testing this strategy over historical XAUUSD data using real stop loss / take profit logic.
Refine Entry Timing: Study how structure breaks and FVGs align in different timeframes to improve entry precision.
💡 Best For
Traders learning or mastering Smart Money Concepts
Price action purists who avoid indicators
XAUUSD scalpers, day traders, or swing traders
Strategy developers who want visual + backtested confirmation
📌 Notes
The default strategy places trades every 10 candles to ensure the engine runs — replace this with your refined FVG + BoS logic as needed.
Works best on Gold (XAUUSD) 4H, 1H, or 15m timeframes depending on volatility and structure spacing.
🔒 Disclaimer
This strategy is for educational purposes only. It does not constitute financial advice. Always test and validate any trading logic before applying it to a live market. Trading carries risk — use proper risk management.
Pivot Squeeze StrategyStrategy based on Pivot Squeeze Oscillator Indicator for backtesting.
Features:
- Pivot Lookback adjustment
- Trade Both Directions, Long Trades Only, Short Trades Only
- Use Pivot Divergence Breakout logic, Pivot Divergence MA Cross Zero logic, or Pivot Divergence MA Cross Slow MA logic
- Adjustments for Breakout Threshold
- Risk Management (Stop Loss/Take Profit/etc)
- Visual Information
- Backtesting Period customization
30M Scalping Strategy with Debug LogsWhat’s changed
Spot‑only: all short logic removed—only long entries and exits are generated.
Logging: uses log.info() to send entry/exit details (timestamp, price, ATR, RSI) to the Pine Logs console.
Clean & concise: core scalp logic (EMAs, RSI, MACD, volume, ATR SL/TP) remains intact.
BTC Breakout Bot (TP/SL + Alerts) 🚀This strategy targets Bitcoin (BTC/USDT) breakout trades by detecting price moves beyond recent highs and lows, with built-in risk management and alerts.
How it works:
📈 Long Entry: When price breaks above the highest high of the last N candles (default 20)
📉 Short Entry: When price breaks below the lowest low of the last N candles
🎯 Take Profit: Automatically set at a percentage from entry price (default 5%)
⚠️ Stop Loss: Automatically set at a percentage from entry price (default 2%)
🔔 Alerts: Triggered on every long and short breakout trade, compatible with Telegram/webhook notifications
Parameters:
⏳ Breakout Lookback: Number of candles used to identify breakout levels (default 20)
💰 Take Profit (%): Profit target as % from entry (default 5%)
🛑 Stop Loss (%): Maximum allowed loss as % from entry (default 2%)
Supertrend Strategy (5m)📊 Strategy: Buy/Sell Based on EMA Crossover (5-Minute Timeframe)
📊 Стратегия: Buy/Sell по пересечению EMA (5 минут)
J-Lines Ribbon • 4-Cycle Engine (CHOP / ANTI / LONG / SHORT)📈 J-Lines Ribbon • 4-Cycle Engine (CHOP / ANTI / LONG / SHORT)
Version: Pine Script v6
Author: Thomas Lee
Category: Trend-Following / Mean Reversion / Scalping
Timeframes: Optimized for 1–5m (but adaptable) Seems to work best on Fibb Time
🧠 Strategy Overview:
The J-Lines Ribbon 4-Cycle Engine is a precision trading algorithm designed to navigate complex market microstructure across four adaptive states:
🔁 CHOP (No Trade / Flatten)
🟡 ANTI (Legacy Layer / Under Development)
🟢 LONG (Trend-Continuation & Rebounds)
🔴 SHORT (Inverse Trend-Continuation & Rebounds)
It combines a multi-layer EMA ribbon, ADX-based CHOP detection, and smart pivot analysis to dynamically shift between market modes, entering and exiting trades with surgical precision.
🔍 Core Features:
Dynamic Market Cycle Detection
Auto-classifies each bar into one of the 4 market states using ADX + EMA 72/89 crossovers.
One-Shot Entries & Rebound Logic
Initiates base entries at the start of new trend cycles. Re-entries (ReLong/ReShort) trigger on EMA 72 and EMA 126 pullbacks with momentum resumption.
CHOP State Autopilot
Automatically closes open positions when CHOP begins, preventing sideways market exposure.
Precision Take-Profits & Pivots-Based Stop Losses
Real-time adaptive exits using pivot high/low swing points as dynamic SL/TP anchors.
Customizable Parameters
Pivot length (left/right)
ADX thresholds
Rebound tolerance bands
Ribbon display and state-labels
📊 Indicator Components:
📏 EMA Ribbon: 72, 89, 126, 267, 360, 445
📉 ADX Filter: Filters out sideways noise, confirms directional bias
🔁 Crossover Events: Detects trend initiations
🌀 Cycle Labels: Real-time visual display of current market state
🛠️ Ideal Use Cases:
Scalping volatile markets
Automated strategy testing & optimization
Entry/exit signal confirmation for discretionary traders
Trend filtering in algorithmic stacks
⚠️ Notes:
ANTI cycle logic is scaffolded but not fully deployed in this version. It will be extended in a future release for deep mean-reversion detection.
Tailor ADX floor and pivot sensitivity to your specific asset and timeframe for optimal performance.
Refined MA + Engulfing (M5 + Confirmed Structure Break)I would like to start by saying that this strategy was put together using ChatGPT, some past trades from myself and some backtested trades, and from my time as a student in Wallstreet Academy under Cue Banks.
I am not profitable yet. I am too jumpy and blow accounts. I'm hoping this strategy (and it's indicator twin) can help me spend less time on the charts, so that I'm not tempted to press buttons as much.
It does fire quite a bit. But, the Strategy Tester tab shows a 30% win rate with our wins being significant to our losses. So, in theory, if you followed the rules of this strategy STRICTLY, you COULD BE profitable.
With that being said, there are times that this strategy has shown to trigger and I ask, "Why?".
I just want to help myself and others, and maybe make some decent\cool stuff along the way. Enjoy
KR
Simple SMA StrategyThis strategy uses two Simple Moving Averages (SMAs) to spot trend changes and generate trade signals on any market or timeframe.
How it works:
➡️ Long Entry: When the fast SMA (default 14) crosses above the slow SMA (default 28), enter a long position.
⬇️ Short Entry: When the fast SMA crosses below the slow SMA, enter a short position.
🔄 Exit: Positions close when the opposite crossover happens, capturing trend reversals.
Features:
⚙️ Adjustable SMA lengths for different markets or styles
💰 Position sizing as % of equity (default 1%) for risk management
📊 Plots fast (blue) and slow (orange) SMAs on the chart
🔔 Alerts on every long & short entry crossover for automation or notifications
Use Cases:
Perfect for trend-following traders in crypto, stocks, forex, and more — simple and effective.
⚠️ Disclaimer
Backtests and alerts are based on historical data and don’t guarantee future results. Always test carefully and manage your risk!
My strategyThis strategy is designed for BTC/USDT breakout trading on short-to-medium timeframes. It enters positions when price breaks out above recent highs or below recent lows, using automated risk management and alerts.
🔍 Core Logic
Long entry: When price breaks above the highest high of the last N candles (default: 20).
Short entry: When price breaks below the lowest low of the last N candles.
This logic helps detect momentum-driven breakout moves based on recent price consolidation.
⚙️ Strategy Settings
Capital: $10,000
Order size: 1% of equity per trade
Commission: 0.1% per trade (simulating exchange fees)
Slippage: 3 ticks (for realism)
Take Profit: 3% from entry
Stop Loss: 1.5% from entry
These settings aim to provide realistic, risk-conscious backtest results, suitable for individual traders.
📊 Visual Features
Green line = Breakout High
Red line = Breakout Low
Entry/exit markers are plotted on the chart
🔔 Alerts
Alerts are integrated for:
Long Entry
Short Entry
You can create TradingView alerts using this script to automate notifications or connect to external bots (e.g., via webhook for Telegram or Discord).
🧠 How This Strategy Is Different
While many breakout bots use standard Donchian channels, this version allows you to:
Tune the breakout sensitivity (via the adjustable lookback period)
Customize TP/SL without external inputs
Integrate alerts for real-time decision making or automation
The simplicity and flexibility make it useful as both a live tool and a framework for further development.
⚠️ Disclaimer
This script is for educational purposes only. Backtests are based on historical data and do not guarantee future results. Always test thoroughly before using in live trading. Risk only what you can afford to lose.
DI/ADX Trend Strategy | (1-Min Scalping)Strategy Overview
This is an experimental 1-minute trend-following strategy combining DI+/DI-, ADX, RSI, MACD, VWAP, and EMA filters with a time-based exit. It aims to catch strong directional moves while strictly managing risk.
Indicator Components
• DI+/DI- + ADX – Trend direction + strength filter
• RSI (14) – Momentum confirmation (RSI > 55 or < 45)
• MACD Histogram – Detects directional momentum shifts
• Candle Body % Filter – Screens for strong commitment candles
• EMA 600 / 2400 – Long-term trend alignment
• Weekly VWAP – Entry only when price is above/below VWAP
• Trade Limit – Max 2 trades per direction per VWAP cycle
• Time-Based Stop – 0.50% SL, 3.75% TP, 12h (720 bars) time stop
Entry Logic
Long Entry:
• DI+ crosses above DI−
• RSI > 55
• MACD histogram > 0
• Strong bullish candle
• Price > VWAP
• EMA600 > EMA2400
• Within 25 bars of EMA crossover
• Max 2 long trades before VWAP resets
Short Entry:
• DI+ crosses below DI−
• RSI < 45
• MACD histogram < 0
• Strong bearish candle
• Price < VWAP
• EMA2400 > EMA600
• Within 25 bars of EMA crossover
• Max 2 short trades before VWAP resets
Exit Logic
• Stop Loss: 0.50%
• Take Profit: 3.75% (7.5R)
• Time Stop: 720 bars (~12 hours on 1m chart)
• Each trade exits independently
Testing Parameters
• Initial Capital: $10,000
• Commission: 0.10%
• Timeframe: 1-minute
• Tested on: BTCUSDT, ETHUSDT
• Pyramiding: Up to 5 positions allowed
• VWAP resets trade counter to reduce overtrading
Alerts
• Buy / Sell signal
• Trade Opened / Closed
• SL/TP triggered
⚠️ Notes
• Early-stage strategy — entry count varies by trend conditions
• Shared for educational use and community feedback
• Please forward-test before using live
• Open-source — contributions and suggestions welcome!
Disclaimer
This strategy is for educational purposes only and should not be considered financial advice. Past performance does not guarantee future results. Always validate independently before trading live.
Infalible Universal 2:1 Estrategia🔹 "Infalible Universal 2:1 Strategy" – Optimized for All Markets and Timeframes
This strategy combines proven technical indicators with a dynamic risk management model to deliver consistent and optimized entries, especially on lower timeframes like 5 and 15 minutes.
Core Components:
📈 Entry Signals:
Trades are triggered when a fast Simple Moving Average (SMA) crosses over or under a slow SMA, with confirmation from a strong trend (ADX filter).
🎯 Dynamic Take Profit and Stop Loss:
Positions are exited based on a 2:1 Risk/Reward ratio, calculated using the current Average True Range (ATR). This allows the system to adapt to market volatility and remain effective across any asset.
🧱 Visual SL/TP Zones:
Colored rectangles highlight the Stop Loss (red) and Take Profit (green) areas on the chart, helping traders clearly visualize risk and reward at every entry.
🧠 Clean and Effective Logic:
No repainting. No lagging signals. Fully backtestable. Alerts included for long and short entries.
Whether you're trading forex, crypto, indices, or stocks, this universal strategy adapts to market behavior and focuses on consistent execution through disciplined risk management.
Intraday Momentum StrategyExplanation of the StrategyIndicators:Fast and Slow EMA: A crossover of the 9-period EMA over the 21-period EMA signals a bullish trend (long entry), while a crossunder signals a bearish trend (short entry).
RSI: Ensures entries are not in overbought (RSI > 70) or oversold (RSI < 30) conditions to avoid reversals.
VWAP: Acts as a dynamic support/resistance. Long entries require the price to be above VWAP, and short entries require it to be below.
Trading Session:The strategy only trades during a user-defined session (e.g., 9:30 AM to 3:45 PM, typical for US markets).
All positions are closed at the session end to avoid overnight risk.
Risk Management:Stop Loss: 1% below/above the entry price for long/short positions.
Take Profit: 2% above/below the entry price for long/short positions.
These can be adjusted via inputs for optimization.
Position Sizing:Fixed lot size of 1 for simplicity. Adjust based on your account size during backtesting.
Infalible SL y TP estrategy
**🔥 Professional Trend-Following Strategy with Dynamic Risk Management**
#### 📈 **Key Features**
✅ **High-Probability Entries:** Uses **ADX > 25** to trade only strong trending markets.
✅ **Smart Stop Loss:** Dynamic **2x ATR** trailing stop to adapt to volatility.
✅ **2:1 Risk-Reward:** Take Profit levels set at **2x SL distance** for consistent gains.
✅ **Real-Time Visuals:** Auto-updating TP/SL lines and entry markers.
---
#### 🛠 **Indicators Used**
1. **SMAs (14 & 28):** Classic crossover for entry signals.
2. **ADX (14):** Filters trades in strong trends (ADX ≥ 25).
3. **ATR (14):** Calculates stop loss distance (2x ATR).
---
#### ⚙ **Recommended Settings**
- **Markets:** Forex, Crypto, Trending Stocks.
- **Timeframes:** 15min - 4H (day trading) or Daily (swing trading).
- **Customizable:**
- `ATR Multiplier` (default: `2.0`).
- `Risk-Reward Ratio` (default: `2:1`).
---
#### 📉 **Entry/Exit Rules**
🔹 **LONG:**
- When **SMA(14) crosses ABOVE SMA(28)** + **ADX ≥ 25**.
- **SL:** Entry price - (2 x ATR).
- **TP:** Entry price + (4 x ATR).
🔹 **SHORT:**
- When **SMA(14) crosses BELOW SMA(28)** + **ADX ≥ 25**.
- **SL:** Entry price + (2 x ATR).
- **TP:** Entry price - (4 x ATR).
---
#### 🎨 **Clear Visualization**
- Fast SMA (blue) & Slow SMA (red).
- Live TP (green) and SL (red) levels.
---
#### 💡 **Why This Works**
✔ **Fewer False Signals:** ADX filter avoids choppy markets.
✔ **Adaptive Risk:** ATR-based SL adjusts to volatility.
✔ **Professional-Grade:** Strict 2:1 risk-reward discipline.
---
#### 📢 **Backtest & Optimize!**
👉 **Tip:** Tweak `ATR Multiplier` for different assets (e.g., 1.5 for forex, 3 for crypto).
👉 **Pro Tip:** Use TradingView’s **Strategy Tester** to optimize parameters.
📌 **Want a Trailing Stop or Volume Filter? Comment below!**
---
🔹 **Disclaimer:** Past performance ≠ future results. Always backtest before live trading.
---
### 🌟 **Like & Follow for More Advanced Strategies!** 🌟
粽子趋势波段策略应用在一小时图表上,提示做多或做空信号,注意⚠️每个信号只作为独立的进场信号,止盈止损自己把握,如做多信号出来之后,可进场做多,止盈止损自己把握,当做空信号出来后并不是前面做多信号的止盈信号,而是独立的新的做空信号,所以止盈止损需自己把握。
本策略适用于加密货币,外汇黄金,股票,期货,指数,作为运用在一小时图表上的做多做空进场信号提示。
联系作者,微:bbm_im7
Applied on the one-hour chart, prompting the long or short signal, note ⚠️ Each signal is only used as an independent entry signal, and the take-profit stop loss is grasped by yourself. For example, after the long signal comes out, you can enter the market and make a long, and the take-profit stop loss is grasped by yourself. When the short signal comes out, it is not the take-profit signal of the previous long signal, but independent The new short-sal signal, so you need to grasp the take-profit and stop-loss by yourself.
This strategy is applicable to cryptocurrencies, foreign exchange gold, stocks, futures, indexes, and is used as a signal prompt to enter the market on the one-hour chart.
MACD + Stochastic Power Scalper Version 9.0MACD Stochastic Scalping for Crypto Futures Pairs. Uses Trailing Stops to lock in profits.
Supertrend AT v1.0### Overview
"Supertrend AT v1.0" is an automated trading strategy based on the Supertrend indicator, designed to detect trend reversals and execute entries accordingly. This script supports both **long and short** positions and includes customizable risk management features such as **RPT (Risk Per Trade)** and **RR (Risk/Reward ratio)**.
### Key Features
- 📈 **Supertrend-based Entry Logic**:
- Enters a **long position** when the Supertrend flips from red to green (downtrend → uptrend).
- Enters a **short position** when the Supertrend flips from green to red (uptrend → downtrend).
- 💰 **Auto-Calculated Position Sizing**:
- Quantity is automatically calculated to ensure that loss per trade (including commission) matches the specified risk percentage (RPT).
- 🎯 **Take-Profit and Stop-Loss**:
- Both targets are dynamically computed using the RR ratio and account for commission fees.
- 📊 **Visual Elements**:
- Entry, stop, and target prices are plotted on the chart.
- Real-time PnL and account equity are shown in a dashboard.
- Optional on-screen README guide explains the strategy and key terms.
### Inputs
- **RPT (%)**: Risk per transaction (based on account equity).
- **RR**: Reward-to-risk ratio.
- **Commission (%)**: Used in all calculations (must match the Properties tab).
- **Supertrend Settings**: Adjustable factor and length.
- **Market Decimal Places**: For accurate quantity rounding according to exchange rules.
- **Time Filter**: Set start and end time for trading logic activation.
### Risk Management Logic
This strategy calculates trade size and targets using a formula that considers both the price distance between entry and stop-loss and the effect of commission fees. This ensures:
- Consistent risk across trades
- Realistic take-profit levels
- Exchange-compliant order quantities
### Notes
- ⚠️ Be sure to set the **correct commission rate** and **decimal precision** for your exchange.
- ⚠️ If trade quantity is smaller than your exchange’s minimum unit, orders may be rejected.
- 🔧 For strategy to behave as intended in automation, double-check both **input tab** and **Properties tab** settings.
### Disclaimer
This strategy is for educational and research purposes only. It does not constitute financial advice. Always test on paper before using in a live environment.
MACD + Stochastic Power Scalper Version 8.0MACD Stochastic Scalping for Crypto Futures Pairs. Uses Trailing Stops to lock in profits.
AurumFx ATR with EMAThis strategy combines the strength of breakout momentum with trend confirmation for precision entries. It uses a 9-period EMA to define short-term trend bias, while identifying key breakout points using 20-bar highs and lows. Long trades trigger on bullish breakouts above the previous high when price is above the EMA, while shorts trigger on bearish breakdowns below the prior low when price is below the EMA. Designed for traders seeking a simple yet effective trend-following system with clear visual signals and dynamic market adaptation.
StarStrat Ceres Strategy [0.3.1]2025ETH 30M Composite Golden Indicator Trend Strategy
This strategy is designed for Ethereum 30-minute timeframe, utilizing composite golden indicators combined with trend indicators for trade signal identification.
Trading Logic:
- Entry: Triggered when composite golden indicator and trend indicator confirm same direction
- Exit: Partial profit-taking mechanism with customizable parameters for each position
- Risk Management: Built-in risk coefficient, recommended setting at 1%
All key parameters are adjustable to adapt to different trading styles.
Risk Disclaimer: For educational and research purposes only. Not investment advice. Cryptocurrency trading involves high risk, please trade cautiously.
Buy The Dip - ENGThis script implements a grid trading strategy for long positions in the USDT market. The core idea is to place a series of buy limit orders at progressively lower prices below an initial entry point, aiming to lower the average entry price as the price drops. It then aims to exit the entire position when the price rises a certain percentage above the average entry price.
Here's a detailed breakdown:
1. Strategy Setup (`strategy` function):
`'거미줄 자동매매 250227'`: The name of the strategy.
`overlay = true`: Draws plots and labels directly on the main price chart.
`pyramiding = 15`: Allows up to 15 entries in the same direction (long). This is essential for grid trading, as it needs to open multiple buy orders.
`initial_capital = 600`: Sets the starting capital for backtesting to 600 USDT.
`currency = currency.USDT`: Specifies the account currency as USDT.
`margin_long/short = 0`: Doesn't define specific margin requirements (might imply spot trading logic or rely on exchange defaults if used live).
`calc_on_order_fills = false`: Strategy calculations happen on each bar's close, not just when orders fill.
2. Inputs (`input`):
Core Settings:
`lev`: Leverage (default 10x). Used to calculate position sizes.
`Investment Percentage %`: Percentage of total capital to allocate to the initial grid (default 80%).
`final entry Percentage %`: Percentage of the *remaining* capital (100 - `Investment Percentage %`) to use for the "semifinal" entry (default 50%). The rest goes to the "final" entry.
`Price Adjustment Length`: Lookback period (default 4 bars) to determine the initial `maxPrice`.
`price range`: The total percentage range downwards from `maxPrice` where the grid orders will be placed (default -10%, meaning 10% down).
`tp`: Take profit percentage above the average entry price (default 0.45%).
`semifinal entry price percent`: Percentage drop from `maxPrice` to trigger the "semifinal" larger entry (default -12%).
`final entry price percent`: Percentage drop from `maxPrice` to trigger the "final" larger entry (default -15%).
Rounding & Display:
`roundprice`, `round`: Decimal places for rounding price and quantity calculations.
`texts`, `label_style`: User interface preferences for text size and label appearance on the chart.
Time Filter:
`startTime`, `endTime`: Defines the date range for the backtest.
3. Calculations & Grid Setup:
`maxPrice`: The highest price point for the grid setup. Calculated as the lowest low of the previous `len` bars only if no trades are open. If trades are open, it uses the entry price of the very first order placed in the current sequence (`strategy.opentrades.entry_price(0)`).
`minPrice`: The lowest price point for the grid, calculated based on `maxPrice` and `range1`.
`totalCapital`: The amount of capital (considering leverage and `per1`) allocated for the main grid orders.
`coinRatios`: An array ` `. This defines the *relative* size ratio for each of the 11 grid orders. Later orders (at lower prices) will be progressively larger.
`totalRatio`: The sum of all ratios (66).
`positionSizes`: An array calculated based on `totalCapital` and `coinRatios`. It determines the actual quantity (size) for each of the 11 grid orders.
4. Order Placement Logic (`strategy.entry`):
Initial Grid Orders:
Runs only if within the specified time range and no position is currently open (`strategy.opentrades == 0`).
A loop places 11 limit buy orders (`Buy 1` to `Buy 11`).
Prices are calculated linearly between `maxPrice` and `minPrice`.
Order sizes are taken from the `positionSizes` array.
Semifinal & Final Entries:
Two additional, larger limit buy orders are placed simultaneously with the grid orders:
`semifinal entry`: At `maxPrice * (1 - semifinal / 100)`. Size is based on `per2`% of the capital *not* used by the main grid (`1 - per1`).
`final entry`: At `maxPrice * (1 - final / 100)`. Size is based on the remaining capital (`1 - per2`% of the unused portion).
5. Visualization (`line.new`, `label.new`, `plot`, `plotshape`, `plotchar`):
Grid Lines & Labels:
When a position is open (`strategy.opentrades > 0`), horizontal lines and labels are drawn for each of the 11 grid order prices and the "final" entry price.
Lines extend from the bar where the *first* entry occurred.
Labels show the price and planned size for each level.
Dynamic Coloring: If the price drops below a grid level, the corresponding line turns green, and the label color changes, visually indicating that the level has been reached or filled.
Plotted Lines:
`maxPrice` (initial high point for the grid).
`strategy.position_avg_price` (current average entry price of the open position, shown in red).
Target Profit Price (`strategy.position_avg_price * (1 + tp / 100)`, shown in green).
Markers:
A flag marks the `startTime`.
A rocket icon (`🚀`) appears below the bar where the `final entry` triggers.
A stop icon (`🛑`) appears below the bar where the `semifinal entry` triggers.
6. Exit Logic (`strategy.exit`, `strategy.entry` with `qty=0`):
Main Take Profit (`Full Exit`):
Uses `strategy.entry('Full Exit', strategy.short, qty = 0, limit = target2)`. This places a limit order to close the entire position (`qty=0`) at the calculated take profit level (`target2 = avgPrice * (1 + tp / 100)`). Note: Using `strategy.entry` with `strategy.short` and `qty=0` is a way to close a long position, though `strategy.exit` is often clearer. This exit seems intended to apply whenever any part of the grid position is open.
First Order Trailing Stop (`1st order Full Exit`):
Conditional: Only active if `trail` input is true AND the *last* order filled was "Buy 1" (meaning only the very first grid level was entered).
Uses `strategy.exit` with `trail_points` and `trail_offset` based on ATR values to implement a trailing stop loss/profit mechanism for this specific scenario.
This trailing stop order is cancelled (`strategy.cancel`) if any subsequent grid orders ("Buy 2", etc.) are filled.
Final/Semifinal Take Profit (`final Full Exit`):
Conditional: Only active if more than 11 entries have occurred (meaning either the "semifinal" or "final" entry must have triggered).
Uses `strategy.exit` to place a limit order to close the entire position at the take profit level (`target3 = avgPrice * (1 + tp / 100)`).
7. Information Display (Tables & UI Label):
`statsTable` (Top Right):
A comprehensive table displaying grouped information:
Market Info (Entry Point, Current Price)
Position Info (Avg Price, Target Price, Unrealized PNL $, Unrealized PNL %, Position Size, Position Value)
Strategy Performance (Realized PNL $, Realized PNL %, Initial/Total Balance, MDD, APY, Daily Profit %)
Trade Statistics (Trade Count, Wins/Losses, Win Rate, Cumulative Profit)
`buyAvgTable` (Bottom Left):
* Shows the *theoretical* entry price and average position price if trades were filled sequentially up to each `buy` level (buy1 to buy10). It uses hardcoded percentage drops (`buyper`, `avgper`) based on the initial `maxPrice` and `coinRatios`, not the dynamically changing actual average price.
`uiLabel` (Floating Label on Last Bar):
Updates only on the most recent bar (`barstate.islast`).
Provides real-time context when a position is open: Size, Avg Price, Current Price, Open PNL ($ and %), estimated % drop needed for the *next* theoretical buy (based on `ui_gridStep` input), % rise needed to hit TP, and estimated USDT profit at TP.
Shows "No Position" and basic balance/trade info otherwise.
In Summary:
This is a sophisticated long-only grid trading strategy. It aims to:
1. Define an entry range based on recent lows (`maxPrice`).
2. Place 11 scaled-in limit buy orders within a percentage range below `maxPrice`.
3. Place two additional, larger buy orders at deeper percentage drops (`semifinal`, `final`).
4. Calculate the average entry price as orders fill.
5. Exit the entire position for a small take profit (`tp`) above the average entry price.
6. Offer a conditional ATR trailing stop if only the first order fills.
7. Provide extensive visual feedback through lines, labels, icons, and detailed information tables/UI elements.
Keep in mind that grid strategies can perform well in ranging or slowly trending markets but can incur significant drawdowns if the price trends strongly against the position without sufficient retracements to hit the take profit. The leverage (`lev`) input significantly amplifies both potential profits and losses.