PROTECTED SOURCE SCRIPT
Telah dikemas kini

The Green Machine

112
The Green Machine
The Green Machine is a trend-following strategy that uses a dynamic, volatility-based trailing stop to manage positions. It automatically flips between long and short positions based on market behavior, aiming to ride trends while cutting losses early.

🔍 Strategy Logic
A trailing stop is calculated using historical volatility.

When price breaches the trailing stop, the strategy closes the position and opens a trade in the opposite direction.

Each new position resets the trailing logic based on current price conditions.

This strategy does not use external indicators; it relies solely on statistical volatility for dynamic stop adjustment.

⚙️ Default Strategy Settings
Account Size: $10,000

Risk per Trade: 1% of equity

Commission: 0.1% per trade (applied via strategy() settings)

Slippage: 1 tick per trade

Backtest Dataset: All available data on selected timeframe

Minimum Trades Required: 100+ for statistical evaluation

These assumptions reflect common retail trading conditions and are intended to present realistic results.

📈 Best Use Cases
Trending markets (e.g., crypto, forex, momentum stocks)

Timeframes: Works best on 15m–4h for active trading, daily for swing setups

Can be paired with other entry filters (like RSI, MA crossovers, or volume-based entries)

⚠️ Important Notes
The script flips bias automatically; it is not intended for manual trade confirmation.

Use in demo/backtest mode first to understand the behavior.

All logic and calculations are embedded directly in the script. No external dependencies.

This script is provided for educational and research purposes. Past performance is not indicative of future results. Always test thoroughly before using in live environments.
Nota Keluaran
🎯 Purpose
This is a clean, backtest-only version of the “Green Machine” strategy, designed to detect statistical trend reversals using volatility-based trailing stop levels. It enters long or short positions based on bias flips in market direction.

🔍 Key Features
✅ No visual clutter: All plot lines, labels, and shapes have been removed — it's optimized purely for backtesting.

✅ Fixed order size: Each trade uses a fixed quantity of 1 unit — no compounding, ideal for clean backtesting and analysis.

✅ Volatility-based logic: Uses a 3 standard deviation trailing stop calculated from log-scaled true range.

✅ Bias flip detection: Detects when market sentiment flips between bearish and bullish based on statistical thresholds.

✅ Recommended timeframes: Designed to work best on 5-minute and 10-minute charts, where market structure and volatility patterns are more consistent and actionable.

✅ Timeframe reminder: Shows a note on the chart prompting users to switch to the recommended timeframes.

🧠 How It Works
Volatility Modeling:

Calculates a custom trailing stop using a 3-sigma (standard deviation) volatility envelope from historical log-transformed true range.

Bias Logic:

Maintains a "bias" state (BULLISH or BEARISH) that flips when price closes beyond a calculated trail level.

Trade Signals:

A buy is triggered when the bias flips to bullish.

A sell is triggered when the bias flips to bearish.

Trade Execution:

Strategy enters either a long or short position based on the new bias.

Each time a new trade signal appears, the opposite position is closed.

⏱️ Timeframe Usage Recommendation
✅ Best performance has been observed on:

5-minute (5m) chart

10-minute (10m) chart

These timeframes offer a balance between noise and responsiveness for the statistical trail system.

🧪 Intended Use
Pure backtesting and signal testing.

Easily integrated into more complex trading systems.

Suitable for algorithmic trading development.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.