New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

How to scan for an embeded Moving Average of an Indicator

I tried Chartschool to find an answer to my riddle but to no avail.

Let's say I use RSI (14) as my main indicator, and I insert a moving average "behind" it, like the 10-day EMA.
So, how to create a scan that will find the crossover of the RSI over the "embedded" moving average?

I tried the following, but none are working:

[today RSI (14) x EMA 10 (RSI 14)]
[yesterday RSI (14) x EMA 10 (RSI 14)]
[today RSI (14) x yesterday EMA 10 (RSI 14)]

Any ideas how to do it?

Best Answers

  • markdmarkd mod
    edited June 2018 Answer ✓
    Your logic is correct. Just a syntax issue.


    and [RSI (14) x EMA(10, RSI (14))]


    So, a couple of notes.

    You don't need "today" or "yesterday" when using the "x" operator. It takes care of that for you (which you probably knew, until the first phrase didn't work).

    When you use a function like ema( ) or sma( ), you have to follow the format for that function, just as you do for an indicator. You need the parentheses, if there are any, you need the right number of parameters in the right order, and you need the commas between them.

    There are many scripting languages out there and they all have different rules. For Stockcharts, you can get the correct format for anything (in the daily time frame version) from the drop downs on the scan workbench. EMA( ) is under "Technical Indicators". You will have to edit the default form, but it gets you started.

    The "Writing Scans" link at the bottom of the scan workbench page is worthwhile:

    https://stockcharts.com/docs/doku.php?id=scans:advanced_scan_syntax

    Also, this previous question has a quick and dirty summary of scan rules in one of the posts:

    http://scan.stockcharts.com/discussion/comment/4308#Comment_4308
  • PeterPan8PeterPan8
    Answer ✓
    Thank you Mark! You made my day! And many thanks for taking the time to answer all those questions from pros and newbies alike... You're the man :-)
  • markdmarkd mod
    Answer ✓
    Thanks for the kind words. Appreciate the acknowledgment.
  • markdmarkd mod
    Answer ✓
    If I get what you are looking for, it is the Full Stoch %K of Stoch RSI crosses 50.

    So, if you could do it, it would look like this:

    [group is sp500]

    and [Full Stoch %K(14,3,3,Stoch RSI(14)) x 50]

    But, you get an error message that %K cannot take a fourth parameter - in other words, in the scan engine, %K can only be calculated for closes and not for indicator values.

    But, it appears that the %K overlay on Stoch RSI is also calculating the %K of price, not Stoch RSI.

    So, you could just build a scan where you specify on separate lines Stoch RSI > .8 and %K x 50.
  • lmkwinlmkwin ✭✭
    Answer ✓
    From SC support on scanning for overlays

    https://support.stockcharts.com/doku.php?id=scans:advanced_scan_syntax:overlay_scans

    Other Overlays
    Remember that while these three overlays (EMAs, SMAs and Slope) are the most popular for use in scans, any technical indicator that has an optional “exp” parameter can be used as an overlay in your scans. Check out the Scan Syntax Reference to find additional indicators that can be used in this way.



    The Stochastics don't have the option of ,exp in the acceptable parameters.

    https://support.stockcharts.com/doku.php?id=scans:indicators

Answers

  • PeterPan8PeterPan8
    edited February 23
    That's an old post, but this time I'm looking for a trickier embedded scan.

    Now, using the same embedded logic from my previous question (when I was much younger!) I'm looking for a scan using FullStoch behind StochRSI.

    So far, I tried many options, the latest on the list... but still doesn't work. I started with the above statement:
    and [RSI (14) x EMA(10, RSI (14))]

    changed some parameters like this:

    and [(Full Stoch %K((14,3,3), Stoch RSI(14)) x .7]

    getting errors. I'm stuck there.... Any idea?

  • markdmarkd mod
    edited February 23
    First glance:

    You have a comma between Full Stoch and Stoch RSI - a comma is not an operator.

    In plain english (meaning instead of in code) what do you want to see happening on these indicators?

    Have you put these indicators as you want them on a chart?

  • PeterPan8PeterPan8
    edited February 23
    It was voluntary as I tried to adapt from EMA(10, RSI (14) which represents the EMA 10 of the RSI (14).
    So, my "bright" logic was to use the same pattern by adding a comma between the elements.

    My idea is to find the breakout above 0.7 of the FullStoch behind (embedded) the StochRSI.
  • Can you post a picture of the Full Stoch behind the embedded StochRSI?

  • If you look late January, you will see that (sometimes) the StochRSI will move past > 0.8 but the Full Stoch will only confirm it a couple days later. That's what I'm trying to scan.
    First, SRSI x 0.8 then FullStoch (Behind SRSI) x 50. It's easier to understand on the picture.
Sign In or Register to comment.