protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
Value[0] = 0;
if (CurrentBar < Period) return;
double totalVolume = 0;
for(int i = 0; i <= Period; i++)
{
totalVolume += Volume[i];
}
TotalVol[0] = totalVolume;
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Total Volume for the day indicator
Collapse
X
-
Total Volume for the day indicator
Hello, I created an indicator that calculates the sum of bars volume for a period of bars. (See code below) I need help converting the period from a hard number to the number of bars since open (9:30AM ET) This would be plotted in a one minute chart. Any suggestions welcomed. Thanks.
Code:Tags: None
-
Hello designer01,
Thanks for your post.
Something you could consider is creating a Time Comparison condition that checks if the Time is 9:30AM and save the CurrentBar value to an int variable named something like CurBarAt930.
Then, create a condition that checks if CurrentBar > CurBarAt930 and save the CurrentBar - CurBarAt930 to an int variable named something like BarsSince930 to get the number of bars that have passed since 930AM.
I have attached a simple example script demonstrating this concept. The indicator prints out the number of bars that have processed since 930AM to the Output window as well as the CurrentBar value and CurrentBar value at 9:30AM (CurBarAt930) so you could compare them to the BarsSince930.
Creating Time Comparisons: https://ninjatrader.com/support/help..._builder.htm#H owToCreateTimeComparisons
CurrentBar: https://ninjatrader.com/support/help...currentbar.htm
Please let me know if I may assist further.Attached FilesLast edited by NinjaTrader_BrandonH; 03-05-2023, 08:16 PM.<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>
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
600 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
558 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
558 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment