Multi-timeframe robots/indicators

10 Feb 2018, 15:28Multi-timeframe robots/indicators#21
irmscher9posts: 128since: 22 Dec 2016

The code above seem doesn;t work...

12 Feb 2018, 11:35#22
Panagiotis Charalampousposts: 1099since: 13 Jan 2017

Hi irmscher9,

Why do you say that the code is not working? Do you get an exception? Do you get unexpected results? If you give us more information, it will be easier for us to help you.

Best Regards,


Head of Community Management at cTrader
25 Feb 2018, 22:26#23
Dagfxposts: 3since: 04 Dec 2017

Whenever I install the Multi-timeframe moving average, the ctrader keeps disconnecting and reconnecting and so on...Till I remove the indicator all of it. What's the problem?

26 Feb 2018, 11:17#24
Panagiotis Charalampousposts: 1099since: 13 Jan 2017

Hi daguerfi,

When did you observe this behavior? Was it during a weekend?

Best Regards,


Head of Community Management at cTrader
26 Mar 2018, 23:16RE: Indicator example: Multi-timeframe moving average#25
rmsulemanposts: 3since: 17 Mar 2017

I am trying to install the code using calgo but I get the following error when I try to build it. Please let me know how to fix it. Thanks


cAlgo_Development said:

In this example, we output moving averages with the same period for different timeframes on a single chart:


Source code:

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

namespace cAlgo.Indicators
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
    public class MultiTF_MA : Indicator
        [Parameter(DefaultValue = 50)]
        public int Period { get; set; }

        [Output("MA", Color = Colors.Yellow)]
        public IndicatorDataSeries MA { get; set; }

        [Output("MA5", Color = Colors.Orange)]
        public IndicatorDataSeries MA5 { get; set; }

        [Output("MA10", Color = Colors.Red)]
        public IndicatorDataSeries MA10 { get; set; }

        private MarketSeries series5;
        private MarketSeries series10;

        private MovingAverage ma;
        private MovingAverage ma5;
        private MovingAverage ma10;

        protected override void Initialize()
            series5 = MarketData.GetSeries(TimeFrame.Minute5);
            series10 = MarketData.GetSeries(TimeFrame.Minute10);

            ma = Indicators.MovingAverage(MarketSeries.Close, Period, MovingAverageType.Triangular);
            ma5 = Indicators.MovingAverage(series5.Close, Period, MovingAverageType.Triangular);
            ma10 = Indicators.MovingAverage(series10.Close, Period, MovingAverageType.Triangular);

        public override void Calculate(int index)
            MA[index] = ma.Result[index];

            var index5 = GetIndexByDate(series5, MarketSeries.OpenTime[index]);
            if (index5 != -1)
                MA5[index] = ma5.Result[index5];

            var index10 = GetIndexByDate(series10, MarketSeries.OpenTime[index]);
            if (index10 != -1)
                MA10[index] = ma10.Result[index10];

        private int GetIndexByDate(MarketSeries series, DateTime time)
            for (int i = series.Close.Count - 1; i > 0; i--)
                if (time == series.OpenTime[i])
                    return i;
            return -1;



27 Mar 2018, 09:27#26
Panagiotis Charalampousposts: 1099since: 13 Jan 2017

Hi rmsuleman,

I tried to build the indicator and I have no problems. However the error message references Robots folder which is used for cBots. Am I missing something?

Best Regards,


Head of Community Management at cTrader