Topics

Forum Topics not found

Replies

halvardu
28 Jun 2015, 01:15

RE:

jeffmichaels said:

So i managed to build on your code and now have the 5 ADX in 1 window.

 

Trying to do the same myself now for 3 stochastics in 1 window, but to no avail. Im not a coder, im fine tweaking stuff but cant seem to get this done.

Any help would be appreciated. I like the lightness of ctrader but i need my MT4 system if i want to switch

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC)]
    public class AdxR : Indicator
    {
        [Output("Slow", Color = Colors.Yellow)]
        public IndicatorDataSeries _stochasticslow { get; set; }

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

        [Output("Fast", Color = Colors.Blue)]
        public IndicatorDataSeries _stochasticfast { get; set; }

        private StochasticOscillator _stochasticslow;
        private StochasticOscillator _stochasticmedium;
        private StochasticOscillator _stochasticsfast;


        protected override void OnStart
        {
               _stochasticslow = Indicators.StochasticOscillator(100, 10, 10, SMA);
               _stochasticmedium = Indicators.StochasticOscillator(21, 10, 10, SMA);
               _stochasticsfast = Indicators.StochasticOscillator(8, 3, 3, SMA);
            
        }

        public override void Calculate(int index)
        {
            Slow[index] = _stochasticslow[index];
            Medium[index] = _stochasticmedium[index];
            Fast[index] = _stochasticfast[index];
           
        }
    }
}

 

Here is a working version, if someone wants it?

 

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC)]
    public class Stochastic3 : Indicator
    {
        [Output("Slow", Color = Colors.Yellow)]
        public IndicatorDataSeries Slow { get; set; }

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

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

        private StochasticOscillator _stochasticslow;
        private StochasticOscillator _stochasticmedium;
        private StochasticOscillator _stochasticsfast;


        protected override void Initialize()
        {
            _stochasticslow = Indicators.StochasticOscillator(100, 10, 10, MovingAverageType.Simple);
            _stochasticmedium = Indicators.StochasticOscillator(21, 10, 10, MovingAverageType.Simple);
            _stochasticsfast = Indicators.StochasticOscillator(8, 3, 3, MovingAverageType.Simple);

        }

        public override void Calculate(int index)
        {
            Slow[index] = _stochasticslow.PercentK[index];
            Medium[index] = _stochasticmedium.PercentK[index];
            Fast[index] = _stochasticsfast.PercentK[index];

        }
    }
}

 

 


@halvardu