Calculate Distance Between 2 Moving Averages

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #149742 quote
    Mishap
    Participant
    Junior
    //get distance from averages relative to one above or below
    Ind1 = Average[10] (close)
    Ind2 = Average[15] (close)
    DistPer = abs(Ind1/Ind2)*100
    
    GRAPH DistPer AS "Distance"

    I will begin by opening with the same statement as most people that post here with the old ” I am new to coding & Pro Real Code” :).

    What i I am trying/would like to do is get the distance as a percentage between 2 averages. Im not sure that i am on the right path  as the result is skewed i believe with some outputs being over 100%

    I would have thought that it the distance would likely be less given it is the same candle just 2 different averages derived from it.

    Any help is appreciated.

    #149746 quote
    robertogozzi
    Moderator
    Master

    Try this as line 4:

    DistPer = (Ind1-Ind2)*100/Ind1
    Mishap thanked this post
    #149761 quote
    Mishap
    Participant
    Junior

    That Works Roberto,

    Thank you 🙂

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

Calculate Distance Between 2 Moving Averages


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Mishap @mishap Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Mishap
5 years, 3 months ago.

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