Access old data
14 Sep 2019, 20:25
Hi
I want to access the close price between two very old dates.
For example 2104/01/01 and 2014/01/31
Is there way?
Thanks
Replies
pmcarvalho
16 Sep 2019, 11:22
RE:
Panagiotis Charalampous said:
Hi pmcarvalho,
From where do you want to access the prices? From the chart? If yes then just scroll back to the specific date.
Best Regards,
Panagiotis
Hi Panagiotis Charalampous
I am building a bot for statistics and caching.
I already tried to use this: "Chart.ScrollXTo ([date]);"
But it doesn't go that far. It probably stops at the first value it has available on the chart.
Any idea?
Thanks
Pedro
@pmcarvalho
PanagiotisCharalampous
16 Sep 2019, 12:06
Hi Perdo,
Can you tell me symbol and the broker you are using?
Best Regards,
Panagiotis
@PanagiotisCharalampous
pmcarvalho
16 Sep 2019, 13:36
RE:
Panagiotis Charalampous said:
Hi Perdo,
Can you tell me symbol and the broker you are using?
Best Regards,
Panagiotis
Panagiotis Charalampous
Symbol: EURUSD - H1
Broker: FxPro
Thanks
Pedro
@pmcarvalho
pmcarvalho
19 Sep 2019, 15:35
RE:
Panagiotis Charalampous said:
Hi Perdo,
Can you tell me symbol and the broker you are using?
Best Regards,
Panagiotis
Hi Panagiotis Charalampous
Any idea?
Thanks
Pedro
@pmcarvalho
PanagiotisCharalampous
19 Sep 2019, 15:55
Hi Pedro,
But it doesn't go that far. It probably stops at the first value it has available on the chart.
Indeed this is true. See below a workaround
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()
{
Chart.ScrollChanged += OnChartScrollChanged;
if (MarketSeries.OpenTime[0] > new DateTime(2014, 1, 1))
{
Chart.ScrollXTo(MarketSeries.OpenTime[0]);
}
}
void OnChartScrollChanged(ChartScrollEventArgs obj)
{
if (MarketSeries.OpenTime[0] > new DateTime(2014, 1, 1))
{
Chart.ScrollXTo(MarketSeries.OpenTime[0]);
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
pmcarvalho
21 Sep 2019, 21:35
RE:
Panagiotis Charalampous said:
Hi Pedro,
But it doesn't go that far. It probably stops at the first value it has available on the chart.
Indeed this is true. See below a workaround
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() { Chart.ScrollChanged += OnChartScrollChanged; if (MarketSeries.OpenTime[0] > new DateTime(2014, 1, 1)) { Chart.ScrollXTo(MarketSeries.OpenTime[0]); } } void OnChartScrollChanged(ChartScrollEventArgs obj) { if (MarketSeries.OpenTime[0] > new DateTime(2014, 1, 1)) { Chart.ScrollXTo(MarketSeries.OpenTime[0]); } } protected override void OnStop() { // Put your deinitialization logic here } } }Best Regards,
Panagiotis
Panagiotis Charalampous
Thanks.
It worked.
By the way. There is a way to pass the date to the handler (OnChartScrollChanged), instead of beeing hardcoded (new DateTime(2014, 1, 1))?
Thanks
Pedro
@pmcarvalho
PanagiotisCharalampous
23 Sep 2019, 08:50
Hi Pedro,
No you cannot but I do not see the need. You can have a global variable for this.
Best Regards,
Panagiotis
@PanagiotisCharalampous

PanagiotisCharalampous
16 Sep 2019, 09:13
Hi pmcarvalho,
From where do you want to access the prices? From the chart? If yes then just scroll back to the specific date.
Best Regards,
Panagiotis
@PanagiotisCharalampous