So I assume I can just replace the SMA part in the BBand code with whatever the code is for the mean of the high and the low.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Mean of the High line plot
Collapse
X
-
Mean of the High line plot
Im sure this is terribly simple, I was thinking it would probably be easiest just to use the bollinger band code and alter it. Looking to plot the mean of the high and the mean of the low and then plot 1 standard deviation from each line.
So I assume I can just replace the SMA part in the BBand code with whatever the code is for the mean of the high and the low.Tags: None
-
Ok that was really simple, just added High to the smaValue code line. It calculates the High mean correctly. But the standard deviation is off which I can see from checking in an Excel spreadsheet. I even checked the custom NT Bollinger band indicator, its not calculating 1 Standard Deviation correctly. Its less than 1 its something like .82 of a StdDev.
You can check it for yourself, just take any two day period and check 1 StdDev of the 2 closes. As an example..
Nasdaq Composite index:
last wed close 3196.88
last thrsdy close 3198.66
mean is 3197.77
StDev(3196.88; 3198.66) =1.2586
Upper band should then equal the mean + 1StDev or 3197.77 + 1.2586 = 3199.0286
But ninja trader shows 3198.66Last edited by zachj; 02-18-2013, 11:55 AM.
Comment
-
I tested this on my end and get the correct results when simply printing the Standard Deviation of two values.
Could you post your code and your expected result so that we may examine further.
Additionally please ensure you're storing the value as a double and not as an int.LanceNinjaTrader Customer Service
Comment
-
The StdDev() will get the population standard dev which in this example is equal to .89Originally posted by zachj View PostNasdaq Composite index:
last wed close 3196.88
last thrsdy close 3198.66
mean is 3197.77
StDev(3196.88; 3198.66) =1.2586
Upper band should then equal the mean + 1StDev or 3197.77 + 1.2586 = 3199.0286
But ninja trader shows 3198.66
You would have to code your own function if you wished to use the basic standard deviation value
For a good StdDev calculator along with a detailed tutorial on the math behind it: http://easycalculation.com/statistic...-deviation.php
Please let me know if I can be of further assistance.LanceNinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
563 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
329 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment