Some help with Renko

Questions about MultiCharts and user contributed studies.
GuppyDRV
Posts: 57
Joined: 20 Jan 2017
Has thanked: 1 time
Been thanked: 2 times

Some help with Renko

Postby GuppyDRV » 16 Sep 2019

Hello all,

I know.....I know Renko! I’ve been using them successfully for years with manual trading and have been trying to creat some automated signals based on the indicators that I use visually.

The basic setup although the time period and points are random. I’ve tried different settings but get the same results.

  • Multi Chart 11
  • 3 Minute Renko
  • 2 point bars
  • No Phantom bars
  • No show real open
  • brake on session
  • trade RTH ES
  • No offsets
Sample of the code I’m using:

Code: Select all

If timeFilter and marketposition = 0 then
begin
​If barstatus(1)= 2 then
begin
​​
​If (Stratagey Logic Here) then
begin
​sellshort ("Short1") 1 contracts this bar on Close; //needed for backtest with Renko
​end;
​end;
end;

If marketposition = -1 then
begin
​If barstatus(1)= 2 then
begin

​If (Stratagey Logic Here) then
begin
​buytocover ("E1") from entry ("Short1") 1 contracts this bar on Close;
​end;
​end;
end;
The problem is two fold and requires a bit of an explanation.

First: As we all know Renko bars are price based and not time based although they have a time component. This time component is the measurement period whereby the bar decides if the point range has been exceeded thus causing a new bar to be formed. In this example at 3 minute intervals the bar performs a check and can either close and form a new bar or continue on with this loop. I’m finding that my strategy is closing on the first iteration of the time loop regardless of how long the bar is in existence. So let’s say that my 3 minute bar takes 30 minutes to exceed the 2 point range and form a new bar my strategy fires at the end of the first 3 minute period leaving 27 more minutes until actual bar close.

When bars are formed at the end of the first 3 minute period things perform as expected on the close of that bar. It’s only when a bar goes beyond the first 3 minute period that I have problems.

Secondly: When the strategy is applied to a historical chart the trades on the historical chart happen exactly one bar prior to where they happened in real time. I’m stumped as to why! I can use code to work around this and delay the trades one bar to mirror real time but would prefer to actually have the strategy trade as it backtest or backtest the way it trades if that makes sense!

Thanks everyone for some much needed help.

GuppyDRV

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Some help with Renko

Postby Svetlana MultiCharts » 03 Oct 2019

Hello, GuppyDRV,

How many data series do you use?

Please update MultiCharts up to the latest release version. You can download the latest version via the main MultiCharts window -> Help -> Check for updates menu.

For the first issue, on the chart where the issue is reproduced please apply the prebuilt indicator Custom 1 Line and change its input to Barstatus(1) in Format -> Study -> Format -> Inputs -> change the value next to Formal input and click OK. After that please reproduce the issue and record a short video demonstrating it so that indicator values were clearly seen.

Also please make a video demonstrating the second issue (where the trades on the historical chart happen exactly one bar prior to real time). Do you face the same issue with regular chart type?

Please send us the videos and the following files to support@multicharts.com so that we would be able to investigate the issue:
1. The workspace where the issue is reproduced.
2. Export of used symbols (with data) from QuoteManager in .qmd archive: http://www.multicharts.com/trading-soft ... rting_Data
3. The exported scripts with all dependent functions that are used on the workspace (you can use the simplified script to reproduce the issue): http://www.multicharts.com/trading-soft ... ng_Studies

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Some help with Renko

Postby TJ » 03 Oct 2019

Hello all,

I know.....I know Renko! I’ve been using them successfully for years with manual trading and have been trying to creat some automated signals based on the indicators that I use visually.

[snipped]

Thanks everyone for some much needed help.

GuppyDRV
I have seen people successfully auto-trading renko.
But they do not use the built-in renko chart.
They code the renko logic into a regular bar chart.

Gaempi
Posts: 60
Joined: 27 Jul 2010
Location: Switzerland
Has thanked: 3 times
Been thanked: 8 times

Re: Some help with Renko

Postby Gaempi » 07 Oct 2019

Interesting ... But how to code renko logic into a regular bar chart. Has someone the code?

Thanks!

DanielFXS
Posts: 30
Joined: 08 Oct 2019
Has thanked: 10 times
Been thanked: 4 times

Re: Some help with Renko

Postby DanielFXS » 18 Oct 2019

Hi Gaempi,
This is my first post on multicharts. Started using the software a few months ago. Got caught in the trap of Renko charts and producing unverifiable backtesting results. Multicharts is really my first attempt at learning to code but I believe if I could have found some renko codes and examples it would have helped me alot. The following code is something I've put together and isn't finished. Maybe an experience programmer or someone who understands multicharts better can do so. Set up your renko chart on data2 and input your brick size you are using the code will use the first brick as its starting point. The 2 main issues still to be solved are
1. If a bar on data1 closes and creates more than one renko block. The inbetween renko blocks won't be calculated.
2. The barchart used on data1 recalculates the script on every bar close. Because of this a value for Real_renko is calculated every time a bar closes. This can be ok, but if you are trying to create a moving average for example of the real_renko data, it will reuse the same value over and over until the next block is formed. So Real_Renko = Real_Renko[1] = Real_Renko[2] ... and so on until a new brick is formed. When it should be Real_Renko = Real_renko[1] + bricksize.
These two issues are definitely solvable but so far using this code is a step towards more reliable backtesting. See below

Code: Select all

Inputs: Brick_Size( 100 ) ;
vars:Brick(0) ,DN(0), UP(0), BricksUp(0), BricksDn(0), Renko_close( 0 ), Renko_close2( 0 );

If BarNumber = 1 Then Begin
Up = H of data2;
Dn = L of data2;
Brick = Brick_Size points;
End;

If BarNumber > 1 then begin
If C > UP + Brick Then begin
BricksUp = IFF(Brick = 0, 0, Floor((C - Up)/Brick)*Brick);
UP = Up + BricksUp;
Brick = Brick_Size points;
DN = Up - Brick;
BricksDn = 0;
End;

If C < Dn - Brick Then begin
BricksDn = IFF(Brick = 0, 0, Floor((Dn - C)/Brick)*Brick);
Dn = Dn - BricksDn;
Brick = Brick_Size points;
Up = Dn + Brick;
BricksUp = 0;
End;

End;

If Up > Up[1] then Renko_close = Up ;
If DN < DN[1] then Renko_close = DN ;

Plot1(UP, "Up");
Plot2(DN, "Dn");
Plot3( Renko_close ) ;

GuppyDRV
Posts: 57
Joined: 20 Jan 2017
Has thanked: 1 time
Been thanked: 2 times

Re: Some help with Renko

Postby GuppyDRV » 18 Oct 2019

@DanielFXS

Thanks for the interest. I’m not in a position to check out your code just now but I’ll do so later tonight! I have moved mountains to find the answers and finally have something working successfully. Nothing I’ve read ANYWHERE including this forum is remotely close.

TJ is great (He is one of the forum/Multicharts treasures) and offers some of the information in his posts......I believe if you could talk with him candidly he knows the answer. Check out his posts regarding Barstatus(1)=2......this isn’t the whole answer but it’s part of it and missing from your code. I admit that I haven’t really looked at it yet so you may have that coded in a different form.

It’s a mountain of a mind bender to get it working but is possible. I used a strategy that I took only visual information on and after many years coded it out. It’s been live for 8 trading days and backtesting exactly as it trades.

I have a inquiry with Multicharts on a side project that might easily correct this issue but their busy with their current release now. If anyone is competent with C# and wants to take a stab let me know and I’ll forward you the details. My gut feeling is the right person could get it done in a few hours.

GuppyDRV

GuppyDRV
Posts: 57
Joined: 20 Jan 2017
Has thanked: 1 time
Been thanked: 2 times

Re: Some help with Renko

Postby GuppyDRV » 18 Oct 2019

@danielFXS

So it sounds like you’re using Phantom bars? From what I can tell you’re trying to fill in the phantom bars so to speak. Only a quick pass at the code and I’m no professional. I’ve never used phantom bars in my trading so have not had any experience with them. I believe with a Barstatus check regardless of phantom bars you will get accurate information fed into indicators on the close of the Renko Bar. I quickly plugged a strategy into a Renko chart with phantom enabled earlier tonight and found on backtest without the barstatus check it took to many trades. I’m guessing it’s hitting on some of the phantom bars. When I put the barstatus check it seemed to be more realistic but did not match when I turned phantom bars off.

Keep us posted.

GuppyDRV

GuppyDRV
Posts: 57
Joined: 20 Jan 2017
Has thanked: 1 time
Been thanked: 2 times

Re: Some help with Renko

Postby GuppyDRV » 19 Oct 2019

@danielFXS

Can you also expand your explanation on the Resolution of the different data series you’re using and the desired outcome?

GuppyDRV

DanielFXS
Posts: 30
Joined: 08 Oct 2019
Has thanked: 10 times
Been thanked: 4 times

Re: Some help with Renko

Postby DanielFXS » 19 Oct 2019

