The key is "if price is above the 60-period SMA". Price is a 1-period SMA. You can also describe that condition as "if a 1-period SMA is above the 60-period SMA".
Now let us go one step further. Comparing two moving average is not a new idea, but there is an indicator called MACD = moving average convergence divergence. The original MACD uses 2 EMAs, not SMAs. The only thing you have to do is to replace the EMAs with SMAs.
The Awesome Oscillator is a MACD built from two SMAs. All you have to do is to change the default settings for the fast and slow period from 5/34 to 1/60. However, the Awesome Oscillator calculates the SMAs from the median of the bars. So instead of comparing the close to the 60-period SMA of the closes, you will compare the median to the 60-period SMA of the bar medians. The result will not be very different from what you are trying to achieve, you may even get smoother signals.
Put the Awesome Oscillator on the market analyzer and define a cell condition that checks for greater or smaller than zero. The indicator can be found here.
The MACDUniversalX2 calculates the convergence and divergence from 27 moving averages. You can simply elect to calculate the MACD from SMAs and select the periods 1 and 60 as above. This time you can use the close and achieve exactly what you wish by comparing the indicator value to zero as above. The indicator can be found here:
I've been searching for something similar Fat Tails, except I wanted to use the slope of two SMAs and if greater than 0, color background in Market Analyzer green and if less than zero, use a red color to indicate falling slopes. I can easily use the "cell condition" inside Market Analyzer, the challenge is locating, or coding a silple SMA indicator that will provide its slope, and I am being dense in the head at the moment. Any suggestions? thanks!
@kvankuren: The market analyzer cannot access BoolSeries or Intseries. This means that if you wish to retrieve the slope information, you need to use a plot. Of course you do not want to plot the slope on your chart, so the plot should be transparent. This is what you can do:
Add a transparent plot, call it Trend and set it
-> to 1.0 if SMA > SMA (positive slope)
-> to -1.0 if SMA < SMA (negative slope)
-> to its prior value (unchanged) if SMA = SMA (zero slope)
This plot can than be accessed via the market analyzer. If SMANew.Trend > 0.5, your trend is up. If SMANew.Trend < -0.5, the trend is down.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
The following 5 users say Thank You to Fat Tails for this post:
@Fat Tails I am neophyte with ninjascript and understand your directions after research over the weekend, thank you for your thougtful replay.
This is what I ended up doing to follow few instruments in the analyzer w/o using the plot syntax:
thanks for that suggestion. Is it possible to do the same thing with the attached indicator so it gives a buy or sell signal. I can hear the alerty telling me to go long or short but i have no idea which instrument in analyser is ganerating the signal.
I was thinking that a cell colour change when the alert fires off .go long or go short.
unfortunately the analyser has limited options unless some code is altered in the indicaor . Not being aprogrammer i wouldnt know.
I think i need to learn programming.