Renko boxsize in percent?
- This topic has 2 replies, 2 voices, and was last updated 5 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Renko boxsize in percent?
Tagged: renko
Hi!
I’ve been searching for examples of this code but can’t find it.
In PRT-charts it is possible to get the Renko boxes in % price movements. For example, 0.1 % is set as default. In the examples that I found of automated trading strategies or indicators using Renko, they are all written with a boxsize in pips. I can’t figure out how to code a boxsize in % of price. Is there a friendly soul that knows how and would like to share?
The below code is plotting renko boxes with a dynamic size in percentage of the current Close:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
percent = 0.1 boxsize = close*(percent/100) once renkoMax = ROUND(close / boxSize) * boxSize once renkoMin = renkoMax - boxSize IF close crosses over renkoMax + boxSize THEN WHILE close > renkoMax + boxSize renkoMax = renkoMax + boxSize renkoMin = renkoMin + boxSize iclose = renkomax WEND ELSIF close crosses under renkoMin - boxSize THEN WHILE close < renkoMin - boxSize renkoMax = renkoMax - boxSize renkoMin = renkoMin - boxSize iclose = renkomin WEND ENDIF if iclose=renkomax then r=0 g=255 else r=255 g=0 endif RETURN renkomax coloured(r,g,0) as "UP Box", renkomin coloured(r,g,0) as "DOWN Box" |
Choose the percent value in line 1 by adjusting the “percent” variable.
If you want the box size to be set only at first bar and therefore fixed for the rest of the history, change the line boxsize with:
|
1 |
ONCE boxsize = close*(percent/100) |
Find exclusive trading pro-tools on 