Replies

Максим_Коваленко
21 Mar 2017, 23:20

RE:

lucian said:

Click  your photo( top right) and My Account. Select Sign-in & security.

Problem was solved. This setting is not available for accounts with 2-Step Verification enabled. Such accounts require an application-specific password for less secure apps access.

I have used another account and all ok.

 

Thanks!


@Максим_Коваленко

Максим_Коваленко
21 Mar 2017, 16:30

RE:

tmc. said:

Hi, you need to invoke Calculate() method in the referenced indicator. Add this into your cBot.

protected override void OnTick()
{
    double a = impulseSystem.Ema.LastValue;
}

 

Thanks!


@Максим_Коваленко

Максим_Коваленко
13 Mar 2016, 21:24

Here is complete indicator Elders impulse system:

 

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

namespace ImpulseSystem
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ImpulseSystem : Indicator
    {
        private MovingAverage ema;

        private MacdCrossOver macdCrossOver;

        /// <summary>
        /// Период скользящей средней
        /// </summary>
        [Parameter(DefaultValue = 13)]
        public int EmaPeriod { get; set; }

        /// <summary>
        /// Главный индикатор EMA
        /// </summary>
        [Output("EMA")]
        public IndicatorDataSeries Ema { get; set; }

        public override void Calculate(int index)
        {
            this.Ema[index] = this.ema.Result[index];

            if (this.ema.Result.IsRising() && this.macdCrossOver.Histogram.IsRising())
            {
                this.DrawBar(index, Colors.Green);
            }
            else if (this.ema.Result.IsFalling() && this.macdCrossOver.Histogram.IsFalling())
            {
                this.DrawBar(index, Colors.Red);
            }
            else
            {
                this.DrawBar(index, Colors.Aqua);
            }
        }

        /// <inheritdoc />
        protected override void Initialize()
        {
            this.ema = Indicators.MovingAverage(this.MarketSeries.Close, this.EmaPeriod, MovingAverageType.Exponential);
            this.macdCrossOver = Indicators.MacdCrossOver(this.MarketSeries.Close, 26, 12, 9);
        }

        private void DrawBar(int index, Colors color)
        {
            this.ChartObjects.DrawLine("candle" + index, index, MarketSeries.Open[index], index, MarketSeries.Close[index], color, 5);
            this.ChartObjects.DrawLine("wick" + index, index, MarketSeries.High[index], index, MarketSeries.Low[index], color);
        }
    }
}

 


@Максим_Коваленко