silvio
silvio 's avatar

Info

Username:sylwester.guzek
Name:silvio
Member since: 05 Jan 2019

About

None

Signature

None

Last Algorithm Comments

@Fourier Transform:  08 Mar 2020, 13:23


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;             }         }     } }  

@Renko:  18 Jan 2019, 12:35


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

Last Forum Posts

@Fourier Transform Indicator is not updated with incoimng new bars:  08 Mar 2020, 13:40


Hello,

I need some help with running Fourier Transform indicator  in cBot  ( https://ctrader.com/algos/indicators/show/1971 ) . The problem is that the indicator is executed only one time on the beginning. Later on each new bar indicator values are not updated. I tried to force re-calculation of indicator calling Calculate() but it does not work.

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

Consider to tune Period value to be lower than the number of bars loaded by bot. With H1 it was around 119.

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;
            }

        }

    }
}

@Renko bot access to archival bricks in OnStart() method:  18 Jan 2019, 18:04


Hi Panagiotis,

Good to know that it is already available to run robot on Renko or Range timeframes. Anyhow I prefer Renko as indicator beacause it is more flexible.

Investigating further more my issue reported above I found that Robot instance at start-up downloads certain amout of historical data depending on selected timeframe. For example for D1 it is ~73 candles, for H1 it is ~125 candles, for M1 it is ~1400 candles. It is accordingly 73 days, 5 days and 1 day. It explains why I can get only few archival bricks when my robot is set to M1 timeframe. 

Is is possible to configure Robot instance to obtain specific amount archival data ? Based on my knowledge of other broker API, it was for example possible to get up to 1 month of data for M1 and 6 months of data for D1 timeframe. 

Thanks

Sylwester

@Renko bot access to archival bricks in OnStart() method:  18 Jan 2019, 10:04


Hi Panagiotis,

I wasn't aware that API for built in Renko is available. I was searching here https://ctrader.com/api/reference/indicators.

Can you advise where to find it?

Thanks

Silvio

@Renko bot access to archival bricks in OnStart() method:  17 Jan 2019, 20:23


I am referring to Renko indicator:  https://ctrader.com/algos/indicators/show/1086

I would like to have access to bricks before the bot starts in OnStart() method.

(...)        
        [Parameter("Renko Pips", DefaultValue = 10)]
        public double RenkoPips { get; set; }

        public int BricksToShow = 100;
        private Renko renko;

        protected override void OnStart()
        {
            renko = Indicators.GetIndicator<Renko>(RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato");
            for (var i = 0; i < 10; i++)
            {
                Print("ON-ST-(renko O;C) [", i, "]: ", renko.Open.Last(i), ";", renko.Close.Last(i));
            }
        }

        protected override void OnTick()
        {
            // bot code
        }

The following result shows that i can only access to very few bricks:

and I would like to have access to last 100 bricks. Changing value of  BricksToShow variable  does not change the result. When I pick different point in time for backtesting or different value for  RenkoPips than different number of bricks is shown in the result. It looks like indicator has some fixed period of time which takes for creating archival bricks.

I would appreciate for any help on how to access bigger amout of bricks (ex. 100) keeping specific RenkoPips value.

Thanks

@How to run 2 instances of one robot for the same currency pair independently.:  05 Jan 2019, 12:57


I have tuned my robot and I found that 2 different sets of parameters works well. Now I would like to run robot with 2 instances for the same currency pair but with different input parameters. How to run them independently ?

I am referring to following line which I have in the code:

             var longPosition = Positions.Find(label, Symbol, TradeType.Buy);

'label' is the same for both instances so for example first instance may find open positions of second instance.

I tried following but it doesn't work:

I created robot parameter to assign custom name:

         [Parameter("Custom name", DefaultValue = "std")]
        public string CustomName { get; set; }

......

         public string label = "test-01DE" + CustomName;

but I receive error:

"Error CS0236: A field initializer cannot reference the non-static field, method, or property 'cAlgo.Robots.RobotDAX.CustomName.get'"

Thanks in advance for any help

SYlwester

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.