INVITE-ONLY SCRIPT

GKD-BT Optimizer Full GKD Backtest [Loxx]

Updated
The Giga Kaleidoscope GKD-BT Optimizer Full GKD Backtest is a Backtest module included in AlgxTrading's "Giga Kaleidoscope Modularized Trading System." (see the section Giga Kaleidoscope (GKD) Modularized Trading System below for an explanation of the GKD trading system)

**the backtest data rendered to the chart above and all screenshots below use $5 commission per trade and 10% equity per trade with $1 million initial capital**

█ GKD-BT Optimizer Full GKD Backtest

The GKD-BT Optimizer Full GKD Backtest is a comprehensive backtesting module designed to optimize the combination of key GKD indicators within AlgxTrading's "Giga Kaleidoscope Modularized Trading System." This module facilitates precise strategy refinement by allowing traders to configure and optimize the following critical GKD indicators:

  • GKD-B Baseline
  • GKD-V Volatility/Volume
  • GKD-C Confirmation 1
  • GKD-C Confirmation 2
  • GKD-C Continuation

Each indicator is equipped with an "Optimizer" mode, enabling dynamic feedback and iterative improvements directly into the backtesting environment. This integrated approach ensures that each component contributes effectively to the overall strategy, providing a robust framework for achieving optimized trading outcomes.

The GKD-BT Optimizer supports granular test configurations including a single take profit and stop loss setting, and allows for targeted testing within specified date ranges to simulate forward testing with historical data. This feature is essential for evaluating the resilience and effectiveness of trading strategies under various market conditions.

Furthermore, the module is designed with user-centric features such as:

  • Customizable Trading Panel: Displays critical backtest results and trade statistics, which can be shown or hidden as per user preference.
  • Highlighting Thresholds: Users can set thresholds for Total Percent Wins, Percent Profitable, and Profit Factor, which helps in quickly identifying the most relevant metrics for analysis.

The detailed setup ensures that traders can not only adjust their strategies based on historical performance but also fine-tune their approach to meet specific trading objectives.

snapshot

🔶 To configure this indicator: ***all GKD indicators listed below are all included in the AlgxTrading trading system package***

1. Add GKD-C Confirmation, GKD-B Baseline, GKD-V Volatility/Volume, GKD-C Confirmation 2, and GKD-C Continuation to your chart
2. In the GKD-B Baseline indicator, change "Baseline Type" to "Optimizer"
3. In the GKD-V Volatility/Volume indicator, change "Volatility/Volume Type" to "Optimizer"
4. In the GKD-C Confirmation 1 indicator, change "Confirmation Type" to "Optimizer"
5. In the GKD-C Confirmation 2 indicator, change "Confirmation Type" to "Optimizer"
6. In the GKD-C Continuation indicator, change "Confirmation Type" to "Optimizer"

An example of steps 2-6. In the screenshot example below, we change the value "Confirmation Type" in the GKD-C Fisher Transform indicator to "Optimizer"
snapshot

7. In the GKD-BT Optimizer Full GKD Backtest, import the value "Input into NEW GKD-BT Backtest" from the GKD-B Baseline indicator into the field "Import GKD-B Baseline indicator"
8. In the GKD-BT Optimizer Full GKD Backtest, import the value "Input into NEW GKD-BT Backtest" from the GKD-V Volatility/Volume indicator into the field "Import GKD-V Volatility/Volume indicator"
9. In the GKD-BT Optimizer Full GKD Backtest, import the value "Input into NEW GKD-BT Backtest" from the GKD-C Confirmation 1 indicator into the field "Import GKD-C Confirmation 1 indicator"
10. In the GKD-BT Optimizer Full GKD Backtest, import the value "Input into NEW GKD-BT Backtest" from the GKD-C Confirmation 2 indicator into the field "Import GKD-C Confirmation 2 indicator"
11. In the GKD-BT Optimizer Full GKD Backtest, import the value "Input into NEW GKD-BT Backtest" from the GKD-C Continuation indicator into the field "Import GKD-C Continuation indicator"

An example of steps 7-11. In the screenshot example below, we import the value "Input into NEW GKD-BT Backtest" from the GKD-C Coppock Curve indicator into the GKD-BT Optimizer Full GKD Backtest
snapshot

12. Decide which of the 5 indicators you wish to optimize in first in the GKD-BT Optimizer Full GKD Backtest. Change the value of the import from "Input into NEW GKD-BT Backtest" to "Input into NEW GKD-BT Optimizer Signals"

