19

Trading tips 10 I Algorithmic trading with renko charts

  • Upload
    intalus

  • View
    123

  • Download
    7

Embed Size (px)

DESCRIPTION

Renko charts are a fascinating chart type, which filters out insignificant price information. For this reason, they are ideal for the development of trend-following strategies. In our three part series we will show you step by step how you can combine traditional bar charts with Renko charts and put them together to a complete strategy.

Citation preview

Page 1: Trading tips 10 I Algorithmic trading with renko charts

TR�DINGTIPS.

ALGORITHMICTRADING WITH RENKO CHARTS. SK

YSCR

APE

R 01

. Men

ara

Car

igal

i, K

ual

a Lu

mpu

r.T

he t

od

ays

thir

d ta

llest

bui

ldin

g in

Mal

aysi

a on

the

sca

le o

f 2

67

met

res

hig

h.

intalus.com

A publication ofPowered by

10Issue

SKYS

CRA

PER

02. P

etro

nas

Tw

in T

ower

s, K

ual

a Lu

mpu

r.T

he t

od

ays

talle

st b

uild

ing

in M

alay

sia

on t

he s

cale

of

45

2 m

etre

s hi

gh.

1–3

PARTS 1–3:How to combine Renko charts and Bar charts to create a profitable trading strategy.

Page 2: Trading tips 10 I Algorithmic trading with renko charts

RENKO TRADING.PART 1: How to define trend direction and local highs and lows.

Renko charts are a fascinating chart type. They are a kind of simplified point & figure chart, easy to read and great for trend following strategies. This three-part series Trading Tips will show you how you can use this chart type to construct a simple tra-ding strategy. You will learn how to read this chart, how to program a trading strategy and how to combine different chart types in one trading strategy.

STRATEGY DESCRIPTION

The general idea behind this trading strategy is a trend following approach. Therefore we will have to find out if there is a trend and define its direction. In the next step we will use the local highs and lows for the entry and exit. If our trend detection thinks that there is a bullish trend in the market, we will go long if the market makes a new high. To close the long position we will use the local lows. If the market makes a new low, this will be our exit signal. Additionally some kind of trailing stop to lock in profits and reduce risk will be required. If done, we will have a fully automated trading stra-tegy that can be tested for profitability in any given market.

DEFINING THE TREND & LOCAL HIGHS AND LOWS

Let us start with the definition of the trend first with a classic approach which uses two moving averages. If the short average is above the long average, and the market trades above the short average, this will be our definition of an up-trend. Don’t worry about the period of the moving averages, when the strategy is done Tradesignal will find the perfect period using the built-in optimizer.

Because this is quite a simple concept, which can be found in any beginners guide to technical analysis, we will also use the local highs and lows so the quality of the trend detection itself is not so important. While bar charts or candlestick charts offer no objective and satisfying solution, Japanese Renko charts are the perfect choice for defining local highs and lows. Similar to point & figure charts, they show the price without a continuous time axis and are constructed from “boxes”, each box represen-ting a specific price change. For example, a Renko chart where one box represents 10 points and the markets moves up 100 points, the Renko chart will show you 10 bullish

PART 1/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 3: Trading tips 10 I Algorithmic trading with renko charts

Figure 1: Renko charts show trends and reversals in a clear and objective manner. Hence they are a very good tool in a simple trading system.

boxes; regardless if this move takes place in one day or one year. If the market moves less than 20 points, no new box will be drawn. To reverse the direction a minimum counter move of at least 10 points will be needed. As you can see, this simple box algorithm filters out small price moves, so the fuzz is being removed and only signifi-cant price moves are plotted.

Now have a look at the chart and you will see how easy it is to define local highs and lows in an objective way: A local high is defined as the point, where the Renko chart changes from bullish boxes to bearish boxes. That’s all! The following comparison between a candlestick chart and a Renko chart speaks for itself.

PART 1/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 4: Trading tips 10 I Algorithmic trading with renko charts

Code 1: Equilla code for the “Renko Master” indicator

// definition of global variablesVariables: renko::hi, renko::lo;// if there is a bearish renko today and there was a bullish renko yesterday, then// yesterdays close (+1 renko) is a local high if close<high and close[1]>low[1] then renko::hi=close[1]+(high-low);// if there is a bullish renko today and there was a bearish renko yesterday, then// yesterdays close (-1 renko) is a local lowif close>low and close[1]<high[1] then renko::lo=close[1]-(high-low);

Code 2: Equilla code for the “Renko Slave” indicator

meta: subchart(false);

// get the renko local highs and lows and plot them on the barchartdrawsymbol(renko::hi);drawsymbol(renko::lo);

PROGRAMMING THE INDICATORS.

Using this definition of local highs and lows we can write a short script to calculate these points on the Renko chart and show them on a candlestick chart. The calcula-tion of the highs and lows is done with the following Renko Master indicator.

Two global variables above were used in order to pass this information to the follo-wing Renko Slave indicator, which in turn plots the Renko highs and lows on a classi-cal candlestick or bar chart by plotting points or circles (see code 2).

PART 1/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 5: Trading tips 10 I Algorithmic trading with renko charts

Figure 2: Using the Renko Master and Slave indicator the local highs and lows from the Renko chart are transferredto the bar chart. The box algorithm filters out small price moves, so only significant price moves are plotted.

DO IT YOURSELF MANUAL.

How to chart this graph on your own and see local highs and lows from the Renko chart on another chart? Very simple:

01. Open a chart of your underlying02. Add the same instrument as a sub chart below03. Set one of both charts to Renko 04. Drag and drop the Renko Master indicator onto the Renko chart05. Drag and drop the Renko Slave indicator onto the candlestick chart

PART 1/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 6: Trading tips 10 I Algorithmic trading with renko charts

By implementing both indicators a significant step towards our Renko trading strategy is accomplished. In the second part of this mini series we will add a trend detection and colouring of the chart based on the trend direction, which will mark another step forward. The third issue of our Renko trading strategy series will provide a program-ming code which defines the entry and exit rules.

PART 1/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 7: Trading tips 10 I Algorithmic trading with renko charts

A publication ofPowered by A publication ofPowered by

That is why we have produced these Trading Tips.If you have enjoyed them please help us and share them with your friends.

ANALYSING AND TRADING MARKETS SHOULD BE PLEASURABLE, NOT A CAUSE OF PAIN.

intalus.com

SH�RETHIS!

SHARE THIS TRADING TIP!

Page 8: Trading tips 10 I Algorithmic trading with renko charts

RENKO TRADING.PART 2: Long or short? The colour of the chart will tell you!

The first part of this mini series showed you a way to combine different chart types and pass information from one chart to another, using global variables. We used Renko charts to calculate local highs and lows. These important chart points where then displayed on a Candlestick chart. The second part of this series will utilise moving averages to define the direction of the current market trend, combining it with the Renko highs and lows and colour code the chart according to the outcome of our computer analysis. At the end of this article you will have a chart that turns green when it is time for a long position, and red, if the bears have taken control.

TREND DETECTION MADE EASY

To define a bullish market we will proceed as recommended by any book on technical analysis: If the short moving average is above the long moving average and the mar-ket is trading above the short moving average, this will be our definition of a bullish trend. Just reverse the conditions to get the definition of a bearish market. Apparently, this trend definition is more than primitive. It doesn`t account for volatility or volume, so used on its own it most probably will generate many bad signals.

But don’t forget – we already have calculated the local highs and lows of the market, and they will filter out many of the bad signals. Therefore we just have to add one more condition: If the averages signal a bullish market phase and the price trades above its most recent local high, then – and only then – our trend detection should colour code the chart in green. So there is no bull market unless the price generates a new high.

PART 2/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 9: Trading tips 10 I Algorithmic trading with renko charts

Code 3: Equilla code for the “Trend Paint Renko Filter”

Meta: subchart(false); // indicator is drawn on chart, not as a subchart like RSIInputs: LongPeriod(54), ShortPeriod(21); // Period of the short moving averageVariables: shortAV, longAV, colour, trend::colour, global::longAV, currenthigh, currentlow;

// calculate long and short averagelongAV=average(close,LongPeriod);shortAV=average(close,ShortPeriod);

drawline(shortAV);drawline(longAV);

// get the renko high/low currenthigh=renko::hi;currentlow=renko::lo;

// basic colour of barchart (if no trend)colour=black;

// definition of bearish trendif close<shortAV // close below short averageand shortAV<LongAV // short average below long averageand low<renko::lo // barchart low is below last local renko lowthen colour=red; // then colour=red (=bearish)

// definition of bullish trend if close>shortAV // close above short averageand shortAV>longAv // short average above long averageand high>renko::hi // barchart high is above last local renko highthen colour=darkgreen; // if bullish then green

drawbar(open,high,low,close, colour,colour); // draw the colour coded barchart

// pass the colour information to other scriptstrend::colour=colour;global::longAV=longAV;

PROGRAMMING CODE

Now let`s have a look at the code of this trend detection indicator. The ‘meta’ section defines where this indicator should be shown on the chart. ‘Sub chart (false)’ means that it is shown on the chart, not in a separate sub chart like the RSI. The input section defines the length of the moving averages. By doing so the periods can be optimized later on to adjust this indicator to any market and time frame.

