Algorithmic Trading Tips 15.

INTRADAY EMISSIONS TRADING.

HOW TO TRADE VOLATILITY BREAKOUTS PROFITABLY.

Trading of volatility breakouts on an intraday basis offers attractive opportunities in numerous markets. In this issue, we want to show you how to develop a profitable trading strategy for the emissions market by using the Day Range indicator and how to test its robustness.

WATCH VIDEO NOW. (6 minutes to improve your performance.)
LOAD WORKSPACE. (For users with Thomson Reuters.)
LOAD WORKSPACE. (For users with Bloomberg.)

By downloading you agree to the terms of use below.

When it comes to energy trading the emissions market is one of the most liquid. It shows great trends and quite radical intraday moves. This months trading tip will give you some ideas and a full trading strategy to make use of the intraday volatility in this market.

Day Range: a simple but powerful indicator.

With the day range indicator you will see what a powerful and easily made indicator it is. Open a 15min intraday chart of emissions (CFI2Z5 on Reuters) and apply the day range indicator. This indicator does not need a lot of calculation; it just normalizes the daily intraday movement. Every day the indicator starts at 0, and then builds the bars exactly like a normal chart. If the market raises 10pts from the opening, the indicator will show a bar going from 0 to 10pts. That`s not a lot of maths, but it enables you to compare the intraday moves day by day, without being confused with the general trend or long term support and resistance on the chart.

Can this be enough to build a profitable trading strategy? Yes! Just have a look at a long history of the indicator and you will see where the money can be made. Sometimes you see high spikes standing out of the usual indicator noise. These are the days when the herd galloped in one direction and did not stop until the end of the session. And this will be the right environment for our strategy to cash in.

But first add two simple stop lines on the indicator. One at +0.2, the other at -0.2. You will see that this seems to be some kind of magic level in the emissions market. Every time the indicator crossed above or below this level, you had the chance to make money until the end of the session.

FIG. 1: DAY RANGE INDICATOR WITH FIXED RANGE.

The Range Day indicator normalizes the intraday movements by starting at zero each trading day.
In this way it allows a fast and precise comparison of individual trading days.

 

Deviation band enables application to different markets.

Of course there are no magic numbers in the market, so better let your software calculate the “breakout volatility level” on its own. Therefore you could just drag and drop a long term Bollinger band onto the indicator, or you use the altered version of the day range indicator that is included with this trading tip.

The enhanced indicator plots a two standard deviations band around the daily movements. This enables you to apply the indicator without adjustments to different markets, as emissions is not the only market with nice intraday breakouts.

FIG. 2: ENHANCED DAY RANGE INDICATOR WITH VOLATILITY BAND.

With the use of standard deviation as a measure of “normal” daily fluctuations, the enhanced version of the Day Range Indicator can be used in all markets.

 

Coding the strategy in Equilla.

Now we have got everything that is needed for the basic idea of the trading strategy. Go long when the indicator breaks above its upper band (or fixed level) and close the position at the end of the day. And it`s just the same on the short side; go short at the lower band, cash in at the end of the day.

As an experienced trader you will notice that this cannot be the whole truth. Some kind of profit protection and stop loss will be needed. Therefore I added a simple profit trailing stop. The default setting is two standard deviations. And I coded a condition that only allows one trade per day. This is meant as a simple protection against a market environment with high volatility but no direction. This might trigger several losing trades on one day.

The coding of the strategy is quite straight forward. First, all needed inputs and variables are defined:

Inputs:​​ dev(2.0),period(500),​​ traildev(2.0,1,10),trademode(breakout,​​ reversalmode),​​ fixedlevel(0.0);

Variables:oo(​​ Invalid​​ ),colour,​​ std,​​ endtime,​​ starttime,​​ tt;

In the next step all the things needed for the trading logic are calculated. When does the market open? When does it close? How many trades have occured? What is the standard deviation for the current bar? See the green comments in the code and you will quickly get how it is done. If you are not familiar with the used syntax, right click on any blue word to get help. If you are still stuck, don’t hesitate to contact tradesignal@tradesignal.com.

colour=black;​​ // colour of indicator bars

If​​ Date​​ <>​​ Date[1]​​ Then begin​​ // first bar of day

oo​​ =​​ Open;​​ //remember opening price

starttime=time;​​ // timestamp of first bar of day

endtime=time[1];​​ // timestamp of last bar of yesterdays session

tt=totaltrades; ​​ // number of trades in history

end;

The following code calculates the standard deviation, the colouring of the bars and plots the enhanced Day Range Indicator.

std=stdev((high+low+close)/3​​ -​​ oo,period);​​ // standard deviation of day range

if​​ fixedlevel>0​​ then​​ std=fixedlevel;​​ // if level is set overwrite standard deviation

 

if​​ high-oo>dev*std​​ then​​ colour=darkgreen;​​ // green above band​​ 

if​​ low-oo<-1*dev*std​​ then​​ colour=red;​​ // red below band

 

drawline(0+dev*std);​​ // upper band

drawline(0-dev*std);​​ // lower band

Drawline(​​ 0,​​ "Zero Line"​​ );​​ // zero line

DrawBar(​​ Open​​ -​​ oo,​​ High​​ -​​ oo,​​ Low​​ -​​ oo,​​ Close​​ -​​ oo,colour,colour);​​ // day range bars

Now the trading logic is programmed. The aim of this strategy is to enter long positions when the indicator breaks above the upper volatility band (The inverse rules are applied to short entries.). The following prerequisites are also required:

  • the current time is at least one hour after market open
  • the market close is at least one hour away
  • we are not in a position and have not traded today

 

// if in core trading time (open+1h - 1 bar before end of session)

if​​ time>starttime+100​​ and​​ time<endtime​​ and​​ 

 marketposition=marketpositionflat and​​ // and currently no position

totaltrades=tt​​ then begin​​ // and no trade today then ...

if​​ trademode=breakout​​ then begin​​ // breakout mode ​​ 

buy next bar​​ at​​ oo+dev*std​​ stop;​​ // buy at upper band,

short next bar​​ at​​ oo-dev*std​​ stop;​​ //short at lower band

end;

 

if​​ trademode=reversalmode​​ then begin​​ // (*) reversal mode

short next bar​​ at​​ oo+dev*std​​ limit;​​ // short at upper band

buy next bar​​ at​​ oo-dev*std​​ limit;​​ // buy at lower band

end;

end;

After the entry is done the exits automatically kick in. The first exit condition is simply the end of the day. The second exit is the trailing stop. It protects your profits and limits the possible losses.

 

FINDING ROBUST PARAMETERS BY USING THE OPTIMIZER.

All inputs of this strategy can be changed after optimisation:

  • Deviation(2.0): Multiplier for the standard deviation.
    TIP: Multiplier for the standard deviation.
  • Period(500): Number of bars needed for the calculation of the standard deviation.
  • TrailDeviation (2.0, 1,10): Number of standard deviations used for the trailing stop.
    TIP: It can be optimized between one and ten standard deviations.

 

If necessary, a further parameter called „FixedLevel“ enables you to use absolute bands for the Day Range indicator instead of standard deviation.

 

BY THE WAY:
If you add the following commands to the strategy code, some additional points will show you the actual entry and exit levels. So you already know in advance the level at which you will be active.

if​​ time=endtime​​ then exitposition this bar​​ on​​ close;​​ // exit trade at end of day

// set profit trailing stop​​ 

setstopcontract;

setdollartrailing(lotsize*traildev*std);

FIG. 3: TRADING STRATEGY “DAY RANGE VOLATILITY BREAKOUT”.

The breakout on September 23rd generated a short entry, while a long trade was triggered on October 8th. As expected, the price move continued until the end of trading, so gains were recorded.

 

With these possibilities to optimize the strategy it should work well on all liquid energy markets that show nice and sharp intraday moves. On the optimization chart you see a heatmap representing the calculations for an optimization of the CFI2Z4 contract. I optimized the width of the volatility band and the width of the trailing stop. As you can see you get a nice and stable green area.

In general, everything above 2 standard deviations should give you a positive result. And that`s exactly what we where expecting. The herd does not gallop every day, so we also will have to select a wider band to separate the galloping herd from the directionless area.

FIG. 4: OPTIMIZATION HEATMAP.

Areas above two standard deviations deliver positive results in the trading strategy.

 

INVERTING THE STRATEGY FROM BREAKOUT TO REVERSAL MODE.

One last point. Sometimes markets just do not listen to what analysts write. Therefore I added a switch in the input section of the strategy that lets me switch the trading logic from breakout to reversal. In reversal mode the strategy does not buy when the indicator touches its upper band, it goes short. So if you are unable to find a stable setting for the breakout mode, just try the reversal mode. Let the market select by itself which strategy is the right one.

I hope this months trading tip will give you some new ideas on how to use a systematic approach in trading emissions and volatility breakouts in general. Let the indicators inspire you, and test your ideas systematically. It might not give you a free lunch, but you can expect a great meal with little cost.

That’s it for today. Take care, take profit.
Philipp Kahler

DISCLAIMER.

© Copyright Tradesignal Ltd., London.
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. All other protected brands and trademarks mentioned in this document conform, without restriction, to the provisions of applicable trademark law and the copyrights of the respective registered owners.

Tradesignal Ltd. obtains information from sources it considers reliable, but does not guarantee the accuracy or completeness of its information contained therein. Tradesignal Ltd. and its affiliates make no representation or warranty, either express or implied, with respect to the information or analysis supplied herein, including without limitation the implied warranties of fitness for a particular purpose and merchantability, and each specifically disclaims any such warranty. In no event shall Tradesignal Ltd. or its affiliates be liable to for any decision made or action taken in reliance upon the information contained herein, lost profits or any indirect, consequential, special or incidental damages, whether in contract, tort or otherwise, even if advised of the possibility of such damages. This material does not constitute an offer or a solicitation of an offer or a recommendation to buy or sell securities. All expressions of opinion are subject to change without notice.

This code is provided free of charge and “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of fitness for a particular purpose and noninfringement. In no event, shall Tradesignal Ltd. be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, or of or in connection with this code or the use of this code.

.

felis elit. Aliquam efficitur. lectus vulputate, mattis odio justo tempus massa