how to get 1-second ohlc in cbots?

Created at 14 Nov 2018, 17:57
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!
XX

how to get 1-second ohlc in cbots?
14 Nov 2018, 17:57


I want to know how to get MaketSeries of unselected symbols by bots with "1-second",

something like,

  MarketSeries series = MarketData.GetSeries("EURUSD",  1s);

 

is this possible?

if not, is there any way to get this?


@xxxhailmaryxxx@gmail.com
Replies

PanagiotisCharalampous
15 Nov 2018, 09:25

Hi,

See below an example

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

        protected override void OnStart()
        {
            MarketSeries series = MarketData.GetSeries("EURUSD",  Timeframe);
        }

        protected override void OnBar()
        {
        
        }

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

Best Regards,

Panagiotis


@PanagiotisCharalampous