An example of step 12. In the screenshot example below, we chose to optimize the Confirmation 1 indicator, the GKD-C Fisher Transform. We change the value of the field "Import GKD-C Confirmation 1 indicator" from "Input into NEW GKD-BT Backtest" to "Input into NEW GKD-BT Optimizer Signals"
snapshot

13. In the GKD-BT Optimizer Full GKD Backtest and under the "Optimization Settings", use the dropdown menu "Optimization Indicator" to select the type of indicator you selected from step 12 above: "Baseline", "Volatility/Volume", "Confirmation 1", "Confirmation 2", or "Continuation"
14. In the GKD-BT Optimizer Full GKD Backtest and under the "Optimization Settings", import the value "Input into NEW GKD-BT Optimizer Start" from the indicator you selected to optimize in step 12 above into the field "Import Optimization Indicator Start"
15. In the GKD-BT Optimizer Full GKD Backtest and under the "Optimization Settings", import the value "Input into NEW GKD-BT Optimizer Skip" from the indicator you selected to optimize in step 12 above into the field "Import Optimization Indicator Skip"

An example of step 13. In the screenshot example below, we select "Confirmation 1" from the "Optimization Indicator" dropdown menu
snapshot

An example of steps 14 and 15. In the screenshot example below, we import "Import Optimization Indicator Start" and "Import Optimization Indicator Skip" from the GKD-C Fisher Transform indicator into their respective fields
snapshot

🔶 This backtest includes the following metrics

  • Net profit: Overall profit or loss achieved.
  • Total Closed Trades: Total number of closed trades, both winning and losing.
  • Total Percent Wins: Total wins, whether long or short, for the selected time interval regardless of commissions and other profit-modifying addons.
  • Percent Profitable: Total wins, whether long or short, that are also profitable, taking commissions into account.
  • Profit Factor: The ratio of gross profits to gross losses, indicating how much money the strategy made for every unit of money it lost.
  • Average Profit per Trade: The average gain or loss per trade, calculated by dividing the net profit by the total number of closed trades.
  • Average Number of Bars in Trade: The average number of bars that elapsed during trades for all closed trades.

🔶 Summary of notable settings not already explained above

🔹 Backtest Properties

These settings define the financial and logistical parameters of the trading simulation, including:

  • Initial Capital: Specifies the starting balance for the backtest, setting the baseline for measuring profitability and loss.
  • Order Size: Determines the size of trades, which can be fixed or a percentage of the equity, affecting risk and return.
  • Order Type: Chooses between fixed contract sizes or a percentage-based order size, allowing for static or dynamic trading volumes.
  • Commission per Order: Accounts for trading costs, subtracting these from profits to provide a more accurate net performance result.


🔹 Signal Qualifiers

This group of settings establishes criteria related to the strategy's Baseline, Volatility/Volume, and Confirmation 2 indicators in relation to the GKD-C Confirmation 1 indicator, which is crucial for validating trade signals. These include:

Maximum Allowable Post Signal Baseline Cross Bars Back: Sets the maximum number of bars that can elapse after a signal generated by a GKD-C Confirmation 1 indicator triggers. If the GKD-C Confirmation 1 indicator generates a long/short signal that doesn't yet agree with the trend position of the Baseline, then should the Baseline "catch-up" to the long/short trend of the GKD-C Confirmation 1 indicator within the number of bars specified by this setting, then a signal is generated.

Maximum Allowable Post Signal Volatility/Volume Cross Bars Back: Sets the maximum number of bars that can elapse after a signal generated by a GKD-C Confirmation 1 indicator triggers. If the GKD-C Confirmation 1 indicator generates a long/short signal that doesn't yet agree with the position of the Volatility/Volume, then should the Volatility/Volume "catch-up" with the long/short of the GKD-C Confirmation 1 indicator within the number of bars specified by this setting, then a signal is generated.

Maximum Allowable Post Signal Confirmation 2 Cross Bars Back: Sets the maximum number of bars that can elapse after a signal generated by a GKD-C Confirmation 1 indicator triggers. If the GKD-C Confirmation 1 indicator generates a long/short signal that doesn't yet agree with the trend position of the Confirmation 2, then should the Confirmation 2 "catch-up" to the long/short trend of the GKD-C Confirmation 1 indicator within the number of bars specified by this setting, then a signal is generated.

