Nesting indicator data in a robot

Created at 21 Jul 2014, 19:16
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!
CL

clydeboo

Joined 21.07.2014

Nesting indicator data in a robot
21 Jul 2014, 19:16


Just want to start off by saying that cAlgo rocks! Hats off to all the developers. cAlgo is a traders wet dream. Unfortunately this is a point of frustration with me because I'm not up to speed with cBot construction and the unbelievable potential continues to stare me in the face.

I've developed a bot that I'm incredible happy with but it needs refinement  I want to develop more error management to minimize poor entry and or correct direction. This process has led me to using nested indicators. I want to create a VIDYA data series that uses a Welles Wilder Smoothing data series as its data source. I see how it is done when building an indicator but not how to do it with a bot. 

I'm sure the process is simple...I just need a little nudge in the right direction.

 

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class swtBot : Robot
    {
        [Parameter("Wilder Smoothing")]
        public MovingAverageType MAType { get; set; }

        [Parameter("Wild Data")]
        public DataSeries OpenSourceSeries { get; set; }

        [Parameter("Wild Slow Periods", DefaultValue = 30)]
        public int SlowPeriods { get; set; }

        [Parameter("Wild Fast Periods", DefaultValue = 20)]
        public int FastPeriods { get; set; }

        [Parameter("VIDYA Period", DefaultValue = 30)]
        public int vidPeriod { get; set; }

        [Parameter("VIDYA Sigma", DefaultValue = 0.65, MinValue = 0.1, MaxValue = 0.95)]
        public double vidSigma { get; set; }

        //private IndicatorDataSeries wilderDataSeries;
        private Vidya vidya;
        private MovingAverage openMa;
        private const string label = "booger";


        protected override void OnStart()
        {
            slowMa = Indicators.MovingAverage(OpenSourceSeries, SlowPeriods, MAType);
            fastMa = Indicators.MovingAverage(OpenSourceSeries, FastPeriods, MAType);

            vidya = Indicators.Vidya(slowMa, vidPeriod, vidSigma);
           
        }

 


@clydeboo
Replies

Spotware
22 Jul 2014, 11:03

RE:

Hi clydeboo.

You have to pass data series of indicator: slowMa.Result

protected override void OnStart()
{
    slowMa = Indicators.MovingAverage(OpenSourceSeries, SlowPeriods, MAType);
    fastMa = Indicators.MovingAverage(OpenSourceSeries, FastPeriods, MAType);

    vidya = Indicators.Vidya(slowMa.Result, vidPeriod, vidSigma);
}

clydeboo said:

Just want to start off by saying that cAlgo rocks! Hats off to all the developers. cAlgo is a traders wet dream. Unfortunately this is a point of frustration with me because I'm not up to speed with cBot construction and the unbelievable potential continues to stare me in the face.

I've developed a bot that I'm incredible happy with but it needs refinement  I want to develop more error management to minimize poor entry and or correct direction. This process has led me to using nested indicators. I want to create a VIDYA data series that uses a Welles Wilder Smoothing data series as its data source. I see how it is done when building an indicator but not how to do it with a bot. 

I'm sure the process is simple...I just need a little nudge in the right direction.

 

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class swtBot : Robot
    {
        [Parameter("Wilder Smoothing")]
        public MovingAverageType MAType { get; set; }

        [Parameter("Wild Data")]
        public DataSeries OpenSourceSeries { get; set; }

        [Parameter("Wild Slow Periods", DefaultValue = 30)]
        public int SlowPeriods { get; set; }

        [Parameter("Wild Fast Periods", DefaultValue = 20)]
        public int FastPeriods { get; set; }

        [Parameter("VIDYA Period", DefaultValue = 30)]
        public int vidPeriod { get; set; }

        [Parameter("VIDYA Sigma", DefaultValue = 0.65, MinValue = 0.1, MaxValue = 0.95)]
        public double vidSigma { get; set; }

        //private IndicatorDataSeries wilderDataSeries;
        private Vidya vidya;
        private MovingAverage openMa;
        private const string label = "booger";


        protected override void OnStart()
        {
            slowMa = Indicators.MovingAverage(OpenSourceSeries, SlowPeriods, MAType);
            fastMa = Indicators.MovingAverage(OpenSourceSeries, FastPeriods, MAType);

            vidya = Indicators.Vidya(slowMa, vidPeriod, vidSigma);
           
        }

 

 


@Spotware

clydeboo
22 Jul 2014, 18:12

That was as easy as falling out of a chair...I fuckin love it!

Thanks Spotware


@clydeboo