Information

Username: lukasztrader
Member since: 25 Dec 2019
Last login: 25 Dec 2019
Status: Active

Activity

Where Created Comments
Algorithms 0 1
Forum Topics 8 12
Jobs 1 0

Last Algorithm Comments

LU
lukasztrader · 4 years ago

Dear @moza11,

I have a problem with this indicator. I wrote post in forum: https://ctrader.com/forum/cbot-support/22712?page=1#1

I would like to get history data that I see on chart with Custom Indicator. OnStart method I would like to get last values from this Indicator.

I don't understand why the data that I print in logs are not the same as I see on the chart. As an example I am looking for all Major Sell or Buy signals.

The logs from below code shows different values compared to values seen on chart. What is more if I loop over all results, there are not possible data as sometimes DotsBuy and DotsSell are at the same time with value = 1. The dots are either Buy or Sell.

The endgame is to have opportunity to create a logic in cBot that after restart the cBot it can get the last Major signal (either it is sell or buy) based on history data from chart.

Please see below code.

using System;

using System.Linq;

using cAlgo.API;

using cAlgo.API.Indicators;

using cAlgo.API.Internals;

using cAlgo.Indicators;

 

namespace cAlgo.Robots

{

    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

    public class aTestIndi : Robot

    {

        private CycleIdentifierAL cycle;

 

        protected override void OnStart()

        {

            cycle = Indicators.GetIndicator<CycleIdentifierAL>(0, 0, 12, MovingAverageType.Simple, 21, 3, 1, 4);

 

            for (int i = 0; i < 100; i++)

            {

                if (cycle.MajorSell.Last(i) == 1 || cycle.MajorBuy.Last(i) == -1)

                {

                    Print(i);

                    Print("Date: " + MarketSeries.OpenTime.Last(i));

                    Print("cycle.Line.Last(" + i + "): " + cycle.Line.Last(i));

                    Print("cycle.MajorBuy.Last(" + i + "): " + cycle.MajorBuy.Last(i));

                    Print("cycle.MajorSell.Last(" + i + "): " + cycle.MajorSell.Last(i));

                    Print("cycle.MinorBuy.Last(" + i + "): " + cycle.MinorBuy.Last(i));

                    Print("cycle.MinorSell.Last(" + i + "): " + cycle.MinorSell.Last(i));

                    Print("cycle.DotsBuy.Last(" + i + "): " + cycle.DotsBuy.Last(i));

                    Print("cycle.DotsSell.Last(" + i + "): " + cycle.DotsSell.Last(i));

                }

            }

        }

    }

}