Log in to see Cloud of Tags

Wealth-Lab Wiki

Flexible Renko

RSS
The FlexRenko ChartStyle developed by user dansmo is a chart style which is similar to the usual Renko style but the calculation of the brick size can be switched from a fixed value to a volatility adjusted method using the ATR(14).

Right-click the chart and select "Chart Style Settings" - or simply hit Ctrl-Y on your keyboard - to invoke the dialog where you can set which method to use and which factor to take for calculation of the brick size.

As of version 2010.12 of the library, FlexRenko uses the 14-day ATR as a basis for the calculation of the brick size on intraday charts. (Previously, the ChartStyle used the intraday ATR, making the chart to depend heavily on recent intraday volatility.) The change is designed to keep the brick size constant during the trading session and make the chart's look & feel resemble the traditional Renko chart. Note: for an intraday chart to start drawing FlexRenko bricks, the equivalent of at least 15 Daily bars must be loaded; otherwise you'll see an empty chart.

Example with FlexRenko using Price based calculation of 1,0 Dollars.

Example with FlexRenko using Price based calculation of 1,0 Dollars.


Example with FlexRenko using ATR based calculation where ATR is weighted with a factor of 2,00.

Example with FlexRenko using ATR based calculation where ATR is weighted with a factor of 2,00.


Example:

You can call the FlexRenko method and use it in a bar chart to get all the necessary information. Here´s an example that will paint the bar chart red/green if there are up/down bricks.

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using WealthLab.ChartStyles.Community;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { //use these to change the settings for the Renko Chart: bool _Price = true; bool _ATR = false; double _Factor = 1; //**************************************************** //create an instance of FlexRenko FlexRenko fr = new FlexRenko(); //call the calculate Renkos Method fr.calculateRenkos(Bars,_Price, _ATR, _Factor);

//get all the available Renko information in the Renko class stored for every bar Dictionary renkoDict = fr.getRenko(); //available variables in the Renko class are: /* public int firstBrickInBar; public int numBricks; public bool isDownBrick; public bool isUpBrick; public List brickHigh = new List(); public List brickLow = new List(); */ DataSeries brickHighSeries = new DataSeries(Bars, "brick High"); DataSeries brickLowSeries = new DataSeries(Bars, "brick Low"); double brickHigh = 0; double brickLow = 0; bool lastBrickUp = false; bool isUpBrick = false; bool isDownBrick = false; for(int bar = 1; bar <= Bars.Count - 1; bar++) { int numBricks = 0; int firstBrick = 0; int brickNumber; //get the current bar´s values from the renko dicitonary if(renkoDict.ContainsKey(bar)) { numBricks = renkoDictbar.numBricks; isUpBrick = renkoDictbar.isUpBrick; isDownBrick = renkoDictbar.isDownBrick; firstBrick = renkoDictbar.firstBrickInBar; }

//draw the number of bricks to the chart if(numBricks > 0) AnnotateBar("#"+numBricks, bar, true, Color.Black); //paint the background according to current brick if(isUpBrick && !isDownBrick) lastBrickUp = true; else if(!isUpBrick && isDownBrick) lastBrickUp = false;

if(lastBrickUp) SetPaneBackgroundColor(PricePane, bar, Color.LightGreen); else SetPaneBackgroundColor(PricePane, bar, Color.LightCoral); } PlotSeries(PricePane, brickHighSeries, Color.Green, WealthLab.LineStyle.Solid, 2); PlotSeries(PricePane, brickLowSeries, Color.Red, WealthLab.LineStyle.Solid, 2); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.