The variables section is needed to define the placeholders for our calculations. Beside the local variables for the moving averages, the colour and the Renko highs and lows, two more global variables were added to pass the outcome of this indicator to the trading strategy. The global colour is needed to define whether the market is in a long or short mode. The global long average will be used as some kind of trailing stop loss (to be described in part 3 of our series).

PART 2/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 10: Trading tips 10 I Algorithmic trading with renko charts

Figure 3: EURUSD daily chart with “Trend Paint Renko Filter” and local highs and lows derived from the Renko chart.

The following chart shows the EUR/USD daily chart with the Trend Paint Renko Filter discussed above. The price chart is being coloured green (red) when the following conditions are met: Firstly, the moving averages have to signal a bullish (bearish) mar-ket phase. Secondly, the price has to break above (below) the previous Renko high (low).

The first half of 2012 serves as a good example for the advantage of using the local highs and lows as an additional filter. As you can see, no bullish trend had been detec-ted, even though the price broke above the moving averages.

PART 2/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 11: Trading tips 10 I Algorithmic trading with renko charts

CONCLUSION

With the second part of our Renko trading series we fulfilled another important re-quirement for our trading strategy. In the first step all conditions for a long or short entry were clearly defined by combining the moving averages with the local highs and lows. Then we programmed a code which colours the price chart subject to the trend condition. Green colouring signals a bull mode while a red chart signals a bear mode – very simple isn`t it? In our third and last part of the Renko series we will show how the trading strategy generates entry orders, how it can be tested and how well even such a simple strategy performs.

PART 2/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 12: Trading tips 10 I Algorithmic trading with renko charts

CLEAR STRATEGIES NOT GUT REACTIONS.Act smart and always use objective and clear signals.Tradesignal. Überlegen handeln.

OOPS – YOU AREN`T ALREADY A TRADESIGNAL USER?

CLICK HERE � AND START TESTING

THE SOFTWARE RIGHT NOW. ORDER YOUR COPY TODAY.

Trad

esig

nal®

is a

reg

iste

red

trad

emar

k of

Tra

desi

gnal

Gm

bH. U

naut

horiz

ed u

se o

r m

isus

e is

spe

cific

ally

pro

hibi

ted.

OOPS – YOU AREN`T ALREADY A TRADESIGNAL USER?

CLICK HERE

THE SOFTWARE RIGHT NOW. ORDER YOUR COPY TODAY.

FREE TRIAL

Page 13: Trading tips 10 I Algorithmic trading with renko charts

CLEAR STRATEGIES NOT GUT REACTIONS.Act smart and always use objective and clear signals.Tradesignal. Überlegen handeln.

OOPS – YOU AREN`T ALREADY A TRADESIGNAL USER?

CLICK HERE � AND START TESTING

THE SOFTWARE RIGHT NOW. ORDER YOUR COPY TODAY.

Trad

esig

nal®

is a

reg

iste

red

trad

emar

k of

Tra

desi

gnal

Gm

bH. U

naut

horiz

ed u

se o

r m

isus

e is

spe

cific

ally

pro

hibi

ted.

OOPS – YOU AREN`T ALREADY A TRADESIGNAL USER?

CLICK HERE

THE SOFTWARE RIGHT NOW. ORDER YOUR COPY TODAY.

FREE TRIAL

RENKO TRADING.PART 3: How to assemble all components to a full trading strategy.

The first and second parts of this special Renko Trading Tips showed a way to define a trend using the Renko highs and lows with moving averages. At the end of part two a bar chart was colour coded according to our computer trend analysis, the colour and the long moving average were saved in a global variable. Using this information we will now generate the actual trading signals. When done, we will have a complete automatic trading strategy that can be back tested and optimized.

ENTRY AND EXIT

In the previous part we showed that the colour of the bar chart defines whether the market is in bull or bear mode. As we have got the colour of the chart in our global variable we can start with two simple orders for the position entry:

01. If the chart is green then open a long position02. If the chart is red then open a short position

That`s just the entry. Additionally we need some kind of exit. One possibility would be to define a black chart as an order to be flat, since it means that there is no trend. But that would not be the best idea for two reasons. When you have a close look at the colour coded chart you will notice that there are some black days within a fully functional trend. The market might just rest for some days, and it would be useless to close out the position with the first black day. Usually the market continues its trend very soon, so constantly getting in and out of position just costs a lot of money. On the other side there might be a fast trend change, and our trend detection is just too slow, so we might even want to get out of a long position although the bar chart still is coloured green.

