Click here to Login





                                                   Visible Date of first and last bar on chart

  0

0
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.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Trading Indicator: True between the first and last signal
Relative Performance Chart - Dynamic assets and index
Set the First Trading Bar Values to Not a Number
Chart Patterns: Double Top and Double Bottom
Drawdown and Rate of Return On Your Chart

How-to Lessons
How to display the bar index of a stock on a chart
How to scale and move the chart Y-axis
How to change volume bar colors when the price closes down
How to display two stocks on the same chart
How to plot arrows below/above candlesticks on a chart

Related Forum Threads
Function/property to catch the first visible bar/date within a ch...
Intraday Variable for 'Entry Bar' and 'First Bar Of Day'
Changing Colour of Graph Crosshairs and Date OHLC values
INTRADAY CHART AND VERTICAL LINE TO SEPARATE EACH DAYS
Why cannot see COMP results on chart and in debugger

Blog Posts
Different periodicities and chart bar types in QuantShare Trading...
Compare stocks and securities by creating a relative performance ...
Backtesting chart patterns using the auto support and resistance ...
How to Calculate and Display the Bid/Ask Spread on a Chart
Custom Shortcuts - Move a Chart to Display the Last Quotes/Data









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.