Percent Close below moving average value

Optuma Forums Optuma Scripting Percent Close below moving average value

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #62063
    Tonia
    • Topics: 9
    • Replies: 11
    • Posts: 20

    Hi guys

    I want to write a script to find stocks which are more than 100% below the 50 sma. I have attempted to do this using the following script but in showbar mode this script also picks up closes within 100% of 50sma. What am I doing wrong?

    //Calc 50MA;
    MA50 = MA(BARS=50, CALC=Close, STYLE=Simple);
    //Close is below 50MA by more than !00% of 50MA value;
    CLOSE() < MA50 and CLOSE() < (MA50*1.01)

    #62065
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Tonia,

    I don’t think 100% is mathematically possible, but your formula is using 1% (MA50 * 1.01)…. If you are looking for when the close is within 1% below the MA50 try this:

    The Show View tool shows the % below 50MA, so JHX is 0.82% from the 50MA:

    Capture

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest