% of days down-up in last 126 tds

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183874 quote
    Alfy
    Participant
    Average

    Good morning guys, does anyone know a way to build the % of down (close-close1) minus the % of up trading days (close-close1) of a stock over the last 126 trading days please? So for example, if a stock was down 35% and up 65% of the last 126 trading days, then the answer would be 0.35-0.65=-0.3

    Thanks and happy holidays!

    #183878 quote
    robertogozzi
    Moderator
    Master

    Not tested:

    N           = 126
    Up          = summation[N]((close - close[1]) > 0)
    Down        = summation[N]((close - close[1]) < 0)
    Total       = Up + Down
    UPpercent   = Up   * 100 / Total
    DOWNpercent = Down * 100 / Total
    Difference  = UPpercent - DOWNpercent
    Return Difference as “Difference”

    when Difference > 0 UPs are greater than DOWNs, when < 0 it’s the other way round.

    Alfy thanked this post
    #183879 quote
    Alfy
    Participant
    Average

    Thank you Roberto!

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

% of days down-up in last 126 tds


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alfy @alfy Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Alfy
4 years, 1 month ago.

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