Description
AFR (Traduction of trading view indicator of : Tarasenko Fyodor → https://fr.tradingview.com/script/G3fUxKz2-afr/)
Here is his explanation :
Hi everyone! Sorry for not posting anything for so long again. I will be active in July, after passing my university exams. I bought some S&C magazine archives, so await my new post strategies and indicator in July, as things are gonna get real interesting! But for now let me hand you some new and interesting stuff — AFR indicator.
Actually, this is my third time republishing this indicator after a big timeout because of the battles with TV mods on reference politics (which I lost).
This is indicator was originaly made by some user from other trading website, which I can't mention because of TV reference politics.
Which principles are behind AFR?
First we define our own low and high (OL and OH respectively), which are equal to:
OL = open - ATR * ATR_Factor
OH = open + ATR * ATR_Factor,
where ATR — Average True Range,
ATR_Factor — "Factor" in the settings — multiplier for ATR.
On each tick we remember AFR's value from previous bar, if it is not 0.
When OL is greater then AFR, then AFR is equal to OL. It means that there is probably an uptrend, so we adjust AFR accordingly.
When OH is lower then AFR, then AFR is equal to OH. It means that there is probably a downtrend, so we adjust AFR accordingly.
How to use?
Green AFR — bullish trend.
Red AFR — bearish trend.
Green AFR's triangle up — buy signal — appears when AFR changes it's colour from red to green.
Red AFR's triangle down— sell signal — appears when AFR changes it's colour from green to red.
ALERTS INCLUDED!
My personal ecommendations
- You can AFR as a tool to find short-term and middle-term trends, as it does it's best to find such trends;
- If are a scalper, then you probably should try AFR on low factor settings, as AFR alone can find good scalping entries.
- As AFR is a trend indicator, please use it with other confirmation indicator to make better entries.
Hope you will find this script useful.
Take your profits!
- Tarasenko Fyodor
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class AFR : Indicator
{
[Parameter("Period", DefaultValue = 14)]
public int Period { get; set; }
[Parameter("Factor", DefaultValue = 2.0, Step = 0.1)]
public double AtrFactor { get; set; }
[Output("Result", PlotType = PlotType.DiscontinuousLine, LineColor = "Gray", Thickness = 3)]
public IndicatorDataSeries Result { get; set; }
[Output("Up", PlotType = PlotType.DiscontinuousLine, LineColor = "Lime", Thickness = 3)]
public IndicatorDataSeries ResultUp { get; set; }
[Output("Down", PlotType = PlotType.DiscontinuousLine, LineColor = "Red", Thickness = 3)]
public IndicatorDataSeries ResultDown { get; set; }
private AverageTrueRange atr;
private IndicatorDataSeries atrSerie;
private IndicatorDataSeries e;
private IndicatorDataSeries afr;
private IndicatorDataSeries atrFactoryHigh;
private IndicatorDataSeries atrFactoryLow;
private IndicatorDataSeries col;
private IndicatorDataSeries ls;
protected override void Initialize()
{
atr = Indicators.AverageTrueRange(Period, MovingAverageType.Simple);
atrSerie = CreateDataSeries();
e = CreateDataSeries();
afr = CreateDataSeries();
atrFactoryHigh = CreateDataSeries();
atrFactoryLow = CreateDataSeries();
col = CreateDataSeries();
ls = CreateDataSeries();
}
public override void Calculate(int index)
{
// Calculation
atrSerie[index] = atr.Result.Last(0);
e[index] = atrSerie[index] * AtrFactor;
afr[index] = Bars.ClosePrices[index];
afr[index] = index > 0 ? afr[index - 1] : afr[index];
atrFactoryHigh[index] = Bars.ClosePrices[index] + e[index];
atrFactoryLow[index] = Bars.ClosePrices[index] - e[index];
if (atrFactoryLow[index] > afr[index])
afr[index] = atrFactoryLow[index];
if (atrFactoryHigh[index] < afr[index])
afr[index] = atrFactoryHigh[index];
col[index] = afr[index] > afr[index - 1] ? 1 : afr[index] < afr[index - 1] ? -1 : col[index - 1];
bool buy = afr[index] > afr[index - 1] && !(afr[index - 1] > afr[index - 2]);
bool sell = afr[index] < afr[index - 1] && !(afr[index - 1] < afr[index - 2]);
ls[index] = buy ? 1 : sell ? -1 : ls[index - 1];
// Result
Result[index] = afr[index];
ResultUp[index] = afr[index] > afr[index - 1] ? Result[index] : col[index] == 1 ? Result[index] : double.NaN;
ResultDown[index] = afr[index] < afr[index - 1] ? Result[index] : col[index] == -1 ? Result[index] : double.NaN;
}
}
}
YesOrNot
Joined on 10.10.2022 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: AFR.algo
- Rating: 5
- Installs: 553
- Modified: 15/11/2023 23:39
Comments
AF DETRODUCTION JEIM-BALL TOZS ((EMERRA FALCON)) ++ ++++ ] ] ] ] **
Please add telegram alerts when crossing from UP to Result and Down to Result
Thanks
MONNS AVDG JACKY STRAUN LIEL EGERR \\ \\ KKDS