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
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]
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
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).
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