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
  • #62063
    • 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)

    • Topics: 63
    • Replies: 557
    • Posts: 620

    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:


    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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.