Replies

PanagiotisCharalampous
28 Mar 2018, 12:36

Hi FMogyi,

Apologies for the very late reply but this is an old thread, we must have missed it somewhere in the process. Regarding your question, logs are not stored anywhere, only journal information. cAlgo app stores logs in Documents\cAlgo\Journals and cTrader app stores logs in Documents\cTrader\Journals. cAlgo product team has added this feature in the backlog to be considered for a future update.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 12:00

Hi ceakuk,

I would suggest that you always backtest on Tick Data. Backtesting on Tick Data is what would actually happen if you had your cBot running during the backtested period. Backtesting on bars is faster but not so accurate. It is suggested that it is used at the initial stages of developing a cBot and also avoid using it when your cBot depends heavily on logic implemented in the OnTick() method. It could lead to serious deviations in results.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 11:33

Hi Alexander,

cAlgo.API does not provide this information therefore, as you correctly assumed, you need to calculate this information yourself. What you have described sounds as a reasonable approach.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 11:06

Hi Patrick,

Try diff.Hour

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 09:52

Hi andrepasuf,

You can access the last deal using the followng code

History[History.Count - 1]

Let me know if this helps you.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 09:41

Hi tasr1r1,

You can use the Pips property of every position to calculate the AveragePips. This way you will not need to modify your TP on each tick. Symbol.PipSize is not related to this case.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
28 Mar 2018, 09:35

Hi Dave,

Yes it does.

Best Regards

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 15:15

Hi,

You can have public properties of type double in an indicator and read them from a cBot. They don't need to be output properties. See below

public int LastValue;

Then you can read these properties from cBots like below

         protected override void OnStart()
        {
            _renko = Indicators.GetIndicator<Renko>();
        }
        protected override void OnBar()
        {      
           var renko = _renko.LastValue;
        }

Let me know if this helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 14:43

Hi ceakuk,

It is currently not possible to draw objects during backtesting. This will be added in a future release.

Regarding the output issue, could you please share the cBot and the Indicator so that we can advise you what is wrong with the code?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 14:41

Hi, 

It is possible to return double values using an indicator. If you provide us with your indicator, we might be able to show you how to do this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 14:34

Dear Trader,

Thanks for posting in our forum. What you need to do is to divide the difference by Symbol.PipSize. See below

var differenceInPips = Math.Abs((Price1 - Price2) / Symbol.PipSize);

Let me know if this helps you.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 14:16

Dear Trader,

Thanks for posting in our forum. Such property is not available since it doesn't make sense in the context of a robot. A robot is always executed on the last bar in contrast to an indicator that needs to calculate the values of all previous bars before calculating the last one. If you can become more specific to what you are trying to do then maybe we could direct you towards the correct solution.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 12:09

Hi ceakuk,

See below the first example as a robot

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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 30, MinValue = 1)]
        public int Period { get; set; }

        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            RedrawLines();
        }
        private void RedrawLines()
        {
            int count = MarketSeries.Close.Count;

            int maxIndex1 = FindNextLocalExtremum(MarketSeries.High, count - 1, true);
            int maxIndex2 = FindNextLocalExtremum(MarketSeries.High, maxIndex1 - Period, true);

            int minIndex1 = FindNextLocalExtremum(MarketSeries.Low, count - 1, false);
            int minIndex2 = FindNextLocalExtremum(MarketSeries.Low, minIndex1 - Period, false);

            int startIndex = Math.Min(maxIndex2, minIndex2) - 100;
            int endIndex = count + 100;

            DrawTrendLine("high", startIndex, endIndex, maxIndex1, MarketSeries.High[maxIndex1], maxIndex2, MarketSeries.High[maxIndex2]);

            DrawTrendLine("low", startIndex, endIndex, minIndex1, MarketSeries.Low[minIndex1], minIndex2, MarketSeries.Low[minIndex2]);
        }

        private void DrawTrendLine(string lineName, int startIndex, int endIndex, int index1, double value1, int index2, double value2)
        {
            double gradient = (value2 - value1) / (index2 - index1);

            double startValue = value1 + (startIndex - index1) * gradient;
            double endValue = value1 + (endIndex - index1) * gradient;

            ChartObjects.DrawLine(lineName, startIndex, startValue, endIndex, endValue, Colors.Gray);
            ChartObjects.DrawLine(lineName + "_red", index1, value1, index2, value2, Colors.Red);
        }

        private int FindNextLocalExtremum(DataSeries series, int maxIndex, bool findMax)
        {
            for (int index = maxIndex; index >= 0; index--)
            {
                if (IsLocalExtremum(series, index, findMax))
                {
                    return index;
                }
            }
            return 0;
        }

        private bool IsLocalExtremum(DataSeries series, int index, bool findMax)
        {
            int end = Math.Min(index + Period, series.Count - 1);
            int start = Math.Max(index - Period, 0);

            double value = series[index];

            for (int i = start; i < end; i++)
            {
                if (findMax && value < series[i])
                    return false;

                if (!findMax && value > series[i])
                    return false;
            }
            return true;
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Let me know if this helps.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 10:40

Hi MaRCHeW,

When you get 0% for v2.01, is the application minimized or maximized? If it is minimized could you please maximize and make the comparison again?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 09:27

Hi rmsuleman,

I tried to build the indicator and I have no problems. However the error message references Robots folder which is used for cBots. Am I missing something?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 09:21

Hi Anton,

Did you manage to use the example?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
27 Mar 2018, 09:19

Hi Sylvain,

If this is a similar issue to this one, then please note that we have managed to reproduce it and will be solved with the next update.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2018, 17:45

Hi thriscio,

We managed to reproduce the issue internally and we will fix it with the next update. Thanks for pointing this out to us.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2018, 16:03

Hi FMogyi,

You don't need any special cAlgo libraries. cAlgo can reference any .Net library since it is a .Net application. Here you can find how to create a .Net library.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Mar 2018, 14:20 ( Updated at: 21 Dec 2023, 09:20 )

Hi thanhnt12401,

You can find a description of trigger methods when you hover over the trigger button in the Create Order window in cTrader. See below



We will add the descriptions in the Help site as well.

Best Regards,

Panagiotis


@PanagiotisCharalampous