Hi, 1 period SMA is in reality the price itself, say close.. so i'll add the option to input (in study settings) a fast and slow periods.. if you like still to use 1 for fast, that would be ok
also added the choice to input which price to use (close, HL2, HLC3,...etc)
so your code should look like this (from memory, I didn't try it but should work, if you copy/paste in a new study in ToS) ..
also this will produce a non-restricted oscillator .. so no high/low limits for where it can go.. similar to MACD basically .. if we need to restrict it, we may think of relating it to the highest/lowest values for a certain timeframe and they become the 100% limits (like a stochastic) .. does that help?
Last edited by RedK; March 23rd, 2013 at 05:21 AM.
Reason: fixed a code syntax
The following 3 users say Thank You to RedK for this post:
I used that it was very helpful thanks
i have that set up and i threw in a zero line too
but i wanna but a boolean or something to show the cross over and under the zero line
...is there any way to do that?
@xaifax, this would be a straight forward thing to do in ToS - we even have few options to how to display that signal to help a quality trade decision:
1 - can draw a vertical line when it happens, and change the color (red/green) based on the crossing direction
2 - can use an Arrow up/down on the lower study when the crossing happen
3 - can show that arrow up/down signal (or any other type of signal basically) on the price chart itself - there's a trick here, the upper study will need to be a separate one that does the calculation in the background but only plots the signal. it's up to you to ensure both that upper signal study and the lower one are in sync in terms of settings. then this becomes a regular MA crossing signal study (which I think is already built-in in ToS)
4 - other ideas .. audible alerts, display a study label that says "crossing-up" or "long" or something like that,
if you have a preference from above (or other ideas) and need help coding it, i'll be glad to help,