ADX on multiple timeframes

Created at 28 Feb 2018, 06:22
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

ADX on multiple timeframes
28 Feb 2018, 06:22


Could not figure out how to correctly assign

I do this 

"

        protected override void OnStart()
        {
            Source2 = MarketData.GetSeries(Timeframe2);      
            ADX = Indicators.DirectionalMovementSystem(Source2.Close, ADXperiod);
        }

 

"

 

Error Argument 1: cannot convert from 'double' to 'cAlgo.API.Internals.MarketSeries'

Error CS1503 Argument 1: cannot convert from 'cAlgo.API.DataSeries' to 'cAlgo.API.Internals.MarketSeries' 

 

Please, help

But even more important where to look this up.


@alexander.n.fedorov
Replies

PanagiotisCharalampous
02 Mar 2018, 12:43

Hi Alexander,

Where do you define ADX?

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
03 Mar 2018, 11:53

Dear Pangiotis

Late repy, because of the market situation. Was very busy with equities falling.

It looks like this code is working, but I am not sure if it functioning all right. Meaning, it does not show me any mistakes when building, but I do not see any change on the backtesting.

Just tell, if syntax is correct, or if there are any traps in this code.

"

...

         [Parameter("Use ADX filter", DefaultValue = false)]
        public bool ADXFilter { get; set; }

        [Parameter("ADX period", DefaultValue = 14)]
        public int ADXperiod { get; set; }

......

         private bool ADX_OKtoBuy;
        private bool ADX_OKtoSell;
        #endregion

        #region cBot onStart
        protected override void OnStart()
        {
            InstanceName = InstanceName + " " + Symbol.Code;
            Source2 = MarketData.GetSeries(Timeframe2);
            var Source3 = MarketData.GetSeries(Timeframe2);
            BB = Indicators.BollingerBands(Source, Periods, Deviations, MovingAverageType.Exponential);
            BB2 = Indicators.BollingerBands(Source, Periods, Deviations / 2, MovingAverageType.Exponential);
            ATR = Indicators.AverageTrueRange(Periods, MovingAverageType.Exponential);
            MA2 = Indicators.MovingAverage(Source2.Close, Periods, MovingAverageType.Exponential);
            _ATR = ATR.Result.LastValue;
            _SL = _ATR * _ATR_SL_Factor / Symbol.PipSize;
            _TP = _SL * _TP_Factor;
            ADX = Indicators.DirectionalMovementSystem(Source3, ADXperiod);
            CloseTrade = false;
        }

"

Regards,

Alexander

 

 

 

 

 

 


@alexander.n.fedorov

PanagiotisCharalampous
05 Mar 2018, 10:40

Hi Alexander,

I cannot advise if it is functioning right since I don't know what it is supposed to do :) If you describe what you are trying to achieve I might be able to tell if you have coded this right.

Best Regards,

Panagiotis


@PanagiotisCharalampous