Here is a nice little code, finally I am proud of it !
Indeed in my beginnings, it was impossible for me to create Renko on prices.
What is the point of creating a Renko, as this graph can be already displayed on ProRealTime ?
Well, simply because PRT can not backtest from Renko ! This means that we must create ourself a corresponding indicator.
That’s the purpose of this code, so you can backtest many strategies based on Renko, at last !
This indicator has fixed-size boxes, that’s the “why” of its name. Actually, he still uses the closing price. It would be perfect if it used the current price whatsoever at any time. But I do not see me using other than the command “close” to determine the price at a given time. For this graph and for example, I put this on the DAX, with fixed boxes of 100 points.
boxsize = 100
// à paramétrer selon la valeur.
//Exemple 100 points pour le DAX, 0.0020 point pour l'EUR/USD, etc.
once upbox = close
once downbox = close - boxsize
IF close crosses over upbox + boxsize THEN
upbox = upbox + boxsize
downbox = downbox + boxsize
ELSIF close crosses under downbox - boxsize THEN
upbox = upbox - boxsize
downbox = downbox - boxsize
ENDIF
RETURN upbox as "UP Box", downbox as "DOWN Box"