PROTECTED SOURCE SCRIPT
AMF PG Consensus Engine v3.5

AMF PG Consensus Engine v3.5
1. Core Philosophy: A Multi-Stage Confirmation System for High-Probability Signals
In the world of automated trading, the real challenge isn't generating signals, but filtering out the noise. The AMF PG Consensus Engine is designed to address this challenge. It operates on a simple yet powerful philosophy: a buy or sell signal is valid only if it receives confirmation from multiple, independent analysis modules.
This strategy isn't a "black box." It's a transparent, rules-based framework that transforms market momentum and momentum into a final consensus and then directs a core trend-following engine. The goal is to avoid trading in adverse market conditions and only act when the different analysis layers agree.
2. How the Consensus Engine Works: Two Confirmation Layers
Before the core engine is allowed to seek a trade, the market must go through a two-stage "confirmation" process. Both filters can be enabled or disabled from the settings, allowing users to customize the strategy's stringency level.
Confirmation Module 1: Renko Regime Filter
This module's purpose is to answer a critical question: "Is the market currently in a stable, directional trend, or is it volatile and unstable?" Instead of standard indicators, it creates a timeless Renko chart in the background. A trend is confirmed only if a minimum number of consecutive Renko bricks form in the same direction. This method is extremely effective at filtering out noisy, sideways price movements, which are often unsuccessful for trend-following systems. The brick size can be set to a fixed value or automatically calculated based on the Average True Range (ATR) for better fit.
Confirmation Module 2: Candle Scoring Engine
This module analyzes the raw strength of price action by scoring each candle individually. It evaluates the candle's direction, body size relative to the previous candle, and the change in closing price. These factors are converted into a score for each bar. A cumulative score is then calculated over a user-defined period. A buy trade is only confirmed if this cumulative momentum score exceeds a positive threshold, indicating sustained buying pressure. Conversely, a sell trade requires the score to fall below a negative threshold, indicating sustained selling pressure.
3. Core Engine: AMF PG Trend Follower
When both confirmation modules give the "green light" for a specific direction (e.g., buy), the core AMF PG (Praetorian Guard) engine is activated. This is a proprietary, volatility-sensitive trend-following mechanism.
It calculates a dynamic upper and lower band around the price. These bands are not static; their distance from the price is constantly adjusted based on recent market volatility and price expansion. A trade is initiated when the price breaks out of these bands in the direction confirmed by the consensus engine. The opposing band then serves as the initial trailing stop-loss, adjusted as the trend progresses.
4. Embedded Filters for Additional Security
To further enhance signal quality, the core engine has several embedded filters that are always active and cannot be disabled by the user:
Trend Strength Filter: To confirm that a trend has sufficient strength, a trade will not be initiated unless the ADX (Average Directional Index) is above a certain threshold.
Sideways Market Filter: The Chop Index is used to prevent trading in extremely sideways and directionless markets.
5. Risk Management: Maximum Drawdown Protection
A key feature of this strategy is its built-in capital protection mechanism. Users can set a maximum capital drawdown limit of a percentage. If the strategy's capital falls by this percentage from its peak, the "DD Protect" feature is activated, closing all open positions and preventing new trades from being opened. This acts as a final emergency brake to protect capital during unpredictable market conditions or underperformance of the strategy.
6. Automation-Ready: Customizable Webhook Alerts
This strategy was developed for modern investors looking to automate their trading. Instead of generic alert messages, you can define your own custom alert text directly from the script's settings.
This feature is particularly powerful for connecting to third-party automation services via Webhooks. You can configure the alert message in the JSON format required by your service (such as {"action": "buy", "symbol": "{{ticker}}"}). This allows you to seamlessly connect your strategy signals directly to your trading account.
7. Strategy Backtest Information
Please remember that past performance is not indicative of future results. The published chart and performance report were generated on the 4-hour timeframe of the BTC/USD pair with the following settings:
Test Period: January 1, 2016 - October 31, 2025
Default Position Size: 15% of Capital
Pyramiding: Closed
Commission: 0.0008
Slippage: 2 ticks (Please enter the slippage you used in your own tests)
Testing Approach: The published test includes 799 trades and is statistically significant. It is strongly recommended that you test on different assets and timeframes for your own analysis. The default settings are a template and should be adjusted by the user for their own analysis.
1. Core Philosophy: A Multi-Stage Confirmation System for High-Probability Signals
In the world of automated trading, the real challenge isn't generating signals, but filtering out the noise. The AMF PG Consensus Engine is designed to address this challenge. It operates on a simple yet powerful philosophy: a buy or sell signal is valid only if it receives confirmation from multiple, independent analysis modules.
This strategy isn't a "black box." It's a transparent, rules-based framework that transforms market momentum and momentum into a final consensus and then directs a core trend-following engine. The goal is to avoid trading in adverse market conditions and only act when the different analysis layers agree.
2. How the Consensus Engine Works: Two Confirmation Layers
Before the core engine is allowed to seek a trade, the market must go through a two-stage "confirmation" process. Both filters can be enabled or disabled from the settings, allowing users to customize the strategy's stringency level.
Confirmation Module 1: Renko Regime Filter
This module's purpose is to answer a critical question: "Is the market currently in a stable, directional trend, or is it volatile and unstable?" Instead of standard indicators, it creates a timeless Renko chart in the background. A trend is confirmed only if a minimum number of consecutive Renko bricks form in the same direction. This method is extremely effective at filtering out noisy, sideways price movements, which are often unsuccessful for trend-following systems. The brick size can be set to a fixed value or automatically calculated based on the Average True Range (ATR) for better fit.
Confirmation Module 2: Candle Scoring Engine
This module analyzes the raw strength of price action by scoring each candle individually. It evaluates the candle's direction, body size relative to the previous candle, and the change in closing price. These factors are converted into a score for each bar. A cumulative score is then calculated over a user-defined period. A buy trade is only confirmed if this cumulative momentum score exceeds a positive threshold, indicating sustained buying pressure. Conversely, a sell trade requires the score to fall below a negative threshold, indicating sustained selling pressure.
3. Core Engine: AMF PG Trend Follower
When both confirmation modules give the "green light" for a specific direction (e.g., buy), the core AMF PG (Praetorian Guard) engine is activated. This is a proprietary, volatility-sensitive trend-following mechanism.
It calculates a dynamic upper and lower band around the price. These bands are not static; their distance from the price is constantly adjusted based on recent market volatility and price expansion. A trade is initiated when the price breaks out of these bands in the direction confirmed by the consensus engine. The opposing band then serves as the initial trailing stop-loss, adjusted as the trend progresses.
4. Embedded Filters for Additional Security
To further enhance signal quality, the core engine has several embedded filters that are always active and cannot be disabled by the user:
Trend Strength Filter: To confirm that a trend has sufficient strength, a trade will not be initiated unless the ADX (Average Directional Index) is above a certain threshold.
Sideways Market Filter: The Chop Index is used to prevent trading in extremely sideways and directionless markets.
5. Risk Management: Maximum Drawdown Protection
A key feature of this strategy is its built-in capital protection mechanism. Users can set a maximum capital drawdown limit of a percentage. If the strategy's capital falls by this percentage from its peak, the "DD Protect" feature is activated, closing all open positions and preventing new trades from being opened. This acts as a final emergency brake to protect capital during unpredictable market conditions or underperformance of the strategy.
6. Automation-Ready: Customizable Webhook Alerts
This strategy was developed for modern investors looking to automate their trading. Instead of generic alert messages, you can define your own custom alert text directly from the script's settings.
This feature is particularly powerful for connecting to third-party automation services via Webhooks. You can configure the alert message in the JSON format required by your service (such as {"action": "buy", "symbol": "{{ticker}}"}). This allows you to seamlessly connect your strategy signals directly to your trading account.
7. Strategy Backtest Information
Please remember that past performance is not indicative of future results. The published chart and performance report were generated on the 4-hour timeframe of the BTC/USD pair with the following settings:
Test Period: January 1, 2016 - October 31, 2025
Default Position Size: 15% of Capital
Pyramiding: Closed
Commission: 0.0008
Slippage: 2 ticks (Please enter the slippage you used in your own tests)
Testing Approach: The published test includes 799 trades and is statistically significant. It is strongly recommended that you test on different assets and timeframes for your own analysis. The default settings are a template and should be adjusted by the user for their own analysis.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.