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
Bar Numbering
Collapse
X
-
Hello Bullseye,
I recommend you contact the vendor to see if they have designed this script to set plot values with Add(new Plot()).
If the indicator sets plots, those plots can be used for the Alerts window as well as the Strategy Wizard in NinjaTrader 7.
-
Hi guys ,is there any possibility to set up an alert for Al brooks Bar indicator ? when it plots on the chart to get an WAV. sound or to get notified
Thank you
Leave a comment:
-
Originally posted by koganam View PostI believe I may have edited it while you were working? At any event, what you have is not what I last wrote.
difference = CurrentBar - 1;
Funnily enough, once you use that line, it will not matter if you set sessionBar to zero or one: you should get the same result.
Leave a comment:
-
I believe I may have edited it while you were working? At any event, what you have is not what I last wrote.
difference = CurrentBar - 1;
Funnily enough, once you use that line, it will not matter if you set sessionBar to zero or one: you should get the same result.
Leave a comment:
-
Thank you. I tried that, and now the first bar is numbered 2. Here's the full script; is there something else in there throwing it off? Thanks again.
public class SessionBars : Indicator
{
private int sessionBar = 0;
private int difference = 0;
protected override void Initialize()
{
Overlay = false;
}
protected override void OnBarUpdate()
{
if (Bars.FirstBarOfSession)
{
sessionBar = 1;
difference = CurrentBar;
}
if ((sessionBar + difference) != CurrentBar)
{
sessionBar = sessionBar + 1;
}
if (CurrentBar % 2 == 0)
{
DrawText("bar number" + CurrentBar, sessionBar.ToString(), 0, High[0] + 3 * TickSize, Color.White);
}
}
}
}
Leave a comment:
-
Originally posted by NinjaTrader_Austin View PostDale, you'll have to create some sort of a counter that resets upon each new session. We aren't allowed to write code for customers, but I knew this would be hard to explain and it would result in much back-and-forth between you and us, so I just coded it out for you. Please take a look and study the code so you can see how and when the numbers reset. Of primary interest is the property Bars.FirstBarOfSession - this property returns true if and only if the bar is the first bar of a new session.
Code:public class SessionBars : Indicator { private int sessionBar = 0; private int difference = 0; protected override void Initialize() { Overlay = false; } protected override void OnBarUpdate() { if (Bars.FirstBarOfSession) { sessionBar = 0; difference = CurrentBar; } if ((sessionBar + difference) != CurrentBar) { sessionBar = sessionBar + 1; } DrawText("bar number" + CurrentBar, sessionBar.ToString(), 0, High[0] + 3 * TickSize, Color.Black); } }
Code:if (CurrentBar % 2 == 0) { // place the draw text code here }
Leave a comment:
-
Thanks very much Ryan-- I would like to see if I can modify it to show numbers on two separate rows like in the picture I posted, as when we get into the double digit bars starting with 10 it becomes a bit crowded. Thanks for pointing me to this!
Leave a comment:
-
Hi JoshDance,
One of our members has shared an indicator that does this - available in the file sharing section:
Leave a comment:
-
-
Five stars to Austin
Excellent - takes half the time and supports a new user.
Leave a comment:
-
Thanks Austin, I appreciate your help, I will try it out tommorrow, I really know nothing about code, and my focus right now is on improving my trading results.
Dale
Leave a comment:
-
Dale, you'll have to create some sort of a counter that resets upon each new session. We aren't allowed to write code for customers, but I knew this would be hard to explain and it would result in much back-and-forth between you and us, so I just coded it out for you. Please take a look and study the code so you can see how and when the numbers reset. Of primary interest is the property Bars.FirstBarOfSession - this property returns true if and only if the bar is the first bar of a new session.
Code:public class SessionBars : Indicator { private int sessionBar = 0; private int difference = 0; protected override void Initialize() { Overlay = false; } protected override void OnBarUpdate() { if (Bars.FirstBarOfSession) { sessionBar = 0; difference = CurrentBar; } if ((sessionBar + difference) != CurrentBar) { sessionBar = sessionBar + 1; } DrawText("bar number" + CurrentBar, sessionBar.ToString(), 0, High[0] + 3 * TickSize, Color.Black); } }
Code:if (CurrentBar % 2 == 0) { // place the draw text code here }
Leave a comment:
-
Hi again Austin, I discovered the problem, I use 6.5 for my trading, I haven't switched to 7 for live trading yet. When I created the indicator in 7 it worked, however there is already an indicator called Bar Numbers created by someone else which does the same thing. Could you tell me how to set it so the count starts with the first bar of the day? Right now it starts with the first bar of the first day of the chart series.
DB
Leave a comment:
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
21 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
30 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
||
Started by catinabag, 04-13-2023, 05:46 AM
|
34 responses
1,462 views
0 likes
|
Last Post
by mcosta72
Today, 04:44 PM
|
||
Started by adeelshahzad, Today, 11:49 AM
|
6 responses
24 views
0 likes
|
Last Post
by mcosta72
Today, 04:35 PM
|
||
Started by sidlercom80, 05-05-2020, 07:20 AM
|
4 responses
306 views
0 likes
|
Last Post
by Bidder
Today, 04:35 PM
|
Leave a comment: