% of days down-up in last 126 tds

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183874 quote
    AlfyAlfy
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    AlfyAlfy
    Participant
    Average

    Thank you Roberto!

Viewing 3 posts - 1 through 3 (of 3 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

% 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 AlfyAlfy
4 years, 9 months ago.

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