The proper solution is to define a two-step exit. To get out of a long position the long moving average is used as some kind of trailing stop, while the last local Renko low serves as a chart based stop. The system gets us out if the average or the local low is touched (whatever comes first). The same logic applies for the short side.

PART 3/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 14: Trading tips 10 I Algorithmic trading with renko charts

Code 4: Equilla code for entry and exit

Variables: colour;

colour=trend::colour;

if colour=darkgreen and colour[1]<>darkgreen and colour[2]<>darkgreen then buy this bar on close;

if colour=red and colour[1]<>red and colour[2]<>red then short this bar on close;

sell next bar at maxlist(renko::lo, global::longAV) stop;cover next bar at minlist(renko::hi, global::longAV) stop;

PROGRAMMING CODE

The following code represents the trading strategy. First a variable for the colour of the chart is defined. Then the global colour variable is written into the local one. This seems to be a useless thing, as the global variable will always contain the same value as the local one, but this trick is used to bypass a very specific Tradesignal feature (global variables do not have a value for yesterday). This just means, that you can not ask the question “what colour did the chart have on the bar before” using the global variable. But you can do so using the local one! Therefore the global variable was written into the local one.

After the colour has been saved the entry command is the next part of the code. Translated into plain English it goes like this:

If the chart is green and the chart has not been green on the bar before and the chart has not been green 2 bars before then go long at the end of the current bar.

The term “not green yesterday and the day before” is another programming trick. It reduces the signal frequency in uncertain times; uncertain times when there is no strong trend and our very basic trend detection is switching between green and black on a daily basis. The entry condition for the short entry is just the same as for the long position, only that the chart has to be red. Next in the code comes the exit. As mentioned before two levels for a possible exit are used. The ‘maxlist’ and ‘minlist’ command takes care of which stop level is closer to the current price and therefore used for exit.

PART 3/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 15: Trading tips 10 I Algorithmic trading with renko charts

Figure 4: The Renko trading strategy presented in our Trading Tips series generated stable results on a long term basis. It can be used for any market and can be adapted by modifying both the box size and the length of the moving averages.

ADAPTING THE STRATEGY TO YOUR MARKET

Drag and drop the strategy onto the bar chart, and if everything goes well, you should see an equity line appear as a new sub chart. This equity line gives you the theoretical profit of this specific strategy in your chosen market.

PART 3/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 16: Trading tips 10 I Algorithmic trading with renko charts

© 2014 Intalus – www.intalus.com

Distribution allowed under a Creative Commons Attribution-Noncommercial license:

http://creativecommons.org/licenses/by-nc/3.0/

Tradesignal® is a registered trademark of Tradesignal GmbH.

Unauthorized use or misuse is specifically prohibited.

WATCH VIDEO TO SEE HOW YOU CAN USE RENKO CHARTS AND MORE IN TRADESIGNAL.

VIMEO YOUTUBE

If you wish to adapt this strategy to your favourable market, there are two things you can do: First you can change the size of the Renko bricks. Usually a box size of about 0.5% to 2% is chosen. Whether you would like to enter a fixed amount on the properties page of the chart or rather use a percent value – with Tradesignal you can do both. The other thing is the length of the moving average. To find the best moving average for your market you can use the built-in optimizer. How to optimize moving averages without falling into the curve fitting trap will be the topic of one of the next Trading Tips.

Take care, take profit,

Philipp KahlerSenior Quantitative Analyst at Intalus

OR CHECK OUT OUR VIDEO CHANNELS:

PART 3/3

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 17: Trading tips 10 I Algorithmic trading with renko charts

ABOUT THE AUTHOR.Philipp Kahler.

Philipp is the Senior Quant Analyst at Intalus. He was born in Austria and studied electrical engineering before joining a large German bank where he developed fully automated trading strategies for the proprietary trading department. His book about designing successful trading strategies has been among the top sellers in Germany for the last two years. Currently at Intalus, he is responsible for the in-house training of institutional traders and the development of custom-made algorithmic trading strategies.

You may contact Philipp [email protected]

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!

Page 18: Trading tips 10 I Algorithmic trading with renko charts

1

2

3

4

Strategy applied to a portfolio of EURO STOXX 50 ® stocks displaying long and

short positions and position size.

Total performance of the entire portfolio for the last few years.

Overview of current open positions and their P&L.

Single stock from this portfolio plus buy and sell signals along with performance.

EURO STOXX 50® is a registered trademark of STOXX Limited. Zurich. Switzerland. Tradesignal® is a registered trademark of Tradesignal GmbH, Bremen, Germany | www.tradesignal.com.

TECHNICAL ANALYSIS & ALGORITHMIC TRADING FOR

PORTFOLIO MANAGERS.Control risk and return. Trade systematically. With the new Tradesignal.

http://tradesignal.intalus.comORDER YOUR 4-WEEKS TRIAL TODAY!

Intalus is the worldwide exclusive distributor of Tradesignal® | www.intalus.comRead further information about the software here: http://tradesignal.intalus.com

1

2

3

4

Exam

ple

figur

e fr

om T

rade

sign

al.

Page 19: Trading tips 10 I Algorithmic trading with renko charts

A publication of

SCAN FORTHE BEST.

How to find the best performers out of hundreds of stocks in seconds.

intalus.com

Powered by

TR�DINGTIPS. Issue

01

A publication of

TR�DINGTIPS. Issue

07

How to find the best risk/ reward opportunities based on candlestick patterns.

intalus.com

Powered by

SCAN FOR CANDLE PATTERNS.

A publication of

How to create your own equity basket.

intalus.com

Powered by

SPEED UP YOURDECISIONS.

TR�DINGTIPS. Issue

02

TR�DINGTIPS. Issue

08

A publication of

Simple steps to advanced analysis.

intalus.com

Powered by

INDICATORSON INDICATORS.

A publication of

How to create and trade an optimal portfolio.

intalus.com

Powered by

CONTROL YOUR RISK.AUTO-ADJUST POSITION SIZE.

TR�DINGTIPS. Issue

03

TR�DINGTIPS. Issue

09

A publication of

How to visualize forward curves to maximize information.

intalus.com

Powered by

UNLEASH THEFORWARD CURVE.

A publication of

How to identify and profit well from a short trade.

intalus.com

Powered by

HIGHLYEFFICIENTSHORTING.

TR�DINGTIPS. Issue

04

A publication of

How to use point & figure trend lines in candlestick charts.

intalus.com

Powered by

RULE-BASEDTRENDLINES IMPROVEDISCIPLINE.

TR�DINGTIPS. Issue

05

A publication of

A simple, but effective strategy.

intalus.com

Powered by

PROFIT FROM GAP TRADING.

TR�DINGTIPS. Issue

06

www.intalus.com/tradingtips

MORE KNOW-HOW AND VIDEOS HERE

PROFIT FROM THESE TR�DING TIPS & VIDEOS TOO.

TRADING TIPS 01

SCAN FOR THE BEST.

How to find the best performers out of hundreds of stocks in seconds.

TRADING TIPS 02

SPEED UP YOUR DECISIONS.

How to creat your own equity basket.

TRADING TIPS 03

AUTO-ADJUST POSITION SIZE.

How to create and trade an optimal portfolio.

TRADING TIPS 04

HIGHLY EFFICIENTSHORTING.

How to identify and profit well from a short trade.

TRADING TIPS 05

RULE-BASED TRENDLINES.

How to use point & figure trend lines in candlestick charts.

TRADING TIPS 06

PROFIT FROM GAP TRADING.

A simple, but effective strategy.

TRADING TIPS 07

SCAN FOR CANDLE PATTERNS.

How to find best performing stocks and the best risk/reward opportunities by identifying promising candlestick patterns.

TRADING TIPS 08

INDICATORS ON INDICATORS.

Simple steps to advanced analysis.

TRADING TIPS 09

UNLEASH THEFORWARD CURVE.

How to visualize forward curves to maximize information.

RENKO TRADING. TR�DING TIPS. 10

SHARE THIS TRADING TIPS! MORE TRADING TIPS!