bag...

Created at 28 Jul 2019, 07:52
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!
VI

Vitali Gajdabrus

Joined 20.08.2015

bag...
28 Jul 2019, 07:52


 


namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        private StochasticOscillator _stochastic;
        private AverageTrueRange _atr;
        protected override void OnStart()
        {

            _stochastic = Indicators.StochasticOscillator(9, 3, 3, MovingAverageType.Triangular);
            _atr = Indicators.AverageTrueRange(180, MovingAverageType.Triangular);
            Print("_atr start: " + _atr.Result.LastValue + "             _stochastic start: " + _stochastic.PercentD.LastValue);
        }

        protected override void OnTick()
        {
            Print("_atr: " + _atr.Result.LastValue + "            _stochastic: " + _stochastic.PercentD.LastValue);
        }

        protected override void OnStop()
        {
        }
    }
}


@Vitali Gajdabrus
Replies

Vitali Gajdabrus
29 Jul 2019, 09:35 ( Updated at: 21 Dec 2023, 09:21 )

RE:

Vitali Gajdabrus said:

        protected override void OnStart()
        {

            _stochastic = Indicators.StochasticOscillator(9, 3, 3, MovingAverageType.Triangular);
            _atr = Indicators.AverageTrueRange(180, MovingAverageType.Triangular);
            Print("_atr start: " + _atr.Result.LastValue + "             _stochastic start: " + _stochastic.PercentD.LastValue);
        }
 

 

the problem is solved by reducing the period from 180 to 21 ...

            _atr = Indicators.AverageTrueRange(21, MovingAverageType.Triangular);

 


@Vitali Gajdabrus

PanagiotisCharalampous
29 Jul 2019, 10:34

Hi Vitaly, 

This is caused because you use a number of periods for which backtesting doesn't have data loaded at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous