チャート上のサポートレベルとレジスタンスレベルの定量化

チャートを見ると、値動きには天井と底があるかのように思える境界、サポートラインとレジスタンスライン。
これらを数学的に検出する方法を紹介。

The Breakout Bulletin

ブレイクアウト会報

The following article was originally published in March 2003 issue of The Breakout Bulletin.
以下の記事はブレイクアウト会報の2003年3月号に掲載されたものです。

Quantifying Chart-based Support/Resistance Levels

チャート上のサポートレベルとレジスタンスレベルの定量化

    A common distinction in trading is between systematic and discretionary trading methods.
    Systematic traders use hard and fast rules that are typically computerized in the form of one or more trading systems.
    Discretionary traders, on the other hand, don’t use trading systems.
    While they have trading rules and methods, they haven’t codified those rules into a computerized trading system.
    I’ve always found this distinction to be somewhat arbitrary.
    One of the tenets of good trading is to have well defined methods.
    Whether you computerize those methods into a trading system or choose to manually implement certain aspects of your approach, you still have something that could reasonably be called a “system.”
    In fact, I’d go as far as to say that most discretionary methods are just trading systems yet to be programmed.
    A trader may be “discretionary” only because his approach seems too complicated to program.

システムトレードと裁量トレードとの区別として一般的に言われていることがある。

システムトレーダーは厳密ですばやく行えるルールを使用している。
そのルールは典型的には1つもしくはそれ以上のトレーディングシステムの形としてコンピュータで処理されている。

その一方で裁量トレーダーはトレーディングシステムを使用していない。
彼らはトレーディングのルールと手法をもっているのだが、それらをコンピュータで処理されたトレーディングシステムとして作り上げていない。

私はいつもこの区別の仕方が多少独断的であると思うのである。

よいトレーディングであるという見解の1つはうまく定義された手法をもっていることである。

あなたがこの手法を1つのトレーディングシステムとしてコンピュータで処理しているのか、あなたの手法の信頼できる部分を手作業で実行することを選んでいるのか、どちらであっても問題なく“システム”とよぶことのできるものをあなたはもっていることになる。

実際、ほとんどの裁量的な方法がまだプログラム化されていないと言うことができる。
トレーダーが彼のトレーディングの手法があまりに複雑でプログラム化できないという理由だけで、“裁量的”なのだろう。

    One aspect of trading that can frustrate attempts at programming is chart patterns.
    Reading chart patterns, such as triangles and head and shoulder patterns, is said to be more art than science.
    If you have a trading approach based on chart patterns, you’re probably a discretionary trader, if only because it’s complicated to program a system to recognize a chart pattern.

プログラミング化を試みて挫折するトレーディング手法の1つがチャートパターンである。
トライアングルやヘッドアンドショルダーなどのようなチャートパターンを読むことは科学的というより芸術的であるといえる。

もしあなたがチャートパターンを基にしたトレーディング手法をもっていて、そのチャートパターンを認識するシステムをプログラム化することが複雑であるという理由があるだけで、あなたはおそらく裁量トレーダーなのである。

    Several months ago I was studying support and resistance levels for day trading the E-mini S&P.
    After scanning numerous intraday charts to locate these price levels visually, an algorithm occurred to me for identifying these support and resistance prices.
    This month, I’ll show how this algorithm works and how to program it in TradeStation’s EasyLanguage.

数ヶ月前、私はE-mini S&Pのデイトレーディングのためにサポートとレジスタンスのレベルについて研究していた。
これらのプライスレベルを視覚的に発見するために膨大な日中(イントラデイ)チャートをくまなく観察した後、これらのサポートとレジスタンスプライスを決定するための1つのアルゴリズムについての考えが私の頭に浮かんだ。

今回、私はこのアルゴリズムがどのように働き、トレードステーションのイージーランゲージでそれをどのようにプログラム化したのかを紹介する。

サポートラインとレジスタンスライン

    Fig. 1 A 3 minute chart of the March E-mini S&P 500 showing several support and resistance levels.

図1.E-mini S&P500の3分チャートに表示したいくつかのサポートおよびレジスタンスレベル

    Consider Fig. 1. I’ve drawn several horizontal lines by hand to suggest the kind of short-term support and resistance levels I have in mind.
    You might look for these price levels if you’re trying to capture a few points of profit per trade.
    For example, you might try to sell short at the resistance level during a downtrend and cover at the support level.
    Similarly, in a up trend, you might try to buy at the support level and sell at the resistance level.

図1について考えてみる。

私は自分の考えていた短期のサポートとレジスタンスレベルを説明するために数本の水平ラインを手で描いた。

トレードで利益の出せるいくつかのポイントをうまく表現しようとするならば、あなたはこれらのプライスレベルを探すかもしれない。
たとえば、下降トレンド中にレジスタンスレベルでショートエントリーしようとしたかもしれない。
同じように上昇トレンド中にサポートレベルで買い、レジスタンスレベルで売ろうとしたかもしれない。

    The logic I came up with to systematize the identification of these levels is pretty straight-forward.
    As each price bar is completed, I look for the most logical location for support and the most logical location for resistance relative to the close of the most recently completed bar.
    Since we are focusing on intraday data, which, in actual day trading, is evolving in real time, these support/resistance locations may change from bar to bar.

私が思いついたこれらのレベルの識別を機械的に行うためのロジックは、かなりわかりやすいものである。

各プライスバーが完成したときに、私はもっとも論理的なサポートレベル用の位置とレジスタンスレベル用の位置を、できたばかりのプライスバーの終値に関連付けて探す。
われわれは日中データに注目しているため、実際のデイトレーディングではこの作業はリアルタイムに進行し、サポートとレジスタンスレベルの位置はバーからバーへと変化する。

    To identify the locations of support and resistance relative to the close, I scan all price levels within X points of the close over the last N bars. At each price level, imagine a horizontal line extending back from the current bar over the last N bars.
    Our goal is find the price level at which the horizontal line best fits the last N bars.
    I use a least-squares fitting method.
    At each price bar, determine whether the high or low of the bar is closest to the line and add the square of the difference between that price and the price level of the line to a running sum.
    This calculation is repeated for each of the N bars closest to the current bar to form the “sum of squares.
    ” Ignore price bars that are farther away from the line than Y points in order to avoid skewing the sum by these “outlier” prices.
    The whole process is repeated for each price level within X points of the current close.

終値に関連付けたサポートとレジスタンスレベルの位置を識別するために、私は過去N本のバーの終値のXポイント以内のすべてのプライスレベルをくまなく調べる。

各プライスレベルにおいて、現在のバーから過去N本のバーまでさかのぼって水平ラインを伸ばしたものを想像してほしい。

我々の目標は過去N本のバーにもっともフィットする水平ラインのプライスレベルを発見することだ。
私はこれに最小2乗法を使用する。

それぞれのプライスバーにおいてバーの高値または安値のどちらがラインにもっとも近いのかを決定し、そのプライスと水平ラインのプライスレベルの差の2乗を“累積”へと加える。
現在のバーに最も近いN本のバーのそれぞれで、この計算が“2乗の合計(累積)”を作るために繰り返される。

Yポイント以上ラインから離れているプライスバーは、この合計値をゆがめるのを避けるために、“関係ないもの”として無視する。
すべてのプロセスは現在の終値からXポイント以内の各プライスレベルで繰り返し行われる。