I'm just using a simple cross above or below bollinger.upper or bollinger.lower.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Rectangle on BB
Collapse
X
-
Live Data. I've used both PriceChange as well as Tick.
Code:if (CrossAbove(Bollinger1.Upper, Close[0], 1)) { Rectangle myRec = Draw.Rectangle(this, "bbTop1"+CurrentBar, 0, Low[0], -10, High[0], Brushes.Transparent); myRec.AreaBrush = Brushes.LightGray; }Last edited by r3n3v; 08-27-2021, 11:21 AM.
Comment
-
Hello r3n3v,
Thanks for your reply.
Please add a debug print to your code that will print when the cross condition is true. This will help to determine if the condition is the issue or the draw method.
For example:
if (CrossAbove(Bollinger1.Upper, Close[0], 1))
{
Print (Time[0]+" Cross condition true");
Rectangle myRec = Draw.Rectangle(this, "bbTop1"+CurrentBar, 0, Low[0], -10, High[0], Brushes.Transparent);
myRec.AreaBrush = Brushes.LightGray;
}
Before updating the indicator on the chart, open the New>Ninjascript output window to observe the prints when they appear. Once you have print statements compare them to the chart (just a few cases) and see if there is a rectangle drawn at each instance of a print.
Comment
-
Hello r3n3v,
Thanks for your reply.
I made a mistake with my copy and paste.
Please try:
if (CrossAbove(Close, Bollinger1.Upper, 1))
{
Print (Time[0]+" Cross condition true");
Rectangle myRec = Draw.Rectangle(this, "bbTop1"+CurrentBar, 0, Low[0], -10, High[0], Brushes.Transparent);
myRec.AreaBrush = Brushes.LightGray;
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
24 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
122 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
93 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
136 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|

Comment