Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Fisher Transform – Amibroker AFL Code

2 min read

The Fisher Transform is a technical analysis indicator developed by John F. Ehlers, designed to identify potential turning points in the price movements of financial markets. It achieves this by transforming price data into a Gaussian normal distribution, which emphasizes extreme price movements and makes turning points more statistically significant.

Key Features of the Fisher Transform

  • Normalization: The Fisher Transform converts price data into a normalized form, typically ranging between -4 and +4. This normalization allows traders to easily identify overbought and oversold conditions.
  • Sensitivity to Price Changes: Due to its mathematical properties, the indicator reacts sharply to even minor changes in price, making turning points more pronounced.
  • Gaussian Distribution: By mapping prices onto a Gaussian (normal) distribution, the Fisher Transform ensures that the transformed values have a consistent statistical behavior, which is beneficial for identifying extreme values.

Fisher Transform Indicator in Amibroker AFL

// Fisher Transform Indicator in Amibroker AFL
// Created by Rajandran R (Creator - OpenAlgo / Founder - Marketcalls)
// Date - 14th Sep 2024

// Define parameters
Len = Param("Length", 9, 1, 100);

// Calculate HL2, highest, and lowest values
HL2 = (High + Low) / 2;
high_ = HHV(HL2, Len);
low_ = LLV(HL2, Len);

// Define the round_ function
 function round_(val) {
    return IIf(val > 0.99, 0.999, IIf(val < -0.99, -0.999, val));
}

// Initialize arrays
value = Null;
fish1 = Null;
value[0] = 0;
fish1[0] = 0;

// Recursive calculation of 'value' and 'fish1'
for(i = 1; i < BarCount; i++) {
    denom = high_[i] - low_[i];
    if(denom != 0) {
        temp = (HL2[i] - low_[i]) / denom - 0.5;
    } else {
        temp = 0;
    }
    value[i] = round_(0.66 * temp + 0.67 * value[i - 1]);
    if(value[i] != 1 && value[i] != -1) {
        fish1[i] = 0.5 * log((1 + value[i]) / (1 - value[i])) + 0.5 * fish1[i - 1];
    } else {
        fish1[i] = fish1[i - 1];
    }
}

// Calculate 'fish2' as the previous value of 'fish1'
fish2 = Ref(fish1, -1);

// Define custom colors
ColorRedCustom = ColorRGB(233, 30, 99);
ColorBlueCustom = ColorRGB(41, 98, 255);
ColorOrangeCustom = ColorRGB(255, 109, 0);

// Plot horizontal lines

Plot(0, "", ColorRedCustom, styleLine | styleNoLabel | styleNoTitle);


// Plot 'fish1' and 'fish2'
Plot(fish1, "Fisher", ColorBlueCustom);
Plot(fish2, "Trigger", ColorOrangeCustom);

Interpreting the Fisher Transform

  • Overbought and Oversold Conditions: When the Fisher Transform reaches extreme high values (e.g., above 1.5), the market may be considered overbought, signaling a potential price decline. Conversely, extreme low values (e.g., below -1.5) may indicate oversold conditions and a potential price increase.
  • Crossovers: A common trading signal is generated when the Fisher Transform line crosses its trigger line (often a lagged version of itself). A crossover above the trigger line may signal a buy opportunity, while a crossover below may signal a sell opportunity.
  • Divergences: Traders may look for divergences between the Fisher Transform and the price action. If the price makes a new high while the Fisher Transform does not, it could indicate weakening momentum.

Advantages of the Fisher Transform

  • Enhanced Signal Clarity: By transforming price data into a normal distribution, the Fisher Transform makes turning points more pronounced and easier to identify.
  • Early Warning Signals: The sensitivity of the indicator allows it to provide early warnings of potential reversals, which can be advantageous for traders seeking to enter or exit positions promptly.

Limitations

  • False Signals: The increased sensitivity can also lead to false signals, especially in volatile or sideways markets.
  • Parameter Dependency: The performance of the Fisher Transform can be heavily dependent on the chosen lookback period. Traders may need to adjust the length parameter to suit different market conditions or assets.

Practical Application

In platforms like Amibroker, traders can implement the Fisher Transform using AFL (Amibroker Formula Language) to customize the indicator according to their trading strategy. By adjusting parameters and combining the Fisher Transform with other technical indicators, traders can enhance their analysis and decision-making process.

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More