|
crfaldu
2017-02-01 11:40:14
|
|
Is there a code we can use to get bar number or start date of the first visible bar and last visible bar on the current chart
Thanks
|
|
|
|
QuantShare
2017-02-02 03:07:54
0
|
|
There is no way to get that in QS language because the formula is parsed once and thus doesn't know the first or last visible bar.
You can get the first/last visible bar by creating a custom drawing tool.
|
|
|
|
crfaldu
2017-02-05 14:46:15
0
|
|
I found a way to do it with global variable
while(true)
{
Chart chart = Charts.GetSelectedChart();
DateTime startdate = chart.VisibleStartDate;
Global.SetVariable("Date",startdate);
App.Main.Sleep(1000);
chart.Update();
}
Function is below
VectorDate vDate = cFunctions.Date;
String temp = Global.GetVariable("Date").ToString();
//DateTime date = DateTime.Parse(temp);
DateTime date = DateTime.Parse(temp, System.Globalization.CultureInfo.InvariantCulture);
|
|
|
|
QuantShare
2017-02-06 03:39:32
0
|
|
This is a good idea. Thank you for sharing this.
|
|
|
|
Seeker
2018-12-17 00:08:29
0
|
|
This could be very beneficial while plotting indicators like cumulative advance decline line (say, using sum function). The cumulation is done from the start of the data. But it also makes sense to draw it based on a recent range which can be done on the fly by cumulating it only for the visible chart data. In this case an equilibrium level can be more visible.
Any help on a "sum" indicator for the visible data range would be very helpful. Thanks.
|
|
|
|
QuantShare
2018-12-17 09:50:58
0
|
|
Last specified above, you need to create a script that updates the chart every second, stores the visible start and end dates then a custom indicator that gets these dates and calculate the sum based on that.
|
|
|
|