Индикаторы и стратегии
Master Arb Recipes – 3 Commas signal Bot integration Master Arb Recipes – 3 Commas signal Bot integration
Purpose
A systematic arbitrage/accumulation framework with pre-tuned “recipes” for BTC/ETH/XRP/SUI/SOL plus a fully manual mode. It automates signal generation for external execution bots (via alert() JSON), while showing on-chart panels for goals, active parameters, DCA position, and P&L/ROI/CAGR. Backtests simulate market orders with optional slippage and TradingView commissions.
Key ideas
Entries: Intrabar trigger when price drops by the recipe’s Entry drop % from the previous close.
Exits: Profit-taking when price rises by the recipe’s Exit rise % (optionally requiring price above average cost).
DCA accounting: Tracks running quantity, average cost, realized (cash) P&L, and unrealized (coin) P&L.
Capital planning: “ReqCap” column estimates capital = Entry $ × Allowed entries (UI only; does not affect orders).
Alerts (live only): Sends minimal Custom Signal JSON for enter_long / exit_long to your execution bot.
What’s included on chart
Top-Right: Strategy Goals Table
Describes the objective for each preset. Auto-filters by the chart’s base (optional).
Bottom-Left: Active Recipe Panel (with 3C UI column)
Shows the active preset (or custom) with: timeframe, Sell-Above-Cost state, Entry/Exit %, Exit-as-%-of-Entry, min bars between entries, once-per-bar gate, and 3Commas UI guidance for optional filters and per-order dollars.
Top-Left: DCA Panel
Current base quantity, average cost, and realized P&L.
Bottom-Right: P&L + ROI/CAGR Panel
Cash P&L (realized), Coin P&L (unrealized), Total P&L, ROI since first fill, and annualized CAGR. Displays denominators for both StartCap (strategy.initial_capital) and ReqCap (planning).
Presets
BTC: STH1_D, LTH1_6H, LTH2_D, LTH3_W, LTH4_6H
ETH: STH1_D, STH2_D, LTH1_D
XRP: STH1_D, STH2_6H, LTH1_6H, LTH2_1H
SUI: STH1_D, STH2_D, STH3_D
SOL: STH1_D, LTH1_D
Each preset sets Entry drop %, Exit rise %, default Entry $, Exit-as-%-of-Entry, Sell-Above-Cost flag, and a reference timeframe (display only). Custom mode lets you define these manually.
Inputs you’ll use
3Commas Custom Signal: secret, bot_uuid, max_lag_sec.
Start Window: Exact date/time + timezone to begin trading/signals.
Entry/Exit Parameters: Entry drop %, Exit rise %, Sell Above Avg Cost toggle, Exit as % of Entry.
Capital Planning: Allowed entries (for ReqCap), Entry $ override (panel only).
Execution/Sim: Simulated slippage %, once-per-bar gate, minimum bars between entries, TradingView commission.
Panels: Toggles + positions for each table.
Alert / Bot integration
Alerts fire only in realtime (barstate.isrealtime) on order submission.
Create one alert on this script using “Any alert() function call”.
Payload (Custom Signal style) includes:
secret, bot_uuid, max_lag, timestamp, trigger_price, tv_exchange, tv_instrument, action where action ∈ {enter_long, exit_long}.
Sizing: This script does not include per-order sizing in the JSON; size in your bot UI. The on-chart Entry $ / Exit $ values are for planning/backtest display.
3Commas optional filter mapping (shown in the panel’s “3C UI” column):
Entry filters:
Same order: set to –EntryDrop% (ON)
From average entry: set to –EntryDrop% (ON)
Exit filters:
If Sell Above Cost = ON → From average entry +ExitRise% (ON); Same order OFF
If Sell Above Cost = OFF → Same order +ExitRise% (ON); From average entry OFF
Per-order volume: Use your bot’s UI. Panel shows the dollars you planned (Entry $ and Exit $).
Backtest notes & limitations
Uses calc_on_every_tick=true and intrabar checks against the previous close for entry drops; historical behavior won’t perfectly match exchange microstructure.
process_orders_on_close=false; fills are simulated at bar prices with your slippage setting and TV commission.
Alerts and webhook timing depend on TradingView + broker/exchange latencies; use max_lag_sec accordingly.
Required Capital (ReqCap) is for planning only and does not reserve funds or constrain orders.
Recommended markets/timeframes
Crypto spot or futures charts that trade 24/7. Preset labels (D/6H/1H/W) are reference rhythms for volatility; the script runs on any timeframe but results will vary.
Change log (04092025)
Added 3C UI guidance column in Active Recipe panel (dynamic % per recipe).
Restored Goals (top-right) and P&L/ROI/CAGR (bottom-right with StartCap & ReqCap).
Minor UI clarifications; trading logic unchanged.
Disclaimer
This script is for research and education. It is not financial advice and makes no performance promises. Backtests are hypothetical and subject to substantial limitations. Markets involve risk; you can lose capital. Test on paper first and deploy at your own discretion. Licensed under the Mozilla Public License 2.0.
Rev Smart Pivot V5.0 by SJKimRev Smart Pivot V5.0 by SJKim
Rev Smart Pivot V5.0 by SJKim
Rev Smart Pivot V5.0 by SJKim
News Volatility Bracketing StrategyThis is a news-volatility bracketing strategy. Five seconds before a scheduled release, the strategy brackets price with a buy-stop above and a sell-stop below (OCO), then converts the untouched side into nothing while the filled side runs with a 1:1 TP/SL set the same distance from entry. Distances are configurable in USD or %, so it scales to the instrument and can run on 1-second data (or higher TF with bar-magnifier). The edge it’s trying to capture is the immediate, one-directional burst and liquidity vacuum that often follows market-moving news—entering on momentum rather than predicting direction. Primary risks are slippage/spread widening and whipsaws right after the print, which can trigger an entry then snap back to the stop.
MuLegend's Break & Retest StrategyThis strategy was produced to help traders who trade NQ: win! try it out on a demo, see how you like and happy trading!! Works well if you are a break & retest trader!!!
MuMu
@atltime2shine on IG
AI KNN-Dual SuperTrend MTF - by Trading Pine Lab🇬🇧
The AI KNN-Dual SuperTrend MTF is a next-generation trading strategy that merges two higher-timeframe SuperTrends with dual KNN (K-Nearest Neighbors) classifiers, an ADX/DMI filter, and a Pivot Percentile bias module. This layered architecture ensures stronger signal confirmation by requiring consensus across AI models, multi-timeframe SuperTrends, and statistical filters.
Entries occur only when both SuperTrends align with bullish or bearish KNN labels, while the ADX/DMI filter validates momentum. Exits are managed dynamically with adaptive trailing stops (ST ± ATR × factor) or when market conditions flip according to percentile bias.
All parameters are fully configurable:
-Trading direction filter: Long / Short / Both.
-KNN classifiers: neighbors (K), dataset size (N), smoothing lengths.
-Dual SuperTrend: higher timeframes, ATR length, ATR factor, baseline type.
-ADX/DMI filter: customizable length and timeframe.
-Pivot Percentile module: multi-scale statistical bias.
-Visualization: AI markers, ribbons, aura lines, and per-trend coloring.
Flex-ATR SuperTrend - by Trading Pine Lab🇬🇧
The Flex-ATR SuperTrend is a versatile trading strategy that enhances the classic SuperTrend with adjustable ATR methods, a custom date-range filter, and modern visual styling. By allowing a switch between standard ATR and SMA-based TR, the baseline adapts better to different volatility regimes and market conditions.
Entries are triggered when the SuperTrend flips bullish, while exits occur when it flips bearish. A highlight cloud emphasizes the active trend, and optional BUY/SELL labels provide clear visual confirmation of entry and exit signals.
All parameters are fully configurable:
-ATR settings: period and multiplier, with toggle between classic ATR and SMA-based TR.
-Date range filter: define exact backtesting windows.
-Signal visualization: optional BUY/SELL labels.
-Highlight cloud: cyan/magenta overlay for trend emphasis.
-Customization: enable/disable signals and visuals for a clean or detailed interface.
Dual-BB SuperTrend - by Trading Pine Lab🇬🇧
The Dual-BB SuperTrend is a fusion strategy that builds a BBTrend oscillator from two Bollinger Bands (short & long lookbacks) and then runs a SuperTrend over that oscillator to time entries and exits. The BBTrend captures expansion/contraction between the two bands (structural momentum), while the SuperTrend converts that flow into clear directional flips.
Entries occur on SuperTrend direction flips over the BBTrend series (Long when ST turns bullish, Short when it turns bearish). Optional percentage TP/SL can be applied on top. The chart includes a blue/orange theme for the BBTrend histogram with a subtle glow around the zero line, and BUY/SELL label markers with arrows for clean visual confirmation.
All parameters are fully configurable:
-Trading direction filter: Long / Short / Both.
-Bollinger settings: short length, long length, standard-deviation multiplier.
-SuperTrend over BBTrend: length and ATR factor, contrarian labels toggle, bull/bear colors.
-Risk controls: Take-Profit % and Stop-Loss % with TP/SL/Both/None mode.
-Visualization: BBTrend column colors (blue/orange, strong/weak), zero-line glow, BUY/SELL label styling.
Gaussian Trend Rider - by Trading Pine Lab🇬🇧
The Gaussian Trend Rider is a clean and effective trend-following strategy based on a simulated Gaussian filter (double SMA smoothing).
Long entries are triggered when the price closes above the Gaussian trend line, and positions are exited when the price closes back below it.
The strategy is designed to keep trading simple while still offering visual clarity:
A dynamic trend line that adapts with price.
An optional ATR-based "waterfall cloud", adding subtle context about volatility and confidence.
Entry and exit markers for clear visual confirmation.
This minimalistic approach is ideal for traders who prefer riding established trends without overcomplicating the setup.
Configurable parameters:
-Trend Length (Gaussian smoothing window).
-Styling options (line width, static/dynamic coloring, markers, ATR cloud).
Bull-Bear Power ZScore - by Trading Pine Lab🇬🇧
The Bull-Bear Power ZScore Strategy is an advanced trading framework that integrates Bull-Bear Power (BBP) with a statistical Z-Score model.
BBP measures the relative strength of buyers vs. sellers against an EMA baseline, while the Z-Score standardizes this relationship to detect statistically significant breakouts.
This dual-layer approach provides early trend detection while reducing noise from raw momentum signals.
Entries are triggered when the Z-Score crosses above or below its threshold (long above +T, short below –T). Exits occur when the Z-Score crosses back to zero, ensuring trades close when momentum fades.
A dynamic multi-level take-profit system is integrated, using ATR-based targets (TP1, TP2, TP3) that automatically adapt to **volume context** (high/medium/low) and **percentile analysis** (distribution of price and volume).
This ensures profit targets stretch in strong environments and tighten in weaker conditions, optimizing both risk and reward.
All parameters are fully configurable:
-Bull-Bear Power Settings: EMA length, Z-Score length, Z-Score threshold.
-Take Profit Settings: enable/disable TP system, ATR period, TP1–TP3 multipliers, TP1–TP3 position sizes.
-Volume Analysis: volume MA period, high/medium/low multipliers, adjustment factors.
-Percentile Analysis: percentile lookback period, high/medium/low thresholds, adjustment factors.
АЗЪ 3.610 - Squeeze Momentum + ADX + FastTF + Alerts + PnLStrata genius squeeze momentum + tester + adx +fast tf
AI Volume-KNN SuperTrend - by Trading Pine Lab🇬🇧 English
The AI Volume-KNN SuperTrend is an advanced trading strategy that combines the robustness of the SuperTrend indicator with a machine-learning inspired KNN (K-Nearest Neighbors) model. The baseline is built from a volume-weighted moving average with ATR-based bands, while the KNN classifier validates trend direction in real time. This dual-layer approach reduces false signals and improves trend confirmation.
Entries are triggered when the SuperTrend flips direction and the KNN classifier confirms the move as bullish or bearish. Exits are managed with a dynamic trailing stop, automatically adjusting to SuperTrend ± ATR × factor. The strategy includes visual markers for AI start/continuation signals, as well as customizable coloring for bullish, bearish, and neutral phases.
All parameters are fully configurable:
-Trading direction filter: Long / Short / Both.
-KNN settings: number of neighbors (K), dataset size (N).
-Label smoothing: price and SuperTrend smoothing lengths (WMAs).
-SuperTrend settings: length, ATR factor, and moving average source.
-Visualization: trend markers and per-trend coloring.
The DTC fix7 Best Combined (New York Time Sessions)The DTC Bot – Weekly Results Recap 🚀
This week the bot came back with serious momentum! Here’s the breakdown of performance across pairs:
✅ AUDCHF: +$6,018.14
✅ NZDCHF: +$4,965.29
✅ AUDUSD: +$2,867.04
✅ NZDJPY: +$1,063.22
❌ NZDCAD: -$5,138.61
📊 Net Result: + $9,775.08
💡 Key Insight: Trading isn’t about one single trade or even one single week — it’s about probabilities over time. After a tough performance last week, this bounce shows how quickly the tide can turn in our favor.
The DTC Bot is designed to adapt across pairs, balance outcomes, and keep probabilities working for you.
⚡ Ready to get access?
The DTC Bot is now available as an invite-only strategy on TradingView:
$59/month subscription
$499/year (save big with the yearly plan!)
Universal Webhook Connector Demo.This strategy demonstrates how to generate JSON alerts from TradingView for multiple trading platforms.
Users can select platform_name (MT5, TradeLocker, DxTrade, cTrader, etc).
Alerts are constructed in JSON format for webhook execution.
Gamma Blast StrategyGamma Blast Strategy used for quick 2-5 ticks on Buys, but on a sideways market can get up to 15-20 ticks.
Maiko Range Scalper (Sideways BB + RSI) – v4 cleanPurpose
It’s a range scalping strategy for crypto. It tries to take small, repeatable trades inside a sideways market: buy near the bottom of the range, sell near the middle/top (and the reverse for shorts).
Core idea (two timeframes)
Define the trading range on a higher timeframe (HTF)
You choose the HTF (e.g., 15m or 1h).
The script finds the highest high and lowest low over a lookback window (e.g., last 96 HTF candles) → these become HTF Resistance and HTF Support.
It also calculates the midline (average of support/resistance).
Trade signals on your lower timeframe (LTF)
You run the strategy on a fast chart (e.g., 1m or 5m).
Entries are only allowed inside the HTF range.
Entry logic (mean reversion)
Indicators on the LTF:
Bollinger Bands (length & std dev configurable).
RSI (length & thresholds configurable).
Optional VWAP proximity filter (price must be within X% of VWAP).
Long setup:
Price touches/under-cuts the lower Bollinger band AND RSI ≤ threshold (default 30) AND price is inside the HTF range (and passes VWAP filter if enabled).
Short setup:
Price touches/exceeds the upper Bollinger band AND RSI ≥ threshold (default 70) AND price is inside the HTF range (and passes VWAP filter if enabled).
Exits and risk
Stop-loss: placed just outside the HTF range with a configurable buffer %:
Long SL = HTF Support × (1 − buffer).
Short SL = HTF Resistance × (1 + buffer).
Take-profit (selectable):
Mid band (the Bollinger basis) → conservative, faster exits.
Opposite band / HTF boundary → more aggressive, higher RR but more give-backs.
Position sizing
A simple cap: maximum position size = percent of account equity (e.g., 20%).
The script calculates quantity from that cap and current price.
Plots you’ll see on the chart
HTF Resistance (red) and HTF Support (green) via plot().
HTF Midline (gray dashed) drawn with a line.new() object (because plot() cannot do dashed).
Bollinger basis/upper/lower on the LTF.
Optional VWAP line (only shown if you enable the filter).
Signal markers (green triangle up for Long setups, red triangle down for Short setups).
Alerts
Two alertconditions:
“Long Setup” – when a long entry condition appears.
“Short Setup” – when a short entry condition appears.
Create alerts from these to get notified in real time.
How to use it (quick start)
Add to a 1m or 5m chart of a liquid coin (BTC, ETH, SOL).
Set HTF timeframe (start with 1h) and lookback (e.g., 96 = ~4 days on 1h).
Keep default Bollinger/RSI first; tune later.
Choose TP mode:
“Mid band” for quick scalps.
“Opposite band/Range” if the range is very clean and you want bigger targets.
Set SL buffer (0.15–0.30% is common; adjust for volatility).
Set Max position % to control size (e.g., 20%).
(Optional) Enable VWAP filter to skip stretched moves.
When it works best
Clearly sideways markets with visible support/resistance on the HTF.
High-liquidity pairs where spreads/fees are small relative to your scalp target.
Limitations & safety notes
True breakouts will invalidate mean-reversion logic—your SL outside the range is there to cut losses fast.
Fees can eat into small scalps—prefer limit orders, rebates, and liquid pairs.
Backtest results vary by exchange data; always forward-test on small size.
If you want, I can:
Add an ATR-based stop/target option.
Provide a study-only version (signals/alerts, no trading engine).
Pre-set risk to your €5,000 plan (e.g., ~0.5% max loss/trade) with calculated qty.
𝐍𝐄𝐔𝐑𝐀𝐋 𝐍𝐄𝐓𝐖𝐎𝐑𝐊神经网络交易系统全网都在疯狂寻找的神经网络交易系统
策略通过整合多种技术指标(如EMA、Supertrend、HMA、PSAR、RSI、MACD、WaveTrend、Stochastic、Bollinger Bands、ATR、RVI、OBV、CMF、VWAP、K线形态等),生成综合交易信号。策略采用评分系统,根据各指标的权重累积分数,触发强/弱多头和空头信号,并结合趋势过滤(可选)和止损机制进行交易管理。
The neural network trading system that the entire network is frantically searching for
The strategy integrates multiple technical indicators (such as EMA、Supertrend、HMA、PSAR、RSI、MACD、WaveTrend、Stochastic、Bollinger Bands、ATR、RVI、OBV、CMF、VWAP、K Generate comprehensive trading signals based on line shapes, etc. The strategy adopts a scoring system, accumulates scores based on the weights of each indicator, triggers strong/weak long and short signals, and combines trend filtering (optional) and stop loss mechanism for trading management.
EMA inFusion Pro - Multiple SourcesEMA Fusion Pro: Dynamic Trend & Momentum Strategy with Three Exit Modes
EMA Fusion Pro is a highly customizable, multi-exit trend-following strategy designed for traders who value both precision and flexibility. By leveraging exponential moving averages (EMA), average directional index (ADX), and volume analysis, this strategy aims to capture trending market moves while offering three distinct exit modes for optimal risk management across varying market conditions.
Strategy Overview
This strategy systematically identifies potential entry points using a moving average crossover with highly configurable data sources (including price, volume, rate of change, or their Heikin Ashi versions) and filters signal quality with ADX trend strength and volume spikes. Each trade is managed with one of three advanced exit methodologies—reverse signal, ATR-based stop/take profit, or fixed percentage—giving you the control to adapt your risk profile to different market regimes.
Key Features
Customizable EMA Source: Calculate the core trend-filtering EMA from price (default), volume, rate of change, or their Heikin Ashi counterparts for unique market perspectives.
Trend Filter with ADX: Confirm entries only when the trend is strong, as measured by the user-adjustable ADX threshold.
Volume Spike Confirmation: Optional filter to only take trades with above-average volume activity, reducing false signals.
Three Exit Modes:
Reverse Signal: Exit trades when a new, opposite entry signal occurs.
ATR-Based Stop/Take Profit: Dynamic risk management using multiples of the average true range (ATR) for both take profit and stop loss.
Percent-Based Stop/Take Profit: Fixed-percentage risk management with user-defined thresholds.
Visual Annotations: Signal markers, EMA line color-coded by source, trend background coloring, and optional ATR/percent-based TP/SL levels.
Info Panel: Real-time display of all core indicators, current trading mode, exit parameters, and position status for quick oversight.
How It Works
Entry Logic: A crossover signal (above/below the EMA) triggers a new entry, but only if both ADX trend strength and (optionally) volume spike conditions are met.
Exit Logic: Three selectable modes allow you to exit trades on reverse signals, at a dynamic ATR-based profit or loss, or at a fixed percentage gain/loss.
Flexible Data Analysis: The EMA source can be chosen from six options—standard price, volume, rate of change, or their Heikin Ashi variants—allowing experimentation with different market dimensions.
Risk Management: All exits are precisely controlled, either by the next opposing signal, by volatility-adjusted levels, or by fixed risk/reward ratios.
Backtest & Optimization: The strategy is fully backtestable within TradingView’s Strategy Tester, with adjustable parameters for optimization.
Customization & Usage
Indicator Source: Select your preferred data type for EMA calculation, opening the door to creative strategy variations (e.g., volume momentum, pure price trend, rate of change divergence).
Filter Toggles: Enable/disable ADX and volume filters as desired—useful for different market environments.
Exit Mode Selection: Switch between reverse, ATR, or percent-based exits with a single parameter—ideal for adapting to ranging vs. trending markets.
Visual Clarity: The EMA line color reflects its underlying source, and the info panel summarizes all critical values for easy monitoring.
Who Should Use This Strategy?
Trend Followers seeking to ride strong moves with multiple exit options.
Experienced Traders who want to experiment with different data types (volume, momentum, Heikin Ashi) for trend analysis.
Algorithmic Traders looking for a robust, flexible base to build upon with their own ideas.
Getting Started
Apply the script to your chart and review default settings.
Customize parameters—EMA length, ADX threshold, volume settings, exit type—as desired.
Backtest on multiple instruments and timeframes to evaluate performance.
Optimize filters, exit rules, and risk parameters for your preferred trading style.
Monitor with the real-time info panel and trade alerts.
Disclaimer
This script is for educational and entertainment purposes only. It is not financial advice. Past performance is not indicative of future results. Always conduct thorough testing and consider your risk tolerance before trading real capital.
— Happy Trading —
Feel free to adapt, share, and contribute to this open-source strategy!
Stoch Cross Strategy with Dynamic Lot SizeEntry:
Buy when %K crosses above %D in oversold (<20).
Sell when %K crosses below %D in overbought (>80).
Exit:
TP fixed at +1000 pips.
SL fixed at -500 pips.
Lot management:
Start at 0.01.
+0.01 after every win (up to 10.0).
–0.01 after every loss (never below 0.01).
Alerts:
Alerts fire on every valid signal.
Messages show direction, lot size, SL, and TP
BTC_Hull Suite StrategyOverview
BTC_Hull Suite Strategy is a trend-following system designed to keep drawdowns modest while staying exposed during genuine uptrends. It uses the Hull Moving Average (HMA) for fast, low-lag trend turns, a long-term SMA filter to avoid chop, and a percentage trailing stop to protect gains.
🔧 What the strategy includes
- Hull Moving Average (HMA) with configurable length (default 55)
- SMA filter (default 130) to trade only with higher-timeframe bias
- Trailing stop in percent (default 5%) based on the running peak of close
- Execution model: signals are evaluated on the previous bar and entries are placed at the next bar’s open (TradingView default)
📈 How it works:
✅ Entry (Long):
Detects a bullish Hull turn by comparing the current HMA to its value 3 bars ago:
h > h3 and h <= h3 → HMA just turned up on the prior bar
The SMA filter must confirm: close > sma
If both are true (and within the date window), a long is opened next bar at the open
❌ Exit:
Hull turn down: h < h3 and h >= h3 , or
Trailing stop: price closes below peak * (1 – trailingPct)
Either condition closes the position at the current bar’s close
Notes:
pyramiding = 1 → allows one add-on (maximum two concurrent long positions)
Position sizing defaults to 20% of equity per entry (adjustable in Properties)
Who is this for?
This strategy is tailored for Bitcoin traders (spot or perpetuals) who want a rules-based, low-lag trend system with built-in drawdown protection.
It works best on Daily or 4H charts, but parameters can be adapted for other timeframes.
⚠️ Disclaimer
This strategy is provided for educational and research purposes only.
It is not financial advice. Markets are risky — always test on your own data, include realistic fees/slippage, and forward-test before using real capital.
OPTIMAL super trend tripple confirm for leverage. Ai implemented for higher r:r still a work in progresss
Trend MasterOverview
The Strategy is a trend-following trading system designed for forex, stocks, or other markets on TradingView. It uses pivot points to identify support and resistance levels, combined with a 200-period Exponential Moving Average (EMA) to filter trades. The strategy enters long or short positions based on trend reversals during specific trading sessions (London or New York). It incorporates robust risk management, including position sizing based on risk percentage or fixed amount, trailing stop-losses, breakeven moves, and weekly/monthly profit/loss limits to prevent overtrading.
This script is ideal for traders who want a semi-automated approach with visual aids like colored session backgrounds, support/resistance lines, and a performance dashboard. It supports backtesting from a custom start date and can limit trades to one per session for discipline. Alerts are built-in for entries, exits, and stop-loss adjustments, making it compatible with automated trading bots.
Key Benefits:
Trend Reversal Detection: Spots higher highs/lows and lower highs/lows to confirm trend changes.
Session Filtering: Trades only during high-liquidity sessions to avoid choppy markets.
Risk Control: Automatically calculates position sizes to risk only a set percentage or dollar amount per trade.
Performance Tracking: Displays a table of weekly or monthly P&L (profit and loss) with color-coded heatmaps for easy review.
Customizable: Adjust trade direction, risk levels, take-profit ratios, and more via inputs.
The strategy uses a 1:1.2 risk-reward ratio by default but can be tweaked.
How It Works
Trend Identification:
The script calculates pivot highs and lows using left (4) and right (2) bars to detect swing points.
It identifies patterns like Higher Highs (HH), Higher Lows (HL), Lower Highs (LH), and Lower Lows (LL) to determine the trend direction (uptrend if above resistance, downtrend if below support).
Support (green dotted lines) and resistance (red dotted lines) are drawn dynamically and update on trend changes.
Bars are colored blue (uptrend) or black (downtrend) for visual clarity.
Entry Signals:
Long Entry: Price closes above the 200 EMA, trend shifts from down to up (e.g., breaking resistance), during an active session (London or NY), and no trade has been taken that session (if enabled).
Short Entry: Price closes below the 200 EMA, trend shifts from up to down (e.g., breaking support), during an active session, and no prior trade that session.
Trades can be restricted to "Long Only," "Short Only," or "Both."
Entries are filtered by a start date (e.g., from January 2022) and optional month-specific testing.
Position Sizing and Risk:
Risk per trade: Either a fixed dollar amount (e.g., $500) or percentage of equity (e.g., 1%).
Quantity is calculated as: Risk Amount / (Entry Price - Stop-Loss Price).
This ensures you never risk more than intended, regardless of market volatility.
Stop-Loss (SL) and Take-Profit (TP):
SL for Longs: Set below the recent support level, adjustable by a "reduce value" (e.g., tighten by 0-90%) and gap (e.g., add a buffer).
SL for Shorts: Set above the recent resistance level, with similar adjustments.
TP: Based on risk-reward ratio (default 1.2:1), so if SL is 100 pips away, TP is 120 pips in profit.
Visual boxes show SL (red) and TP (green) on the chart for the next 4 bars after entry.
Trade Management:
Trailing SL: Automatically moves SL to the new support (longs) or resistance (shorts) if it tightens the stop without increasing risk.
Breakeven Move: If enabled, SL moves to entry price once profit reaches a set ratio of initial risk (default 1:1). For example, if risk was 1%, SL moves to breakeven at 1% profit.
One Trade Per Session: Prevents multiple entries in the same London or NY session to avoid overtrading.
Sessions include optional weekend inclusion and are highlighted (blue for London, green for NY).
Risk Limits (Weekly/Monthly):
Monitors P&L for the current week or month.
Stops trading if losses hit a limit (e.g., -3%) or profits reach a target (e.g., +7%).
Resets at the start of each new week/month.
Alerts notify when limits are hit.
Exits:
Trades exit at TP, SL, or manually via alerts.
No time-based exits; relies on price action.
Performance Dashboard:
A customizable table (position, size, colors) shows P&L percentages for each week/month in a grid.
Rows = Years, Columns = Weeks (1-52) or Months (1-12).
Color scaling: Green for profits (darker for bigger wins), red for losses (darker for bigger losses).
Yearly totals in the last column.
Helps visualize strategy performance over time without manual calculations.
Input Parameters Explained
Here's a breakdown of the main inputs for easy customization:
Trade Direction: "Both" (default), "Long Only," or "Short Only" – Controls allowed trade types.
Test Only Selected Month: If true, backtests only the specified month from the start year.
Start Year/Month: Sets the backtest start date (default: Jan 2022).
Include Weekends: If true, sessions can include weekends (rarely useful for forex).
Only One Trade Per Session: Limits to one entry per London/NY session (default: true).
Risk Management Time Frame: "Weekly" or "Monthly" – For P&L limits.
Enable Limits: Toggle weekly/monthly stop trading on loss/profit thresholds.
Loss Limit (%)/Profit Target (%): Stops trading if P&L hits these (e.g., -3% loss or +7% profit).
London/New York Session: Enable/disable, with time ranges (e.g., London: 0800-1300 UTC).
Left/Right Bars: For pivot detection (default: 4 left, 2 right) – Higher values smooth signals.
Support/Resistance: Toggle lines, colors, style, width.
Change Bar Color: Colors bars based on trend.
TP RR: Take-profit risk-reward (default: 1.2).
Stoploss Reduce Value: Tightens SL (negative values widen it, 0-0.9 range).
Stoploss Gap: Adds a buffer to SL (e.g., 0.1% away from support).
Move to Breakeven: Enables SL move to entry at a profit ratio (default: true, 1:1).
Use Risk Amount $: If true, risks fixed $ (e.g., 500); else, % of equity (default: 1%).
EMA 3: The slow EMA period (default: 200) for trend filter.
Performance Display: Toggle table, location (e.g., Bottom Right), size, colors, scaling for heatmaps.
Setup and Usage Tips
Add to Chart: Copy the script into TradingView's Pine Editor, compile, and add to your chart.
Backtesting: Use the Strategy Tester tab. Adjust inputs and test on historical data.
Live Trading: Connect alerts to a broker or bot (e.g., via webhook). The script sends JSON-formatted alerts for entry, exit, SL moves, and limits.
Best Markets: Works well on crypto pairs like SOLUSD or RUNEUSD on 4H timeframes.
Risk Warning: This is not financial advice. Always use demo accounts first. Past performance doesn't guarantee future results. Commission is set to 0.05% by default – adjust for your broker.
Customization: Experiment with EMA length or RR ratio for your style.