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
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
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
-
Originally 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 kevinenergy, 02-17-2023, 12:42 PM
|
118 responses
2,778 views
1 like
|
Last Post
by kevinenergy
Today, 05:41 AM
|
||
Started by briansaul, Today, 05:31 AM
|
0 responses
9 views
0 likes
|
Last Post
by briansaul
Today, 05:31 AM
|
||
Started by traderqz, Yesterday, 12:06 AM
|
11 responses
28 views
0 likes
|
Last Post Today, 05:11 AM | ||
Started by PaulMohn, Today, 03:49 AM
|
0 responses
8 views
0 likes
|
Last Post
by PaulMohn
Today, 03:49 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
1 response
10 views
0 likes
|
Last Post Today, 02:18 AM |
Comment