Description
This is a very fast crossover trade trigger indicator and if used in conjunction with a good trend-following tool it is predictive and can be applied in strategies (coming soon). When compared to MACD or other crossover indicators the Fisher Transform is clearly superior and timely.
qualitiedx2
Joined on 30.09.2011
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: FisherTransform.algo
- Rating: 5
- Installs: 9190
- Modified: 13/10/2021 09:54
Comments
Most of your indicators are great! and really useful
Unfortunatelly, this one doesn't show anything once loaded onto the chart
Moreover, the variable from line 22 (int tr = 0;) is not used anywhere..
Could you, by any chance, look into this code again, please?
Sorry I might be wrong but can you explain me why do you calculate the fisher transform without calculating the Correlation coefficient ? thank you
Here is the code optimized, and with a fix. the 0.9999 check should be after assigning a value to Value1, thats why some periods appear are blank.
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class FisherTransform : Indicator
{
[Output("FisherTransform", LineColor = "Orange")]
public IndicatorDataSeries Fish { get; set; }
[Output("Trigger", LineColor = "Green")]
public IndicatorDataSeries trigger { get; set; }
[Parameter(DefaultValue = 13, MinValue = 2)]
public int Len { get; set; }
double MaxH;
double MinL;
private IndicatorDataSeries Value1;
protected override void Initialize()
{
Value1 = CreateDataSeries();
}
public override void Calculate(int index)
{
if (index <= Len + 1)
{
Value1[index - 1] = 1;
Fish[index - 1] = 0;
}
MaxH = MarketSeries.Median.Maximum(Len);
MinL = MarketSeries.Median.Minimum(Len);
Value1[index] = 0.5 * 2 * ((MarketSeries.Median[index] - MinL) / (MaxH - MinL) - 0.5) + 0.5 * Value1[index - 1];
if (Value1[index] > 0.9999)
Value1[index] = 0.9999;
else if (Value1[index] < -0.9999)
Value1[index] = -0.9999;
Fish[index] = 0.25 * Math.Log((1 + Value1[index]) / (1 - Value1[index])) + 0.5 * Fish[index - 1];
trigger[index] = Fish[index - 1];
}
}
}