🔹 Signal Settings

  • Signal Options: These settings allow users to toggle the visibility of different types of entries based on the strategy criteria, such as standard entries, baseline entries, and continuation entries.
  • Standard Entry Rules Settings: Detailed criteria for standard entries can be customized here, including conditions on baseline agreement, price within specific zones, and agreement with other confirmation indicators.
  • 1-Candle Rule Standard Entry Rules Settings: Similar to standard entries, but with a focus on conditions that must be met within a one-candle timeframe.
  • Baseline Entry Rules Settings: Specifies rules for entries based on the baseline, including conditions on confirmation agreement and price zones.
  • Volatility/Volume Entry Rules Settings: This includes settings for entries based on volatility or volume conditions, with specific rules on confirmation agreement and baseline agreement.
  • Confirmation 2 Entry Rules Settings: Settings here define the rules for entries based on a second confirmation indicator, detailing the required agreements and conditions.
  • Continuation Entry Rules Settings: This group outlines the conditions for continuation entries, focusing on agreement with baseline and confirmation indicators since the entry signal trigger.


🔹 Volatility Settings

Volatility PnL Settings: Parameters for defining the type of volatility measure to use, its period, and multipliers for profit and stop levels.

Volatility Types Included

  • Standard Deviation of Logarithmic Returns: Quantifies asset volatility using the standard deviation applied to logarithmic returns, capturing symmetric price movements and financial returns' compound nature.
  • Exponential Weighted Moving Average (EWMA) for Volatility: Focuses on recent market information by applying exponentially decreasing weights to squared logarithmic returns, offering a dynamic view of market volatility.
  • Roger-Satchell Volatility Measure: Estimates asset volatility by analyzing the high, low, open, and close prices, providing a nuanced view of intraday volatility and market dynamics.
  • Close-to-Close Volatility Measure: Calculates volatility based on the closing prices of stocks, offering a streamlined but limited perspective on market behavior.
  • Parkinson Volatility Measure: Enhances volatility estimation by including high and low prices of the trading day, capturing a more accurate reflection of intraday market movements.
  • Garman-Klass Volatility Measure: Incorporates open, high, low, and close prices for a comprehensive daily volatility measure, capturing significant price movements and market activity.
  • Yang-Zhang Volatility Measure: Offers an efficient estimation of stock market volatility by combining overnight and intraday price movements, capturing opening jumps and overall market dynamics.
  • Garman-Klass-Yang-Zhang Volatility Measure: Merges the benefits of Garman-Klass and Yang-Zhang measures, providing a fuller picture of market volatility including opening market reactions.
  • Pseudo GARCH(2,2) Volatility Model: Mimics a GARCH(2,2) process using exponential moving averages of squared returns, highlighting volatility shocks and their future impact.
  • ER-Adaptive Average True Range (ATR): Adjusts the ATR period length based on market efficiency, offering a volatility measure that adapts to changing market conditions.
  • Adaptive Deviation: Dynamically adjusts its calculation period to offer a nuanced measure of volatility that responds to the market's intrinsic rhythms.
  • Median Absolute Deviation (MAD): Provides a robust measure of statistical variability, focusing on deviations from the median price, offering resilience against outliers.
  • Mean Absolute Deviation (MAD): Measures the average magnitude of deviations from the mean price, facilitating a straightforward understanding of volatility.
  • ATR (Average True Range): Finds the average of true ranges over a specified period, indicating the expected price movement and market volatility.
  • True Range Double (TRD): Offers a nuanced view of volatility by considering a broader range of price movements, identifying significant market sentiment shifts.


🔹 Other Settings

Backtest Dates: Users can specify the timeframe for the backtest, including start and end dates, as well as the acceptable entry time window.
Volatility Inputs: Additional settings related to volatility calculations, such as static percent, internal filter period for median absolute deviation, and parameters for specific volatility models.
UI Options: Settings to customize the user interface, including table activation, date panel visibility, and aesthetics like color and text size.
Export Options: Allows users to select the type of data to export from the backtest, focusing on metrics like net profit, total closed trades, and average profit per trade.

█ Giga Kaleidoscope (GKD) Modularized Trading System

The GKD Trading System is a comprehensive, algorithmic trading framework from AlgxTrading, designed to optimize trading strategies across various market conditions. It employs a modular approach, incorporating elements such as volatility assessment, trend identification through a baseline, multiple confirmation strategies for signal accuracy, and volume analysis. Key components also include specialized strategies for entry and exit, enabling precise trade execution. The system allows for extensive backtesting, providing traders with the ability to evaluate the effectiveness of their strategies using historical data. Aimed at reducing setup time, the GKD system empowers traders to focus more on strategy refinement and execution, leveraging a wide array of technical indicators for informed decision-making.

