Replies

acnestis
11 Feb 2021, 12:52

RE:

PanagiotisCharalampous said:

Hi robustby,

Here is an example of how to load all ticks for the bars loaded on your chart.

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 = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var ticks = MarketData.GetTicks();
            while (ticks[0].Time > Bars[0].OpenTime)
            {
                ticks.LoadMoreHistory();
                Print("Loaded till " + ticks[0].Time);
            }
            Print("Ticks loaded");
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

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

Best Regards,

Panagiotis 

Join us on Telegram

Thank you so much for the example. Can you check if I'm right? If I want to get lower Ask price I'm doing following:

            var ticks = MarketData.GetTicks();
            while (ticks[0].Time > Bars[0].OpenTime)
            {
                ticks.LoadMoreHistory();
                Print("Loaded till " + ticks[0].Time);

            }
            Print("Ticks loaded");

            int tickIndex = 1;
            int NumberOfTicks = 10000;
            double GetAskLow = ticks[0].Ask; //get last Ask tick in the left of chart
            for (int i = tickIndex; i < ticks.Count; i++)
            {
                if (ticks[i].Ask < GetAskLow)
                {
                    GetAskLow = ticks[i].Ask;
                }

            }
            Print("GetAskLow = ", GetAskLow);

Also, I have some questions:

1) If I want to use only last 10000 ticks, how better load it? Or if I want use ticks data for only 50 last bars at the chart?

2) I must use MarketData.GetTicks() & ticks.LoadMoreHistory() for every time when new tick appears? Please explain how it works.


@acnestis

acnestis
11 Feb 2021, 10:17

RE:

PanagiotisCharalampous said:

Hi robustby,

The ask price is not available. Bars are created using bid prices. To get ask prices you need to get the tick data using MarketData.GetTicks() and loop through the ticks to find the lowest for the bar's period.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you! Can you write some example how to use it?


@acnestis

acnestis
09 Jun 2020, 13:14 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Ηι robustby,

How do you know that these copiers are not copying your trades?

Hi! Usually I can see changing "Copying Funds (Live)" in real time. So, now this value is not changing. "Total Volume Copied (Live)" is not changing also.

 

What commission would you expect to get?

Volume Fee. 

Why do you say that they are demo copiers but displayed as live?

Because looks like a some bug for me and this is a possible explanation.


@acnestis

acnestis
12 May 2020, 15:19

RE:

PanagiotisCharalampous said:

Hi robustby,

Try rounding the values before using them

            var SellLim = Math.Round(barHigh - Dist * 1E-05, Symbol.Digits);
            var BuyLim = Math.Round(barLow + Dist * 1E-05, Symbol.Digits);

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you so much! It's works :)


@acnestis

acnestis
12 May 2020, 11:21

RE:

PanagiotisCharalampous said:

Hi robustby,

This message usually appears when the modified parameter is the same as the previous one. To investigate your case further, you need to provide us with the complete cBot source code and cBot parameters to reproduce this message on backtesting.

Best Regards,

Panagiotis 

Join us on Telegram

Here is my code.

Problem with following code

            var SellLim = barHigh - Dist * 1E-05;
            var BuyLim = barLow + Dist * 1E-05;

If I put it instead of 

            var SellLim = barHigh;
            var BuyLim = barLow;

With the code above all working fine.

You can use any of parameters, it's doesn't matter. For example: bar_analyse=20, Dist=5, IndBar=8.


@acnestis