Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm having trouble coding the difference between a shorter-period simple moving average and a longer-period simple moving average as an oscillator in NinjaTrader. The result is a de-trended oscillator that can help getting into a strong trend. Would anyone mind helping write this?
Can you help answer these questions from other members on NexusFi?
If you calculate the difference between a shorter SMA and a longer SMA, the result will be a MACD type indicator. The Awesome Oscillator and Linda Bradford-Raschke's 3/10 Oscillator are both calculated as the difference between two SMAs. They are momentum oscillators and can be used to enter or exit positions based on momentum.
If you talk about the detrended oscillator, it is completely different. For the detrended oscillator you do not compare two moving average, but you compare a moving average to the close in the center of the lookback period of that moving average. If you select a SMA with the lookback period of N, then the detrended oscillator compares the price N/2 bars ago to the current value of the SMA. This information is not "up-to-date" and cannot be used for momentum trading, but is a tool in cycle analysis.
My mistake. I was actually just looking for the difference between closing prices and a simple short-period moving average on price plotted as an indicator. On a short horizon intraday chart, it can be used to help enter a position once the most recent bar has closed via divergence or other interpretations.
Exported using NT Version 7.0.1000.3
Bill William's Awesome Oscillator is quite similar to the raw MACD, but uses simple moving averages with a period of 34 and 5 instead of the exponential moving averages used for the MACD. The input value is the …
and set the fast period to 1 (the close is identical with the 1-period SMA).
(2) If you want to try out other moving average types, you can also use the MACDUniversalX3
The LBR 3/10 oscillator is a MACD built from SMAs. Calculate the difference from a 3-period and a 10-period simple moving average. This is the oscillator line. Then calculate a 16-period simple moving average from the oscillator line. This is the signal …
These lines of code from the awesome oscillator are the only ones I need plotted. I tried to edit out the rest but couldn't make a functioning indicator when I tried to do so. Does anyone know how to code this formula into NinjaTrader? Any help would be greatly appreciated.
You just need to comment out everything related to Plots[1] an Plots[2]. Also remove all lines referring to "SignalLine" and "Oscillator", and just keep those related to "OscillatorLine". You also need to modify the properties accordingly.
Alternatively you can use the indicator as it is and just set the plots that you do not need to transparent.