get last bar candle index
get last bar candle index
23 Jul 2021, 07:13
i try to draw box from last candle .
i use chart.lastbarvisible and bars.count
but when i move the chart to past recatangle moved.
so i need to get last bar candle index.
var rectangle = Chart.DrawRectangle("rectangle_sample", Bars.Count, Bars.ClosePrices.Minimum(Period), Chart.LastVisibleBarIndex - Period, Bars.ClosePrices.Maximum(Period), Color.FromArgb(100, Color.Red));
Replies
IRCtrader
23 Jul 2021, 09:04
( Updated at: 21 Dec 2023, 09:22 )
RE:
amusleh said:
Hi,
I'm not sure what you are trying to do, Bars.Count gives you the number of available bars on your chart, so if you pass it as a first bar index for rectangle, it will be drawn from the last bar on your chart.
I use that but when scrool to past it shows like below picture.
@IRCtrader
amusleh
23 Jul 2021, 09:27
Hi,
Please read the API references, check the examples, I see you don't understand how the DrawRectangle works, and it's not clear at all what you are trying to do.
I recommend you before you open a thread here, read the API references, play with code examples, then if something was not clear you can ask here.
@amusleh
amusleh
23 Jul 2021, 08:08
Hi,
I'm not sure what you are trying to do, Bars.Count gives you the number of available bars on your chart, so if you pass it as a first bar index for rectangle, it will be drawn from the last bar on your chart.
@amusleh