ACCUMULATED DIFFERENCE
Forums › ProRealTime English forum › ProBuilder support › ACCUMULATED DIFFERENCE
- This topic has 4 replies, 3 voices, and was last updated 10 months ago by Jean FX.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
12/13/2023 at 12:05 PM #225205
HI. Need help returning the value “D”.
I am trying to compare todays close with yesterdays for a specific hour, in this case 21000. Then I want to accumulate the difference over time, “D”, with a start value of 100, “ONCE D=100”. But the code will only return the value “100” for “D” and not adding the movement per day.
ONCE D=100
IF TIME=210000 THEN
C=CLOSE
A=(C-C[1])/C[1]//percent movement per day
B=D*A//Value movment per day
D=D+B//Accumulated value over time
ENDIFRETURN A*100 AS “PROCENT”, B AS “VALUE”, D AS “ACCUMULATE”
12/13/2023 at 12:42 PM #225208Try this one:
12345678910111213ONCE D=100IF TIME=210000 THENC=CLOSEA=(C-C[1])/C[1]//percent movement per dayB=D*A//Value movment per dayD=D+B//Accumulated value over timeELSEX=CLOSEA=(X-C)/C//percent movement per dayB=D*A//Value movment per dayD=D+B//Accumulated value over timeENDIFRETURN A*100 AS "PROCENT", B AS "VALUE", D AS "ACCUMULATE"12/13/2023 at 12:54 PM #22521112/13/2023 at 12:59 PM #22521212/20/2023 at 3:49 PM #225543The problem is that we also need to define C on the first candlestick, an example of a quick correction:
12345678910ONCE D=100ONCE C=1IF TIME=210000 THENC=CLOSEA=(C-C[1])/C[1]//percent movement per dayB=D*A//Value movment per dayD=D+B//Accumulated value over timeENDIFRETURN A*100 AS "PROCENT", B AS "VALUE", D AS "ACCUMULATE" -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)