Distance from Moving Average

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #147112 quote
    Darcy
    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
    Nicolas
    Keymaster
    Master

    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.

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 Nicolas
5 years, 4 months ago.

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