How can i use adx indicator as multi timeframe in one chart. there is only moving averages have multi timeframe mode

Created at 17 Jun 2022, 08:45
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MongolTrader's avatar

MongolTrader

Joined 12.02.2015

How can i use adx indicator as multi timeframe in one chart. there is only moving averages have multi timeframe mode
17 Jun 2022, 08:45


How can i use adx indicator as multi timeframe in one chart.  there is only moving averages have multi timeframe mode


@MongolTrader
Replies

amusleh
17 Jun 2022, 10:53

Hi,

You can pass another time frame Bars to ADX indicator:

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class ADXOtherTimeFrame : Robot
    {
        private DirectionalMovementSystem _adx;
        private Bars _otherTimeFrameBars;

        [Parameter("Other Time Frame")]
        public TimeFrame OtherTimeFrame { get; set; }

        [Parameter("Periods")]
        public int Periods { get; set; }

        protected override void OnStart()
        {
            _otherTimeFrameBars = MarketData.GetBars(OtherTimeFrame);

            _adx = Indicators.DirectionalMovementSystem(_otherTimeFrameBars, Periods)
        }
    }
}

 


@amusleh