AlphaTrend indicator free

by mfejza in category Trend at 01/09/2022
Description

This indicator show trend and real market value of the financial instrument

Price below indicator when when indicator is green show discount on quote currency

Price above indicator value when indicator is red show discount on base currency

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mAlphaTrend : Indicator
    {
        [Parameter("Periods (14)", DefaultValue = 14)]
        public int inpPeriods { get; set; }
        [Parameter("Multiplier", DefaultValue = 1.618)]
        public double inpMultiplier { get; set; }
        [Parameter("ATR Smooth Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType inpATRSmoothType { get; set; }
        [Parameter("Volume Data (no)", DefaultValue = false)]
        public bool inpVolumeData { get; set; }

        [Output("AlphaTrend", LineColor = "Black", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outAlphaTrend { get; set; }
        [Output("AlphaTrend Signal", LineColor = "Transparent", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outAlphaTrendSignal { get; set; }
        [Output("AlphaTrend - Bullish", LineColor = "Green", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries outAlphaTrendBullish { get; set; }
        [Output("AlphaTrend - Bearish", LineColor = "Red", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries outAlphaTrendBearish { get; set; }

        private AverageTrueRange _atr;
        private RelativeStrengthIndex _rsi;
        private MoneyFlowIndex _mfi;
        private IndicatorDataSeries _trendup, _trenddn, _alphatrend, _trend;


        protected override void Initialize()
        {
            _atr = Indicators.AverageTrueRange(inpPeriods, inpATRSmoothType);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, inpPeriods);
            _mfi = Indicators.MoneyFlowIndex(inpPeriods);
            _trendup = CreateDataSeries();
            _trenddn = CreateDataSeries();
            _alphatrend = CreateDataSeries();
            _trend = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _trendup[i] = Bars.LowPrices[i] - _atr.Result[i] * inpMultiplier;
            _trenddn[i] = Bars.HighPrices[i] + _atr.Result[i] * inpMultiplier;
            _alphatrend[i] = (inpVolumeData == true ? _rsi.Result[i] >= 50.0 : _mfi.Result[i] >= 50) ? _trendup[i] < _alphatrend[i - 1] ? _alphatrend[i - 1] : _trendup[i] : _trenddn[i] > _alphatrend[i - 1] ? _alphatrend[i - 1] : _trenddn[i];

            _trend[i] = _alphatrend[i] > _alphatrend[i - 1] ? +1 : _alphatrend[i] < _alphatrend[i - 1] ? -1 : _alphatrend[i - 1];

            outAlphaTrend[i] = _alphatrend[i];

            outAlphaTrendBullish[i] = outAlphaTrendBullish[i - 1];
            outAlphaTrendBearish[i] = outAlphaTrendBearish[i - 1];
            if (_trend[i] == +1)
            {
                outAlphaTrendBullish[i] = _alphatrend[i];
                outAlphaTrendBearish[i] = double.NaN;
                outAlphaTrendSignal[i] = outAlphaTrend[i] - Symbol.TickSize;
            }

            if (_trend[i] == -1)
            {
                outAlphaTrendBullish[i] = double.NaN;
                outAlphaTrendBearish[i] = _alphatrend[i];
                outAlphaTrendSignal[i] = outAlphaTrend[i] + Symbol.TickSize;
            }
        }
    }
}
Comments

lawrencecaroll64 - September 05, 2022 @ 02:15

Forex robots https://fxaudit.com/ come in different price ranges. You should look for a robot that matches your trading goals. Also, make sure that the robot has a proven win rate. It may be worth paying more if it achieves a higher win rate. The best robots should have 100% automatic trading capabilities.

robertswells2304027 - September 08, 2022 @ 10:03

 there are many levels in run 3 game, you must concentrate to accomplish them without crashing, and you must be careful when running because there are several holes.

hoalai3493 - September 08, 2022 @ 21:27

Tha Bet is considered as the house that owns the largest and most diverse online game store. There are all forms of sports betting, attractive card games, etc. with high winning rates. Including prizes up to 5 billion VND. Please visit Tha Bet to join

tomwalterszz0809 - September 12, 2022 @ 11:59

Thank you very much for these great cake recipes, I have learned a lot from your web blog run 3

alvaro.engpro - September 13, 2022 @ 02:19

Loved the concept your described from it.

 

5