19

Algorithmic Trading with Renko Charts. Trading Tips No 10

  • Upload
    intalus

  • View
    407

  • Download
    11

Embed Size (px)

DESCRIPTION

This Trading Tips will show you how you can use this chart type to construct a simple trading 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.

Citation preview

  • 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 and the next two 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. Dont 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. Thats all! The following comparison between a candlestick chart and a Renko chart speaks for itself.

    PART 1/3

    RENKO TRADING. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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 closelow[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]

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • By implementing both indicators a significant step towards our Renko trading strategy is accomplished. In our next issue 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 programming code which defines the entry and exit rules.

    PART 1/3

    RENKO TRADING. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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

    SHRETHIS!

    SHARE THIS TRADING TIP!

  • 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 dont 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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 closerenko::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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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 Trading Tips issue 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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.

    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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

  • A publication of

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

    intalus.com

    Powered by

    TRDINGTIPS. Issue01

    A publication of

    TRDINGTIPS. Issue07

    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.

    TRDINGTIPS. Issue02

    TRDINGTIPS. Issue08

    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.

    TRDINGTIPS. Issue03

    TRDINGTIPS. Issue09

    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.

    TRDINGTIPS. Issue04

    A publication of

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

    intalus.com

    Powered by

    RULE-BASEDTRENDLINES IMPROVEDISCIPLINE.

    TRDINGTIPS. Issue05

    A publication of

    A simple, but effective strategy.

    intalus.com

    Powered by

    PROFIT FROM GAP TRADING.

    TRDINGTIPS. Issue06

    PROFIT FROM THESE TRDING 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. TRDING TIPS. 10

    SHARE THIS TRADING TIPS!

    Title: Linkedin 2: Seite 2: Seite 41: Seite 62: Seite 83: Seite 104: Seite 145: Seite 166:

    Google + 2: Seite 2: Seite 41: Seite 62: Seite 83: Seite 104: Seite 145: Seite 166:

    Twitter 2: Seite 2: Seite 41: Seite 62: Seite 83: Seite 104: Seite 145: Seite 166:

    fb 2: Seite 2: Seite 41: Seite 62: Seite 83: Seite 104: Seite 145: Seite 166:

    More TT 2: Seite 2: Seite 41: Seite 62: Seite 83: Seite 104: Seite 145: Seite 166:

    Linkedin 3: Seite 3: Seite 51: Seite 92: Seite 113: Seite 134: Seite 155: Seite 176: Seite 197:

    Google + 3: Seite 3: Seite 51: Seite 92: Seite 113: Seite 134: Seite 155: Seite 176: Seite 197:

    Twitter 3: Seite 3: Seite 51: Seite 92: Seite 113: Seite 134: Seite 155: Seite 176: Seite 197:

    fb 3: Seite 3: Seite 51: Seite 92: Seite 113: Seite 134: Seite 155: Seite 176: Seite 197:

    More TT 3: Seite 3: Seite 51: Seite 92: Seite 113: Seite 134: Seite 155: Seite 176: Seite 197:

    G+ 4: IN 4: FB 4: Twitter 4: INT Ad 02: Video: Channel Vimeo 2: Channel YouTube 2: TS Ad 02: More TT: