I wrote a code to trade renko pullbacks in the daily chart, but it doesn’t function, someone can please help? I know the code is realy rude but it’s the first time for me to coding, be patient to understand it.
renkoboxsize = 0.0085 // DIMENSIONE COSTANTE IN PIPS DEL BOX RENKO
count = 0
i = 0
boxes1 = 0
boxes2 = 0
actualbox = 0
// Controlliamo se il box attuale è verde o rosso
WHILE (count = 0)
sum = close[i] - close[i + 1] + sum
IF sum >= renkoboxsize THEN
actualbox = 1 // Il box attuale è verde
boxes1 = boxes1 + 1
count = 1
ELSE
IF sum <= renkoboxsize * -1 THEN
actualbox = 2 // Il box attuale è rosso
boxes1 = boxes1 + 1
count = 1
ENDIF
ENDIF
i = i + 1
WEND
sum = 0
count = 0
// Il box precedente a quello attuale deve essere di colore opposto, verifichiamolo:
WHILE (count = 0 )
sum = close[i] - close[i + 1] + sum
IF sum >= renkoboxsize * 2 AND actualbox = 2 THEN
verify = 2 // Il trend deve essere negativo
boxes1 = boxes1 + 1
count = 1
ELSE
IF sum <= renkoboxsize * -2 AND actualbox = 1 THEN
verify = 1 // Il trend deve essere positivo
boxes1 = boxes1 + 1
count = 1
ENDIF
ENDIF
i = i + 1
WEND
sum = 0
count = 0
// Ora dobbiamo andare a ritroso per verificare in che trend ci troviamo
if verify = 1 THEN
While count = 0
sum = close[i] - close[i + 1] + sum
if sum <= renkoboxsize * -1 THEN
boxes1 = boxes1 + 1
sum = 0
ENDIF
if sum >= renkoboxsize * 2 THEN
count = 1
ENDIF
i = i + 1
WEND
count = 0
sum = 0
while count = 0
sum = close[i] - close[i + 1] + sum
if sum >= renkoboxsize then
boxes2 = boxes2 + 1
sum = 0
ENDIF
if sum <= renkoboxsize * -2 then
count = 1
boxes2 = boxes2 + 1
endif
i = i + 1
WEND
sum = 0
count = 0
endif
if verify = 2 THEN
While count = 0
sum = close[i] - close[i + 1] + sum
if sum >= renkoboxsize THEN
boxes1 = boxes1 + 1
sum = 0
ENDIF
if sum <= renkoboxsize * -2 THEN
count = 1
ENDIF
i = i + 1
WEND
count = 0
sum = 0
while count = 0
sum = close[i] - close[i + 1] + sum
if sum <= renkoboxsize * -1 then
boxes2 = boxes2 + 1
sum = 0
ENDIF
if sum >= renkoboxsize * 2 then
count = 1
boxes2 = boxes2 + 1
endif
i = i + 1
WEND
sum = 0
count = 0
endif
IF verify = 1 AND CountofLongShares = 0 AND CountofShortShares = 0 THEN
IF boxes1 <= boxes2 THEN
BUY 1 SHARES AT MARKET
SET TARGET PROFIT 850
SET STOP LOSS 1720
ENDIF
ENDIF
IF verify = 2 AND CountofLongShares = 0 AND CountofShortShares = 0 THEN
IF boxes1 <= boxes2 THEN
SELLSHORT 1 SHARES AT MARKET
SET TARGET PROFIT 850
SET STOP LOSS 1720
endif
endif
The renko box size in the code is used in EUR/USD and the backtest must be done form 2 years ago. TY
Glaube sie nicht das sie bei solchen takeprofit und stoplos zielen sehr hohe übernacht kosten bekommen werden?
Do not you think they will get very high overnight costs at such takeprofit and stoplos?
Please guys, I’m not here to translate all your posts in the correct forum language! This is the English forum, please speak in English!! Thank you 😉
@edored
I’m sorry but your code is not so clear. Why are you making so much WHILE/WEND loops? It may have sense for you, but I still don’t get it myself sorry 🙂
About your post:
and the backtest must be done form 2 years ago. TY
I can help for sure to create code for you, but you’ll have to make test on your own of course.
So, in order to help you with speed and efficiency, could you please describe the whole strategy in English words? Screenshot like you made in your first post is greatly appreciated.