Description
begin
if (Low < BollingerBands(2.0, 20, 0)|1|) and (Close > Open) then PaintBar(clyellow )
else if(High > BollingerBands(2.0, 20, 0)|0|) and (Close < Open) then PaintBar(clyellow);
end
end;
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Levels(-100, -50, 0, 50, 100)]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class mPFE : Indicator
{
[Parameter("PeriodFastROC (7)", DefaultValue = 1, MinValue = 1)]
public int PeriodFastROC { get; set; }
[Parameter("PeriodSlowROC (9)", DefaultValue = 9, MinValue = 3)]
public int PeriodSlowROC { get; set; }
[Parameter("PeriodMA (5)", DefaultValue = 5, MinValue = 1)]
public int PeriodMA { get; set; }
[Parameter("PDS (710)", DefaultValue = 10, MinValue = 1)]
public int PDS { get; set; }
[Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MAType { get; set; }
[Output("olarized Fractal Efficiency", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries outPFE { get; set; }
private IndicatorDataSeries _raw;
private IndicatorDataSeries _pfe;
private MovingAverage _pfema;
double slow, fast, x, y, z;
protected override void Initialize()
{
_raw = CreateDataSeries();
_pfe = CreateDataSeries();
_pfema = Indicators.MovingAverage(_raw, PeriodMA, MAType);
}
public override void Calculate(int i)
{
slow = (Bars.ClosePrices[i + PeriodSlowROC] != 0 ? 100.0 * (Bars.ClosePrices[i] / Bars.ClosePrices[i + PeriodSlowROC] - 1) : 0);
fast = (Bars.ClosePrices[i + PeriodFastROC] != 0 ? 100.0 * (Bars.ClosePrices[i] / Bars.ClosePrices[i + PeriodFastROC] - 1) : 0);
x = Math.Sqrt(slow * slow + 100.0);
y = Math.Sqrt(fast * fast + 1.0) + PDS;
z = x / (y != 0 ? y : 1);
_raw[i] = (Bars.ClosePrices[i] > Bars.ClosePrices[i + PeriodSlowROC] ? 100.0 * z : -100.0 * z);
outPFE[i] = _pfema.Result[i];
}
}
}
MA
mariocontaforex
Joined on 01.02.2023
- Distribution: Paid
- Language: C#
- Trading platform: cTrader Automate
- File name: mPFE.algo
- Rating: 0
- Installs: 185
- Modified: 01/02/2023 15:41
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.
you can download the expression converted to indicator: https://ctrader.com/algos/indicators/show/3260