Indicators based on Renko Chart
Author: dansmo
Creation Date: 10/14/2010 4:06 AM
profile picture

dansmo

#1
Hi,

at the moment it seems to me that Indicators that are based on Renko charts do not take all bricks into their calculations. Is this correct? How is the exact behaviour?
profile picture

Cone

#2
No Chart Style operates on indicators.
profile picture

dansmo

#3
I dont understand your post. What do you mean by that?
profile picture

Cone

#4
I mean that indicators get the Bars object or the OHLC/V DataSeries to operate on. They don't get "Renko bricks" or "Point & Figure X and O columns" or anything else. If you want an indicator based on Renko bricks, then you need to develop it yourself.
profile picture

dansmo

#5
Okay, understood. With access to FlexRenko that should not be too difficult.
profile picture

dansmo

#6
Hi Cone,

if I want to base my indicator on Renko bricks: am I right that I cannot use a DataSeries object for that purpose? Is it correct that I can only built DataSeries with Bars?
profile picture

Cone

#7
You can't use any standard indicators with bricks. You need to write an indicator that takes "bricks" as a parameter. Then, you'll probably need to synchronize it with Bars so that you can use it for backtesting.
profile picture

dansmo

#8
What I have done is creating a dictionary with the bricknumber as key and the indicator values. Now, how can I use this in a DataSeries?
profile picture

Cone

#9
I don't know, how do you want to use it? Do you even need a DataSeries?
profile picture

dansmo

#10
I want to use it just as any other indicator. Please add a SMA to a renko chart and you will see that it does behave totally different than what you can see on a bar chart. In othere charting packages indicators on renko charts are based on the bricks.
profile picture

Cone

#11
Then you need to synchronize your Renko-based indicator in a new DataSeries. Create a new DataSeries and fill it bar-by-bar with your SMA values. If a brick spans more than one bar, then you have to repeat the previous value.
profile picture

dansmo

#12
If a brick spans more than one bar....what about the other way round? If there´s more than one brick in a bar?
profile picture

Cone

#13
Good question. How do the other charting packages do it?

In reality (time-based DataSeries), there can't be more than one value per bar. So, you could pick the value for any of the bricks, the median, or the last one. As far as I'm concerned, any are "correct", but I'd choose the last one. Nonetheless, this is your design, so have at it!
profile picture

dansmo

#14
QUOTE:
Good question. How do the other charting packages do it?

I dont know for sure, but I guess that other packages really use every brick for the calculation of the indicator.
QUOTE:
In reality (time-based DataSeries), there can't be more than one value per bar.

Okay, and I understand that there is only a time-based DataSeries available. Are there plans to make dataSeries explicitly available for trending charts?
Is there any other way to have values painted to the chart without the use of DataSeries?
QUOTE:
Nonetheless, this is your design, so have at it!

As you can see from my post, I am still thinking about the various ways and possibilities to design it.
profile picture

Cone

#15
QUOTE:
Are there plans to make dataSeries explicitly available for trending charts?
I don't understand the question. You use DataSeries to create any Chart Style.

If the question is, "Is there a plan to provide the ability to base indicators on Chart Style objects?", the answer is a resounding no. Indicators require a WealthLab.DataSeries on which to operate, that's the design. As you probably saw from your exercise, you need to explicitly develop an indicator that uses ChartStyle objects (bricks) and then synchronize the result with a time-based DataSeries so that you can actually use it in a Strategy.

What Charting Packages allow you to create any indicator based on any Chart Style and backtest/trade with those Chart Style-based indicators? I'm interested because I've never seen this animal.

------------
Thinking in terms of Point and Figure, I just want to add that a simple indicator like SMA based on P&F columns has to be one of the most delayed and non-useful indicators I can think of. Sure it might look useful on the chart, but depending on the parameters, a P&F column could take months to complete. An SMA is based on the center value of the last column; the current column is always changing, akin to a partial bar. So, not only are you getting a delay inherent in the indicator, you're also getting a huge time-delay waiting for a reversal in the Chart Style. Who knows though, sometimes delaying trading (sitting on your hands) is a good strategy :)
profile picture

dansmo

#16
Years ago I used TradeSignal.
There one could base an RMI on a Renko chart:

And in relative large moves there will be more than one brick in a bar, hence more than one indicator value for one bar.
So, this is not possible in WL?
profile picture

Cone

#17
You wore me down and I'm not getting through. I don't know what TradeSignal is using for RMI, but the following version is from our Community.Indicators.




CODE:
Please log in to see this code.

And, if you use the OHLC overlay Chart Style option, you can see that you'd actually be trading with periods in which the indicator is doing nothing, just like the Renko bricks. This is the synchronization with the time-based series:



Actually, I just noticed that for repeated bricks on the same bar, this synchronization if (lastColNumber != rkoColumn.Col) will actually pick the first value, not the last. You'd have to peek ahead (legally) to see if it were the last brick for the same bar.
profile picture

dansmo

#18
Cone: try parameters 6,1 to get an indicator looking very similar to the one in my chart.
I will have a closer look at your code now and will check again with TradeSignal.

edit:
could this be something for a extension: renko indicators ?
profile picture

Cone

#19
Can you show that there is an advantage statistically to using indicators based on Renko? Either way, you're welcomed to put anything you like into an extension. Frankly there seem only to be a handful of people interested in these alternative Chart Styles at any given time.

On the other hand, we're always looking for ideas for our Trading Systems Lab spot in AT Magazine. Although I personally can't justify use of traditional indicators with Point and Figure, I actually like the idea of applying them to Renko due to the properties of that style - the bricks reduce noise, so indicators are measuring more "signal". Maybe I'll have a chance to play with it some more.
profile picture

dansmo

#20
I compared one chart with one in TradeSignal and they look quite similar. I can live with any minor differences.

QUOTE:
Can you show that there is an advantage statistically to using indicators based on Renko?

At the moment: no.
However I am planning a study on
Traditional Renko vs. ATR based Renko and Traditional Indicators on those charts.

I also think that there´s no use for indicators in Point and Figure chart. I will use your logic to come up with some standard indicators on myFlexible Renko ChartStyle. I will have to build them anyway for the study I´d like to make.
profile picture

dansmo

#21
Cone: I am trying to translate this now for the Flexible Renko ChartStyle.
However, I have problems.

What could be the reason for this:

In the loop that fills the non-synched dataseries I use these lines of code:
CODE:
Please log in to see this code.


That gives me a debug print:
QUOTE:
bar: 128 - totalBrickCount = 113 - renkoBased[totalBrickCount]: 270,5
bar: 129 - totalBrickCount = 114 - renkoBased[totalBrickCount]: 266,5
bar: 130 - totalBrickCount = 115 - renkoBased[totalBrickCount]: 258,5


Then, I use this:
CODE:
Please log in to see this code.


and later in the loop to fille the synch´d series:
CODE:
Please log in to see this code.


As we see from above debug, rmi[114] shoudl be 266,50. However, I get the following:
QUOTE:
bar: 128 - totalBrickCount = 113 - numBricks: 4
rmi[totalBrickCount]: 100
bar: 129 - totalBrickCount = 114 - numBricks: 8
rmi[totalBrickCount]: n. def.
bar: 130 - totalBrickCount = 115 - numBricks: 2
rmi[totalBrickCount]: 0


How can this happen? Why is rmi[114] n.def. now??
profile picture

dansmo

#22
Cone, Eugene? Can someone please give me a hint on this?
profile picture

dansmo

#23
There was not a mistake in the code....it was because RMI was giving n.def. for some bars/bricks.
So, the framework is correct and I will work on some indicators.
profile picture

dansmo

#24
I finished the first indicator, which is a SMA on flexible Renkos. Using the indicator via Drag&Drop from the menu everything works fine.
However, I am unable to use the indicator in Strategy Code and I do not understand why.

In my extension FlexibleRenko.Indicators I have the class:
CODE:
Please log in to see this code.


The strategy code:
CODE:
Please log in to see this code.


Can you give me hint at what I am missing?
profile picture

Eugene

#25
Could it be that you didn't implement the Series method?
CODE:
Please log in to see this code.
profile picture

dansmo

#26
That´s what I thought, too. However it says "error CS0103: the name FR_SMA is not available in that context".

In the FR_SMA class I have a Series method:

CODE:
Please log in to see this code.
profile picture

Eugene

#27
Take a look at how formal indicators are built by checking the source code of TASCIndicators and/or Community Indicators in the Wiki while having the Indicator Library manual open.
CODE:
Please log in to see this code.

...implements the DataSeries class (note the base keyword).
In this method, you're basically calculating the FR_SMA value on each bar and assigning it while looping bar by bar:
CODE:
Please log in to see this code.

In public static FR_SMA Series, you then returning a cached value of the series (from Bars.Cache), or create a new instance if the cached series weren't found.
profile picture

dansmo

#28
But that is how I have done it. Caching was a mess because of different number of bricks in different types of renko calculations, so I leaved it out.
Like I said before: it is working fine when I drag the indicator on a new chart. But I cannot use it from within a strategy script.
profile picture

Eugene

#29
Caching is never a mess, it's just a few lines of (reusable) code. Double-check your implementation according to our examples.
profile picture

dansmo

#30
I cannot see why this one should work
CODE:
Please log in to see this code.


and this one not:
CODE:
Please log in to see this code.


I just left out the caching part of the code. Cannot see why this should lead to the Method not being accessible in WLD code?
profile picture

dansmo

#31
I have found the mistake!
It had nothing to do with the code itself. It was the namespace that was named a bit different in the project. Again...hours spent with finding an error that was not even there :-(
profile picture

Eugene

#32
This alone shouldn't, and the modified Beta code will work. Double-check your implementation, MSDN on CS0103 makes it pretty clear:
QUOTE:
An attempt was made to use a name that does not exist in the class, namespace, or scope. Check the spelling of the name and check your using statements and assembly references to make sure that the name you are trying to use is available. One common mistake is to declare a variable within a loop or a try block and then attempt to access it from an enclosing code block or another code block, as shown in the following example.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).