Topics
Replies
rick779
05 Aug 2022, 17:27
( Updated at: 05 Aug 2022, 17:40 )
RE:
PanagiotisCharalampous said:
Hi Riccardo,
In this case, if I call Chart.ScrollTo(date) the indicator is restarted. So I tried calling Bars.LoadMoreHistory() first, but it seems that even this call alone causes the indicator to restart.Can you explain how did you come to this conclusion? What do I need to do to observe such a behavior?
Best Regards,
Panagiotis
I have simplified the code to give a demonstration thanks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(AccessRights = AccessRights.FullAccess, IsOverlay = true)]
public class NewIndicator : Indicator
{
protected override void Initialize()
{
Print("STARTED");
Chart.KeyDown += Chart_KeyDown;
}
private void Chart_KeyDown(ChartKeyboardEventArgs obj)
{
if (obj.Key == Key.Z)
Scroll();
}
void Scroll()
{
Print("SCROLL");
DateTime date = Bars[Chart.FirstVisibleBarIndex].OpenTime.AddYears(-1);
//NOT WORKING
//while (date < Bars[Chart.FirstVisibleBarIndex].OpenTime)
//{
// Bars.LoadMoreHistory(); // crash
//}
Chart.ScrollXTo(date); // crash
}
public override void Calculate(int index)
{
}
}
}
@rick779
rick779
05 Aug 2022, 16:31
RE:
PanagiotisCharalampous said:
Hi Riccardo,
I tried this but I do not understand what the problem is. Can you explain?
Best Regards,
Panagiotis
I would like to scroll to a time position that is currently unavailable because the date precedes Bars[Chart.FirstVisibleBarIndex].OpenTime. In this case, if I call Chart.ScrollTo(date) the indicator is restarted. So I tried calling Bars.LoadMoreHistory() first, but it seems that even this call alone causes the indicator to restart. Thank you
@rick779
rick779
05 Aug 2022, 16:14
RE:
PanagiotisCharalampous said:
Hi Riccardo,
Can you please share the complete code of the indicator you are using?
Best Regards,
Panagiotis
https://drive.google.com/file/d/1l-z242XocrMB3tNZc6_llhzGKFtYwgvb/view?usp=sharing
Thanks
@rick779
rick779
31 Jan 2022, 17:45
RE:
i tried to reproduce the problem, I don't know if it occurs only when starting to draw from the past
Clips:
https://drive.google.com/drive/folders/1UduSif_1bV5DlM0gNsUqeIXmuQ-HqKHQ
Many thanks,
Riccardo
@rick779
rick779
22 Sep 2021, 09:01
RE: RE:
Nice, thank you
firemyst said:
riccardo.buttari said:
From my indicator, calling MarketData.GetSeries with a symbol other than the current one,
I get only the last 2000 most recent bars (even if I scroll the chart further back) and this does not allow me to perform backtests.
Is there a way to get more bars or set a start date?
Thanks
Try what's on this thread:
@rick779
rick779
08 Aug 2022, 16:38
RE: RE:
Hi, any news?
Thank you
riccardo.buttari said:
@rick779