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
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 habeebft, Today, 07:27 AM
|
1 response
11 views
0 likes
|
Last Post Today, 08:08 AM | ||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:57 AM | ||
Started by Max238, Today, 01:28 AM
|
4 responses
37 views
0 likes
|
Last Post
by Max238
Today, 07:49 AM
|
||
Started by r68cervera, Today, 05:29 AM
|
1 response
10 views
0 likes
|
Last Post Today, 07:47 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
1 response
14 views
0 likes
|
Last Post Today, 07:38 AM |
Comment