Strategy Overview
Name: "XAU-USD - OANDA - Updated Jan 2025 - by PB ver 5"
Purpose: A Renko-based trading strategy for XAU-USD, with support for date/session filters, dynamic trailing stops, and webhook integration for external trade execution.
Key Features
Backtesting Date Filter
useDateFilter: Enables/disables filtering based on a backtesting date range.
backtestStartDate & backtestEndDate: Define the date range for the backtest.
Trades are only executed if the current time (time) falls within this range (inTradeWindow).
Session and Days Filtering
Uses a specified session (SessionInput) and day configuration (daysInput) to determine active trading hours.
inSession: Determines if the current time falls within the specified session.
A background color (bgcolor) is applied during active sessions for visual clarity.
Renko Chart Integration
Constructs Renko charts using the traditional method:
renko_tickerid: Creates a Renko series based on the ticker.
renko_open & renko_close: Tracks Renko open and close levels.
Signals are generated using crossovers:
Long Entry: Renko close crosses above Renko open.
Short Entry: Renko close crosses below Renko open.
Trade Management
Long/Short Toggle: Trades can be enabled/disabled using checkboxes (enableLong & enableShort).
Trailing Stops: Automatically adjusts stop-loss levels for active trades:
Longs: Trails below the average position price by a fixed offset.
Shorts: Trails above the average position price by the same offset.
Trades are closed when the price exits the defined session or reverses signal:
E.g., A long position is closed if a short signal is generated and vice versa.
Webhooks for Integration
Includes parameters (code, buyID, sellID) to integrate with external trading platforms (e.g., Dhan) for automated execution via webhooks.
Visualization
Plots Renko open and close levels (plot).
Plots trailing stop levels for both long and short positions for transparency.
Conditions for Trade Execution
General Requirements:
The current time must fall within the session (inSession).
The current date must match the backtesting filter (inTradeWindow).
Entry Signals:
Long Entry: Renko close crosses above Renko open.
Short Entry: Renko close crosses below Renko open.
Exit Conditions:
Trailing stops (trail_offset) trigger exits.
Opposite trade signals cause the current trade to close before entering the new position.
All trades are forcefully closed when out of the active session.
Plotted Components
Renko Close (Red) and Open (Green): Visualize Renko levels on the chart.
Trailing Stops:
Blue line: Trailing stop for long positions.
Yellow line: Trailing stop for short positions.
Customizable Parameters
Input Settings:
Date range (backtestStartDate, backtestEndDate).
Session and days (SessionInput, daysInput).
Renko brick size (Bsize).
Trailing stop value (trail).
Toggleable Features:
Enable/disable long (enableLong) and short (enableShort) trades.
Advantages
Combines Renko simplicity with session-specific trading.
Offers flexibility in trade filtering and execution.
Trailing stops enhance risk management.
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在
使用條款閱讀更多資訊。