I am saving important bars into a list and then trying to print the time value associate with those bars. Using Print(string.Format(Time[Barnumber_Low[count]]) will not work because this will print the bars ago function. So I am looking for a way to print the bars associated with the stored bar number. If I figure this out I will post it here.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Printing time that is associated with a historical bar list
Collapse
X
-
Printing time that is associated with a historical bar list
In case I answer this I think it will be beneficial for anyone in the future to know.
I am saving important bars into a list and then trying to print the time value associate with those bars. Using Print(string.Format(Time[Barnumber_Low[count]]) will not work because this will print the bars ago function. So I am looking for a way to print the bars associated with the stored bar number. If I figure this out I will post it here.Tags: None
-
Okay so I have a few sections. The low and the high lists are identical except for the name.
//if Current trading day not equal to previous trading day. Clear the bar list
if(Daily_inquiry != New_Tradingday.GetTradingDay(Time[0]) || Daily_inquiry == null)
{
//count = 0;
Barnumber_High.Clear();
Barnumber_Low.Clear();
Low_Time_stamps.Clear();
High_Time_stamps.Clear();
Daily_inquiry = New_Tradingday.GetTradingDay(Time[0]);
}
//stores current bar for future comparisons
Barnumber_High.Add(CurrentBar);
High_Time_stamps.Add(Time[0]);
//prints every value in the list
for(int count = 0; count < Barnumber_High.Count; count++)
{
Print(string.Format("Possible high occurs at bar number " + Barnumber_High[count] + " which occurs on " + High_Time_stamps[count] ));
}
-
Hello RISKYBUSINEZZ,
Thanks for your post.
CurrentBar would be used to get the current forming bar on the chart. Time[0] would be used to get the current time of the current bar on the chart.
See the help guide documentation below for more information and sample code.
CurrentBar: https://ninjatrader.com/support/help...currentbar.htm
Time[0]: https://ninjatrader.com/support/help...eries_time.htm
Unfortunately, using Lists in a custom NinjaScript falls under C# education which goes beyond the level of support we would be able to provide you with. To find educational information about using Lists in C#, you could do a quick Google search for something like 'using Lists in C#'.
Otherwise, this forum thread will be open for other community members to share their insights on this topic.
Let me know if I may assist further.
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Yes, no worries. So the best way to store these values is to get Time[#] for the bar you need and store it as it is occurring in a list that is indexed at the same time you store the bar. In my case I had to adjust it to Time[#] to do some logic on the candles before storing the value.
So basically information stored in lists is the way to go for sure. I managed to get it working. I'll try and post the full code later.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
580 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
335 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
102 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment