How to add or subtract an indicator value from itself

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #65925 quote
    maximus78
    Participant
    Senior

    Good morning to everybody, I need a little help to understand the algorithm construction process in probuilder of the following indicators examples.

    How to subtract or add to an indicator value, the value of the previous period (yesterday’s indicator value).

    For example the PVT:

    %var = (close – yesterday’s close) / (yesterday’s close)

    PVT = %var * today’s volume + yesterday’s PVT

    Or the Williams acc/distr.

    TRH = the highest of (yesterday’s close or today’s high)

    TRL = the smallest of (yesterday’s close or today’s low)

    If the today’s close > yesterday’s close then A/D = today’s close – TRL

    if the today’s close < the yesterday’s close then A/D = today’s close – TRH

    If the today’s close = yesterday’s close then A/D = 0

    A/D William = today’s A/D + yesterday’s A/D William

    Thanks so much

     

    Max

    #65951 quote
    robertogozzi
    Moderator
    Master
    For example the PVT:

         %var = (close – yesterday’s close) / (yesterday’s close)                                       //—>        VarPercent = (close – close[1]) / close[1]

         PVT = %var * today’s volume + yesterday’s PVT                                              //—>        Pvt = VarPercent * Vol + Pvt[1]

    Or the Williams acc/distr. TRH = the highest of (yesterday’s close or today’s high)                                     //—>        Trh = Max(close[1], high) TRL = the smallest of (yesterday’s close or today’s low)                                     //—>         Trl = Min(close[1],low) If the today’s close > yesterday’s close then A/D = today’s close – TRL          //—>         if close > close[1] then AD = close  – Trl if the today’s close < the yesterday’s close then A/D = today’s close – TRH  //—>          if close < close[1] then AD = close – Trh If the today’s close = yesterday’s close then A/D = 0                                          //—>          if close = close[1] then AD = 0 A/D William = today’s A/D + yesterday’s A/D William                              //—>          AD = AD + AD[1]
    #66025 quote
    maximus78
    Participant
    Senior
    Thanks Roberto, yes the PVT works, but the Williams AD doesn’t. I tried but it doesn’t give me any result, could you check please, maybe I’m making some mistakes. Thanks a lot, Max
    Trh = Max(close[1], high)
    Trl = Min(close[1],low)
    if close > close[1] then
    AD = close  - Trl
    elsif close < close[1] then
    AD = close - Trh
    elsif close = close[1] then
    AD = 0
    endif
    AD = AD + AD[1]
    
    return AD
    #66034 quote
    robertogozzi
    Moderator
    Master
    I do not know what lines 4, 6 and 8 do, so I can not tell you if they are good or not. I told you the syntax to do it, but what’s behind the A / D William just do not know! (translated from Italian to English by Nicolas).
    #66367 quote
    maximus78
    Participant
    Senior
    Hi Roberto, I have resolved it…. I have replaced line 10 : AD = AD + AD[1] with WAD = CUMSUM (AD) cumulative instruction “cumsum” in the end of the formula. Max
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

How to add or subtract an indicator value from itself


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
maximus78 @maximus78 Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by maximus78
7 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/21/2018
Status: Active
Attachments: No files
Logo Logo
Loading...