Description
Fisher Transform of normalized prices flows by Fisher Transform allows you to detect the peak oscillations of the indicator line, which indicate the trend reversal points.
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(0)]
[Indicator(AccessRights = AccessRights.None)]
public class mFTNP : Indicator
{
[Parameter("DataSeries (close)", DefaultValue = "Close")]
public DataSeries inDataSeries { get; set; }
[Parameter("Periods (10)", DefaultValue = 10)]
public int inpPeriods { get; set; }
[Output("Fisher", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outFisher { get; set; }
[Output("Trigger", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
public IndicatorDataSeries outTrigger { get; set; }
private IndicatorDataSeries _fisher, _trigger, _raw;
private MovingAverage _pr;
protected override void Initialize()
{
_fisher = CreateDataSeries();
_trigger = CreateDataSeries();
_raw = CreateDataSeries();
_pr = Indicators.MovingAverage(inDataSeries, 1, MovingAverageType.Simple);
}
public override void Calculate(int i)
{
_raw[i] = 0.667 * ((_pr.Result[i] - _pr.Result.Minimum(inpPeriods)) / (_pr.Result.Maximum(inpPeriods) - _pr.Result.Minimum(inpPeriods)) - 0.5 + (i>inpPeriods ? _raw[i-1] : 0));
_raw[i] = Math.Max(Math.Min(_raw[i], 0.999),-0.999);
_fisher[i] = i>inpPeriods ? 0.5 * (Math.Log((1.0 + _raw[i]) / (1.0 - _raw[i])) + _fisher[i-1]) : 0;
_trigger[i] = i>inpPeriods ? _fisher[i-1] : _fisher[i];
outFisher[i] = _fisher[i];
outTrigger[i] = _trigger[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mFTNP.algo
- Rating: 5
- Installs: 836
- Modified: 18/12/2022 20:51
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
The content of the article is very interesting, I like the information on this topic and I hope many people will know your article because it is very good and interesting.
Eggy Car