🔶 Core components of a GKD Algorithmic Trading System

Each GKD indicator is denoted with a module identifier of either: GKD-BT, GKD-B, GKD-C, GKD-V, GKD-M, or GKD-E. This allows traders to understand to which module each indicator belongs and where each indicator fits into the GKD system. The GKD algorithm is built on the principles of trend, momentum, and volatility. There are eight core components in the GKD trading algorithm:

🔹 Volatility - In the GKD trading system, volatility is used as a part of the system to help determine the appropriate stop loss and take profit levels for a trade. There are 17+ different types of volatility available in the GKD system including Average True Range (ATR), True Range Double (TRD), Close-to-Close, Garman-Klass, and more.

🔹 Baseline (GKD-B) - The baseline is essentially a moving average and is used to determine the overall direction of the market. The baseline in the GKD trading system is used to filter out trades that are not in line with the long-term trend of the market. The baseline is plotted on the chart along with other GKD indicators.

Trades are only taken when the price is in the same direction as the baseline. For example, if the baseline is sloping upwards or price is above the baseline, then only long trades are taken, and if the baseline is sloping downwards or price is below the baseline, then only short trades are taken. This approach helps to ensure that trades are in line with the overall trend of the market, and reduces the risk of entering trades that are likely to fail.

🔹 Confirmation 1, Confirmation 2, Continuation (GKD-C) - The GKD trading system incorporates technical confirmation indicators for the generation of its primary long and short signals, essential for its operation.

The GKD trading system distinguishes three specific categories. The first category, Confirmation 1, encompasses technical indicators designed to identify trends and generate explicit trading signals. The second category, Confirmation 2, a technical indicator used to identify trends; this type of indicator is primarily used to filter the Confirmation 1 indicator signals; however, this type of confirmation indicator also generates signals*. Lastly, the Continuation category includes technical indicators used in conjunction with Confirmation 1 and Confirmation 2 to generate a special type of trading signal called a "Continuation"

In a full GKD trading system all three categories generate signals. (see the section “GKD Trading System Signals” below)

🔹 Volatility/Volume (GKD-V) - Volatility/Volume indicators are used to measure the amount of buying and selling activity in a market. They are based on the trading Volatility/Volume of the market, and can provide information about the strength of the trend. In the GKD trading system, Volatility/Volume indicators are used to confirm trading signals generated by the various other GKD indicators. In the GKD trading system, Volatility is a proxy for Volume and vice versa.

Volatility/Volume indicators reduce the risk of false signals and improve the overall profitability of trades. These indicators can provide additional information about the market that is not captured by GKD-C confirmation and GKD-B baseline indicators.

🔹 Exit (GKD-E) - The exit indicator in the GKD system is an indicator that is deemed effective at identifying optimal exit points. The purpose of the exit indicator is to identify when a trend is likely to reverse or when the market conditions have changed, signaling the need to exit a trade. By using an exit indicator, traders can manage their risk and prevent significant losses.

🔹 Backtest (GKD-BT) - The GKD-BT backtest indicators link all other GKD-C, GKD-B, GKD-E, GKD-V, and GKD-M components together to create a GKD trading system. GKD-BT backtests generate signals (see the section “GKD Trading System Signals” below) from the confluence of various GKD indicators that are imported into the GKD-BT backtest. Backtest types include: GKD-BT solo and full GKD backtest strategies used for a single ticker; GKD-BT optimizers used to optimize a single indicator or the full GKD trading system; GKD-BT Multi-ticker used to backtest a single indicator or the full GKD trading system across up to ten tickers; GKD-BT exotic backtests like CC, Baseline, and Giga Stacks used to test confluence between GKD components to then be injected into a core GKD-BT Multi-ticker backtest or single ticker strategy.

🔹 Metamorphosis (GKD-M)** - The concept of a metamorphosis indicator involves the integration of two or more GKD indicators to generate a compound signal. This is achieved by evaluating the accuracy of each indicator and selecting the signal from the indicator with the highest accuracy. As an illustration, let's consider a scenario where we calculate the accuracy of 10 indicators and choose the signal from the indicator that demonstrates the highest accuracy.

The resulting output from the metamorphosis indicator can then be utilized in a GKD-BT backtest by occupying a slot that aligns with the purpose of the metamorphosis indicator. The slot can be a GKD-B, GKD-C, GKD-E, or GKD-V slot, depending on the specific requirements and objectives of the indicator. This allows for seamless integration and utilization of the compound signal within the GKD-BT framework.

*see the section “GKD Trading System Signals” below
**not a required component of the GKD algorithm

