Distance from Moving Average

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #147112 quote
    DarcyDarcy
    Participant
    Junior

    Stockcharts have a new feature:

    Distance from Moving Average: The percentage difference between price and a Moving Average of your choice, displayed above or below a zero line

     

    I couldn’t find anything in the search

     

    Thanks

    David

    #147126 quote
    NicolasNicolas
    Keymaster
    Legend

    The below code will calculate the percentage distance from the Close to the average of the defined period.

    period = 30
    ma = average[period]
    percent = (close-ma)/ma*100
    return percent 
    
    Darcy thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Distance from Moving Average


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Darcy @darcy Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
5 years, 12 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/12/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...