Script: pullback into 20 period EMA

Optuma Forums Optuma Scripting Script: pullback into 20 period EMA

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #65415
    Louis
    • Topics: 14
    • Replies: 21
    • Posts: 35

    Hi,

    Hi. Sorry to bother with such a seemingly simple script. I am stuck though. Please explain what I am doing incorrectly. When I run this script as a scan looking through the S&P 500, it returns stocks with price well above 2% from the 20 period EMA. Please advise. Thank you.

    #65416
    Matthew
    • Topics: 5
    • Replies: 421
    • Posts: 426

    Hi,

    Can you provide an example of a code that passed which shouldn’t have, and the properties of the scan you are using?  The script looks ok to me based on a manual check:

    Ex4
    20SMA Line with a 2% band, shaded green zone shows criteria matches when Close is in-between the two lines.

    #65417
    Louis
    • Topics: 14
    • Replies: 21
    • Posts: 35

    Hi Matthew,

    Please see the attached word document showing you the results I get.

    Thank you.
    Louis

    #65420
    Matthew
    • Topics: 5
    • Replies: 421
    • Posts: 426

    Hi,

    From what i can see you have Exponential Moving Averages on the chart, but are using Simple Moving Averages in the script.  If you changed the Moving Averages to Simple on the chart you should see those two codes (ADBE and ZTS) are passing correctly.

    Ex5

    Alternatively, adjust the scripts to use EMAs instead of SMAs and those two codes are no longer part of the scan results.

    #65421
    Louis
    • Topics: 14
    • Replies: 21
    • Posts: 35

    Thank you so much! Sorry I missed that. My brain is mush so many hours into my workday. You are exactly right in that the settings were not set to exponential. I even figured out how to script exactly what you did. I love Optuma, and I want to say that your your help means so much to me as I work become proficient in Optuma!
    Screenshot 2021-08-04 220100

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest