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)
plotting the difference between two moving averages as a lower study in ToS
Does anyone know how to take the difference between a 7 period SMA and 1 period SMA and plot it as an oscillator in a separate frame on ToS? Any help would be greatly appreciated.
Can you help answer these questions from other members on NexusFi?
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?
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,
K
you can use a MACD with settings of 1 and 50 and 1 - i'm doing this from memory but I think that should give you what you're looking for if i'm not mistaken,