Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Constant line(MIN(BB bandwidth, period))
Collapse
X
-
Constant line(MIN(BB bandwidth, period))
With my limited programming skills I'm trying to plot the minimum value of an indicator looking back n periods. I would like that value as a constant line. Any ideas? Tried to modify the constant line indicator without any success. Shouldn't be too difficult, or?Tags: None
-
Oh, I get a lot of errors I'm afraid... I think the core issue though is what you suggest; to index the MIN method. But how do i do that? Using the private double method, or? I'd really appreciate if you could give me an example then I can fiddle with it a bit more.
Comment
-
Thank you both for your replies. I'm almost there now, but it doesn't exactly do what I want. Here is the code:
#region Variables
privateint minperiod = 100;
#endregion
protectedoverridevoid Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
protectedoverridevoid OnBarUpdate()
{
double minimum = MIN(Bollingerbandwidth(2,14), minperiod)[0];
Plot0.Set(minimum);
Please take a look at this picture I uploaded: http://www.pixbox.se/pic_show_id29954163.html If you look at the 2nd last panel you'll see the "constant" minimum value plotted. You see that there is a drop in the last values. Why is that? It is set on exclude weekends and calculate on bar close: false.
Comment
-
Well, it appears it doesn't really do what I want it to do (se the simple code below).
I would like it to take the minimum value of Bollingerband n days back (including checking the latest close) and plot that value as a constant line (for all days), like a support line.
protectedoverridevoid OnBarUpdate()
{
double minimum = MIN(Bollingerbandwidth(2,18), minperiod)[0];
Plot0.Set(minimum);
}
Possible?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
152 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
87 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
131 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
127 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
106 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment