[TOC]
The Keltner channel is a trading system invented by Chester W. Keltner in the 1960s, with the central idea of linear equations. The system has achieved remarkable results over a very long period of time. Although the original Keltner channel system was not as effective when it first appeared, its core ideas have had a profound impact on the trading world to this day.
When it comes to channel strategies, one might think of the famous Boll line, but the difference is that the Kenta line uses the average of the highest, lowest, and closing prices as a base price, and then calculates the N-cycle average of this base price, which is the mean of the Kenta line.
So, how does this amplitude of volatility be calculated? That is, the N-cycle average of the "highest price - lowest price", multiplied by a certain multiple. This way, you will find that it is similar to the Boll line, with a price trajectory and an upward trajectory calculated based on the price trajectory.
Later, the Kettner channel was improved by Linda Raschke. Linda Raschke is a well-known American commodity futures trader and president of LBR Asset Management. The original Kettner trajectory was an ordinary straight line, changed to an index average.
We know that prices don't always operate in a trend or turbulent way, but rather in a way that the trend and turbulence do not alternate completely randomly. So Kentner uses the channel as a dividing line to separate the trend and turbulent markets. When prices operate between up and down the track, we can think of it as a turbulent market.
The entrance
The appearance
Using the above trading logic, we can build this strategy on the inventor's quantized trading platform.fmz.com> Login > Control Center > Policy library > Create new policies > Click the drop-down box in the upper-left corner to select My language to start writing the policy, see the notes in the code below.
// 参数
MAN:=20;
ATRN:=50;
JG:=(HIGH+LOW+CLOSE)/3; // 基础价格
ZG:MA(JG,MAN); // 中轨
TRUEHIGH1:=IF(HIGH>REF(C,1),HIGH,REF(C,1));
TRUELOW1:=IF(LOW<=REF(C,1),LOW,REF(C,1));
TRUERANGE1:=IF(ISLASTBAR,H-L,TRUEHIGH1-TRUELOW1); // 计算真实波动幅度
SG:ZG+MA(TRUERANGE1,ATRN); // 上轨
XG:ZG-MA(TRUERANGE1,ATRN); // 下轨
ZG>REF(ZG,1)&&C>SG,BK; // 中轨向上,并且价格升破上轨,开多单
C<ZG,SP; // 持有多单时,价格跌破中轨,平多单
ZG<REF(ZG,1)&&C<XG,SK; // 中轨向下,并且价格跌破下轨,开空单
C>ZG,BP; // 持有空单时,价格升破中轨,平空单
AUTOFILTER; // 设置信号过滤方式
In order to get closer to the real trading environment, we used a stress test with 2 jumps in the open position and 2 times the transaction fees in the retest, testing the environment as follows:
Testing environment Benefits are clear The funding curve The above graphs are a retrospective of the XBTUSD perpetual contract on the BitMEX exchange, which has maintained its effectiveness in the trending market, although the efficiency is not too high, but overall the capital curve is up, even when the market trend retreated in July 2019, the net value curve did not retreat much.
Click to copy the full policy source code
Although Kenta is an old trading method, we have restored and improved it with code, which proves that the strategy is still effective today. Especially in the medium and low frequency CTA strategy, Kenta still has something worth learning, which is to cut losses and let profits run!
It can be said that most of the successful trading methods are based on the idea of losing a little when you make a loss, making a little more money when you make a loss, and then constantly implementing this idea. So, as a long-term trading strategy, short-term losses are inevitable costs, short-term profits are not our goal.