@GuppyDRV,

Yes in this case I am using phantom bars. I am not trading directly off the renko chart. Just using it as an overlay via data2. I believe depending on what your trying to accomplish you have to tackle the problem using different approaches. Using on data2, for backtesting, the renko's are misaligned with the time based charts, showing invalid entries resulting in overly good looking backtest results. Right now I am coding a strategy for backtesting and a seperate code for live trading. I have used the barstatus check in some of my codes for live testing but haven't fully understood it. I'll do some more testing based on your recommendations. If I have any eureka moments, I'll share them here.
Daniel

DanielFXS
Posts: 30
Joined: 08 Oct 2019
Has thanked: 10 times
Been thanked: 4 times

Re: Some help with Renko

Postby DanielFXS » 19 Oct 2019

I'm using 1 hour bar charts on data1 and 1 hour renko, usually 100 - 200 points box size depending on instrument being traded.

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: Some help with Renko

Postby RedBerlin » 29 Oct 2019

hi
is there a programmer that can do what TJ spoken about?
I mean code with renko regular bar
thanks

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: Some help with Renko

Postby bomberone1 » 09 Apr 2021

The difference between the backtest and the live demo is striking. How is it possible to do the backtesting strategy reliable? How can I make live trading fair?

It it posssible integrated by default a solution to solve the problem please?

Gaempi
Posts: 60
Joined: 27 Jul 2010
Location: Switzerland
Has thanked: 3 times
Been thanked: 8 times

Re: Some help with Renko

Postby Gaempi » 09 Apr 2021

If you want to avoid the typical pitfalls optimizing strategies in Renko charts (what i do):

1. Use FlexRenko Charts

2: Resolution: 1 tick (very important!), do not use 1 Minute or more

3. Input: Close, Show Phantom Bars and Break on Session are on (!)

4. Programming signals: buy or sell on Bar Close (not next bar open!)

5. Take enough slippage

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: Some help with Renko

Postby bomberone1 » 09 Apr 2021

Thank you. I see that I put the trades on open and not on closing,
It seems that the situation is improving.
Have you noticed this difference too?

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: Some help with Renko

Postby bomberone1 » 12 Apr 2021

---COSTANT RANGE BARS and the similar preoblema of Renko charts---
Does anyone understand constant range bars and their risks and complications that cloud explain please?
Does anyone have example in very simple code that could help us in understand the risks and how to fix it please?
How to get correct backtesting and correct real live demo results?

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: Some help with Renko

Postby bomberone1 » 12 Apr 2021

Here are some links.

http://help.TS.com/09_01/trad ... _chart.htm

http://help.TS.com/09_01/trad ... t_auto.htm

The basic problem, as explained via the links, is that range bars use synthetic prices to fill any gaps, which means you can get fills in back-test at prices that did not occur. Also, because they are not tested with look-inside data, you can get inaccuracies that way as well.

Is there a solution?

tpredictor
Posts: 108
Joined: 05 Mar 2014
Has thanked: 1 time
Been thanked: 12 times

Re: Some help with Renko

Postby tpredictor » 21 Apr 2021

@bomberone1 Have you tried Kase bars? They seem to backtest well and get similar results in live. The biggest problem might be if they aren't built the same way every time.

tpredictor
Posts: 108
Joined: 05 Mar 2014
Has thanked: 1 time
Been thanked: 12 times

Re: Some help with Renko

Postby tpredictor » 22 Apr 2021

On the product page, it says the supported BetterRenko type backtests better? Any experience with that? I do not see a "better renko" option. Is that a particular configuration?

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: Some help with Renko

Postby bomberone1 » 24 Apr 2021

Hi,
I have try to built some system with Kase bar, but the live results are different from backtesting.
I tell you the point.
I am running very simple sistem in live and the system fills any trades, I stop the system i reload the chart and i attached the syastem again, i get trade where bvefore there are nothing.

tpredictor
Posts: 108
Joined: 05 Mar 2014
Has thanked: 1 time
Been thanked: 12 times

Re: Some help with Renko

Postby tpredictor » 24 Apr 2021

@bomberone1 Are you buying on close only? Are you using the same starting date? I do not have that problem. I do have a slightly related problem. I run a strategy developed in MC on Kase bars in TS and the results are slightly different. But, the strategy in backtest is resilient to the small changes and seems to running fine in real-time too. The difference is due to small differences in the bars. My strategy seems robust to this though. However, I get the same trades on both platforms when turning on/off. Of course, individual fills may be different.

This is interesting you get completely different trades-- let me know if you can figure the cause out.


Return to “MultiCharts”