Could you show me a code sample? thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
How to get the time stamp base on the index of Bar?
Collapse
X
-
How to get the time stamp base on the index of Bar?
For example, I would like to know when the 20th bar started. it should return a time, like: 9:30am.
Could you show me a code sample? thanksTags: None
-
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
base.OnRender(chartControl, chartScale);
// loop through only the rendered bars on the chart
for(int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
{
// get the time stamp at the selected bar index value
DateTime timeValue = Bars.GetTime(barIndex);
Print("Bar #" + barIndex + " time stamp is " + timeValue);
}
}
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by llanqui, Today, 08:32 AM
|
1 response
5 views
0 likes
|
Last Post
by llanqui
Today, 08:50 AM
|
||
Started by lollers, Yesterday, 03:26 AM
|
1 response
51 views
0 likes
|
Last Post
by lollers
Today, 07:20 AM
|
||
Started by Salahinho99, 05-05-2024, 04:13 AM
|
7 responses
59 views
0 likes
|
Last Post
by Salahinho99
Today, 06:45 AM
|
||
Started by knighty6508, 05-10-2024, 01:20 AM
|
4 responses
29 views
0 likes
|
Last Post
by knighty6508
Today, 05:29 AM
|
||
Started by OllieFeraher, 05-09-2024, 11:14 AM
|
6 responses
19 views
0 likes
|
Last Post
by OllieFeraher
Today, 04:00 AM
|
Comment