🔶 What does the application of the GKD trading system look like?

Example trading system:

  • Volatility: Average True Range (ATR) (selectable in all backtests and other related GKD indicators)
  • GKD-B Baseline: GKD-B Multi-Ticker Baseline using Hull Moving Average
  • GKD-C Confirmation 1: GKD-C Advance Trend Pressure
  • GKD-C Confirmation 2: GKD-C Dorsey Inertia
  • GKD-C Continuation: GKD-C Stochastic of RSX
  • GKD-V Volatility/Volume: GKD-V Damiani Volatmeter
  • GKD-E Exit: GKD-E MFI
  • GKD-BT Backtest: GKD-BT Multi-Ticker Full GKD Backtest
  • GKD-M Metamorphosis: GKD-M Baseline Optimizer

**all indicators mentioned above are included in the same AlgxTrading package**

Each module is passed to a GKD-BT backtest module. In the backtest module, all components are combined to formulate trading signals and statistical output. This chaining of indicators requires that each module conform to AlgxTrading's GKD protocol, therefore allowing for the testing of every possible combination of technical indicators that make up the various indictor types in the GKD algorithm.

🔶 GKD Trading System Signals

  • Standard Entry requires a sequence of conditions including a confirmation signal from GKD-C, baseline agreement, price criteria related to the Goldie Locks Zone, and concurrence from a second confirmation and volatility/volume indicators.
  • 1-Candle Standard Entry introduces a two-phase process where initial conditions must be met, followed by a retraction in price and additional confirmations in the subsequent candle, including baseline, confirmations 1 and 2, and volatility/volume criteria.
  • Baseline Entry focuses on signals generated by the GKD-B Baseline, requiring agreement from confirmation signals, specific price conditions within the Goldie Locks Zone, and a timing condition related to the confirmation 1 signal.
  • 1-Candle Baseline Entry mirrors the baseline entry but adds a requirement for a price retraction and subsequent confirmations in the following candle, maintaining the focus on the baseline's guidance.
  • Volatility/Volume Entry is predicated on signals from volatility/volume indicators, requiring support from confirmations, price criteria within the Goldie Locks Zone, baseline agreement, and a timing condition for the confirmation 1 signal.
  • 1-Candle Volatility/Volume Entry adapts the volatility/volume entry to include a phase of initial signal and agreement, followed by a retracement phase that seeks further agreement from the system's components in the subsequent candle.
  • Confirmation 2 Entry is based on the second confirmation signal, requiring the first confirmation's agreement, specific price criteria, agreement from volatility/volume indicators, and baseline, with a timing condition for the confirmation 1 signal.
  • 1-Candle Confirmation 2 Entry adds a retracement requirement to the confirmation 2 entry, necessitating additional agreements from the system's components in the candle following the signal.
  • PullBack Entry initiates with a baseline signal and agreement from the first confirmation, with a price condition related to volatility. It then looks for price to return within the Goldie Locks Zone and seeks further agreement from the system's components in the subsequent candle.
  • Continuation Entry allows for the continuation of an active position, based on a previously triggered entry strategy. It requires that the baseline hasn't crossed since the initial trigger, alongside ongoing agreements from confirmations and the baseline.


█ Conclusion

The GKD-BT Optimizer Full GKD Backtest is a critical tool within the Giga Kaleidoscope Modularized Trading System, designed for precise strategy refinement and evaluation within the GKD framework. It enables the optimization and testing of various trading indicators and strategies under different market conditions. The module's design facilitates detailed analysis of individual trading components' performance, allowing for the optimization of indicators like Baseline, Volatility/Volume, Confirmation, and Continuation. This optimization process aids traders in identifying the most effective configurations, thereby enhancing trading outcomes and strategy efficiency within the GKD ecosystem.

█ How to Access

You can see the Author's Instructions below to learn how to get access.
Release Notes
Small update to Confirmation 2 signals
Release Notes
Fixed small error on volume signals for all signals.
Release Notes
Updated to handle directional GKD-V indicators.
backtestgigakaleidoscopeGKDgkdbtloxxnnfxoptimizationoptimizerstatisticsTrend AnalysisVolatility

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact loxx for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases, you can find a good open-source alternative for free in our Community Scripts.

Author's instructions

This indicator is only available to ALGX Trading VIP group members. For instructions on how to access, send me a private message here on TradingView or message me using the contact information listed in my TradingView profile.

Want to use this script on a chart?

Warning: please read before requesting access.

Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
Also on:

Disclaimer