13-21-200 MAs (Multi-Timeframe) free

by Botnet101 in category Trend at 04/07/2022
Description

A simple indicator for trend following, consisting of 4 Exponential Moving Averages (EMAs) in total.

Parameters:

  • Source                        -The input source (default is close).
  • Timeframe                  -The timeframe to use.
  • MA Type                      -The Moving Average type to use.
  • Change Bar Colour    -Changes the colour of the bars to show the trend direction.
  • MA Periods                 -The period of the Moving Averages.
  • Bar Colours                - The colours to use on bars for bullish and bearish trends

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 cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ThreeMAs : Indicator
    {

        #region Parameters
        [Parameter("Source")]
        public DataSeries DataSource { get; set; }

        [Parameter("Timeframe", DefaultValue = "Daily")]
        public TimeFrame Timeframe { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MaType { get; set; }

        [Parameter(name: "Change Bar Colour?", DefaultValue = true)]
        public bool ChangeBarCol { get; set; }

        [Parameter(name: "MA Period 1", Group = "MA Periods", DefaultValue = 13, MinValue = 1)]
        public int Period1 { get; set; }

        [Parameter(name: "MA Period 2", Group = "MA Periods", DefaultValue = 21, MinValue = 1)]
        public int Period2 { get; set; }

        [Parameter(name: "MA Period 3", Group = "MA Periods", DefaultValue = 200, MinValue = 1)]
        public int Period3 { get; set; }

        [Parameter(name: "Bearish", Group = "Bar Colours", DefaultValue = "OrangeRed")]
        public string BearishColour { get; set; }

        [Parameter(name: "Bullish", Group = "Bar Colours", DefaultValue = "Green")]
        public string BullishColour { get; set; }
        #endregion

        #region Outputs
        [Output("MA 0", LineColor = "Gray", Thickness = 2)]
        public IndicatorDataSeries Ma0 { get; set; }

        [Output("MA 1", LineColor = "Green", Thickness = 2)]
        public IndicatorDataSeries Ma1 { get; set; }

        [Output("MA 2", LineColor = "Yellow", Thickness = 2)]
        public IndicatorDataSeries Ma2 { get; set; }

        [Output("MA 3", LineColor = "Red", Thickness = 2)]
        public IndicatorDataSeries Ma3 { get; set; }
        #endregion

        private Bars _series;
        private MovingAverage _ma1;
        private MovingAverage _ma2;
        private MovingAverage _ma3;

        protected override void Initialize()
        {
            _series = MarketData.GetBars(Timeframe);
            _ma1 = Indicators.MovingAverage(_series.ClosePrices, Period1, MaType);
            _ma2 = Indicators.MovingAverage(_series.ClosePrices, Period2, MaType);
            _ma3 = Indicators.MovingAverage(_series.ClosePrices, Period3, MaType);
        }

        public override void Calculate(int index)
        {
            int timeframeIndex = _series.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);

            Ma1[index] = _ma1.Result[timeframeIndex];
            Ma2[index] = _ma2.Result[timeframeIndex];
            Ma3[index] = _ma3.Result[timeframeIndex];
            Ma0[index] = 0.5 * (Ma1[index] + Ma2[index]);

            if (!ChangeBarCol)
                return;
            Color barColour = Ma1[index] > Ma2[index] ? BullishColour.ToString() : BearishColour.ToString();
            Chart.SetBarColor(index, barColour);
        }
    }
}
Comments

alanhowden892 - July 29, 2022 @ 07:35

Setting up an account is free and simple. It doesn't require you to have a mobile phone number.

gmail sign up 2022

ellapurnellrt - August 05, 2022 @ 12:22

Thanks for sharing one of the best posts I’ve ever read on the  lewdle internet. 

junealexis001 - September 12, 2022 @ 12:06

Interesting  site i love it keep posting more!   https://fencecompanypensacolafl.com

householdelsewhere - November 09, 2022 @ 10:30

It's possible to pull off spectacular drifts in any of the game's many vehicles. It all boils down to your ability to countersteer and time your turns perfectly. In addition, Drift Hunters is a cost-free web-based game that has an extensive lineup of drift vehicles, from JDM icons to Euro classics.

5