Tick data from higher timeframe

Created at 12 Mar 2019, 15:23
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
A.

a.fernandez.martinez

Joined 02.03.2019

Tick data from higher timeframe
12 Mar 2019, 15:23


Hello,

 

In 2015 you said :

 

Spotware said:

Dear Traders,

Currently we do not provide access to tick data from the  MarketData object. We will consider providing this ability in the future. Additionally you can post your ideas/suggestions to http://vote.spotware.com/

 

 

 

Is there a way to access tick data from a higher timeframe now ?

 

Thanks!

 

 


@a.fernandez.martinez
Replies

PanagiotisCharalampous
12 Mar 2019, 15:56

Hi 

You can use the following function to get data from other timeframes.

   var series = MarketData.GetSeries(TimeFrame);

Best Regards,

Panagiotis


@PanagiotisCharalampous

a.fernandez.martinez
12 Mar 2019, 16:11

I can't see any tick timeframe in the Timeframe class (https://ctrader.com/api/reference/timeframe)

Would :

var series = MarketData.GetSeries(TimeFrame.Tick);

Work ?


@a.fernandez.martinez

PanagiotisCharalampous
12 Mar 2019, 16:30

Hi a.fernandez.martinez,

Tick based timeframes are not supported yet for TimeFrame enum and for backtesting. However you can use them in live trading through a parameter. See below

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 TimeFrame Parameter { get; set; }

        protected override void OnStart()
        {
           
        }

        protected override void OnTick()
        {
            var series = MarketData.GetSeries(Parameter);
            Print(series.OpenTime.LastValue);
        }

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

Best Regards,

Panagiotis


@PanagiotisCharalampous