Information

Username: sylwester.guzek
Member since: 05 Jan 2019
Last login: 05 Jan 2019
Status: Active

Activity

Where Created Comments
Algorithms 0 2
Forum Topics 3 4
Jobs 0 0

Last Algorithm Comments

SY
sylwester.guzek · 4 years ago

Hello,

I need some help with running this indicator in cBot. The problem is that indicator is executed only one time on the beginning. Later on each new bar indicator values are not updated. I tried to force calculation of indicator calling Calculate() but it does not work.

Below code for problem replication, I will be appreciated for any advice.

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 NEWFurierSandbox : Robot
    {

        [Parameter()]
        public DataSeries SourceSeries { get; set; }

        [Parameter(DefaultValue = 1, MinValue = 0)]
        public int Volume { get; set; }

        [Parameter("Period", DefaultValue = 100)]
        public int Npast { get; set; }

        [Parameter("Projection", DefaultValue = 10)]
        public int Nfut { get; set; }

        [Parameter("N° Harmonics", DefaultValue = 15)]
        public int Nharm { get; set; }

        [Parameter("Tolerance in Hz", DefaultValue = 1E-05)]
        public double FreqTOL { get; set; }

        [Parameter("Show Starting and Ending Points", DefaultValue = true)]
        public bool points { get; set; }

        private const string label = "NEW FT Sandbox";
        private FourierTransform ft;

        protected override void OnStart()
        {
            Print("initialization: ", Npast, " ", Nfut, " ", Nharm, " ", FreqTOL, " ", SourceSeries," ", points);
            ft = Indicators.GetIndicator<FourierTransform>(Npast, Nfut, Nharm, FreqTOL, SourceSeries, points);
        }

        protected override void OnBar()
        {
            for (int i = 0; i < 200; i++)
            {
                //ft.Calculate(i);
                Print(i, " >> ", ft.fit[i], " # ", ft.Proj[i], " # ", SourceSeries.Last(i));
                //ft.fit[i] = 0;
            }

        }

    }
}

 

SY
sylwester.guzek · 5 years ago

Dear Jiri, 

I have opened a thread related to your indicator,  https://ctrader.com/forum/cbot-support/14881

Would you be able to give me any advise on that question?

Thanks