I understand that I can contingently plot on the chart using range of date and time values.
However, I would like to be able to plot using a specific number of candlesticks.
For example, I would like to be able to say something like
// Within the most recent 10 bars
// If close[0] > close[1]
// plotshape()
I have tried implementing numerous variations using barstate.isrealtime or barstate.islast but I keep running into limitations.
One major problem is that, although bar_index[#] works by indexing backwards from the most recent bar, the value of bar_index[10] is not 10 but some number in the thousands (depending on the timeframe of the chart — for me its Daily = 2,616 candles, 1hr = 6,217 candles, 15m = 5,222, etc.). In other words, it counts the number of bars from the oldest bar available.
Since referencing of the bars (starting from most recent) and the index values (starting from the oldest) are conflicting--due to counting from opposite ends--I am not sure how to specify: plotshape() for the most recent 10 bars.
I am also running into trouble due to the fact that bar_index[0] occurs every single iteration of the chart's timeframe--so I am getting caught in recursive calculations when trying to do bar_index[0]-bar_index[10].
It seems that what I need is something like bar_index.islast[10]
The reason that I would like to call a plotshape() based on the number of specified candles versus since x date/time (or within date range (x,y)), is because I want my indicator to function properly regardless of which timeframe my chart is displaying:
If I am showing a monthly chart, I want to plot across the last 10 monthly bars; If I am showing a daily chart, I want to plot across the last 10 daily bars; etc.
If I am forced to use a date range, then this functionality breaks down, since I will be shown increasingly more bars for smaller timeframes.
Caveat**
I am able to kinda make this work by specifying the number of bars from the oldest candlestick by stating something like:
bar_index > 2600 ? color=color.black : na
However, given the fact that every single time frame displays a different number of bars, this is not a workable solution for me.
Thanks for any advice.
UPDATE
I have been hunting around and and found that the functionality I desire is already built into the show_last argument of the various plot()functoins.
Ill leave my question posted, in case it helps someone else.
UPDATE I have been hunting around and and found that the functionality I desire is already built into the show_last = int argument of the various plot() functions.
I'll leave my question posted, in case it helps someone else.
I am trying to implement a chart into my website using image-charts, but no matter how I set the x-axis, the labels never works out the way I want it to be.
I read through their documentation, where it says that I can use chxl=<axis_index>:|<label_1>|...|<label_n> to set custome axis labels. I tried using chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60 to label my x-axis, from 0 to 60 with the interval of 5, but it is incrementing by the interval of 10.
This is my graph: https://image-charts.com/chart?cht=lxy&chs=999x480&chd=t:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60|660,570,520,615,492,510,523,495,500,510,562,570,572,531,544,551,568,567,584,570,560,545,537,543,521,517,522,512,519,516,511,519,529,528,533,525,519,531,529,524,524,524,522,518,520,530,518,524,517,512,515,505,507,509,514,505,506,503,502,504,504|0,5,10,15,20,25,30,35,40,45,50,60|0,492,528,612,648,324,492,636,456,492,444,528,396&chco=ffbc8a,407bcb&chg=1,50&chxt=x,y&chls=3|3&chdl=Overall|Last%205%20seconds&chdlp=t&chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60
As you can see from the last line of the url, I have chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60, but if you click on the link and look at the image, the labels for the x-axis is incrementing by 10. I also tried changing the attribute to other values, but the labels always stay as 0 10 20 30 40 50 60.
Disclaimer: I'm Image-Charts founder.
Image-Charts.com was created in 2016 to be as close as possible as the now soon to be shutdown Google Image Charts API.
Here is our documentation regarding axis labels. Please use our documentation instead of the one from Google Image Charts.
Axis labels will be automatically skipped if they can't be displayed on screen.
This is the first time I use chart control in ASP.net
I did the binding between the chart and a datatable to show the stats of revenue per date
Although,
When the selected dates are more than 9, the chart stops displaying them all on the X axis
It displays only 5
What is the reason?
Any workaround?
Any help would be appreciated
Similar problem was found here, and people there recommends to set up some properties, like this:
Try setting the AxisX Interval property to 1
Chart1.ChartAreas[0].AxisX.Interval = 1
note that you may then also want to change the angle of the labels
And after that, as you'll get a lot of values at axis X, you should change the angle for them. like this:
Chart1.ChartAreas[0].AxisX.LabelStyle.Angle = 45
Note that Chart1 is a Id of your chart, and can be different.
I am using MSChart to show blood pressure values sistolic and diastolic, in line chart in a web application using asp.net. The user is allowed to choose a date range before the graph is shown, and we are required to show date in the X axis and the sistolic and diastolic values in the Y axis (two line chart in the same chart area). If the user had entered more than one value for a single day (for sistolic and diastolic), I am required to show the max and min values for sistolic and diastolic.
Is it possible to show that in MSChart, I did a lot of research and went through the samples from Microsoft but could not get any breakthrough, I am at my wits end, any help would be greatly appreciated. By the way is it possible to do that with telerik or by using Microsoft.Office.Interop.Excel dll.
Thanks in advance!
What is the difficulty that you are facing ? Adding two lines or series to the same chart area is no problem. See the Databinding options (Points.DatabindXY) in the samples from Microsoft. If you want to show the min/max as well, then you should select the right chart type like Stock charts instead of a Line chart.