Daily Bollinger Band Strategy

1. Strategy Overview and Features
This strategy is a tool for backtesting a trading method that uses Bollinger Bands. It is *not* a tool for automated trading.
1-1. Main Display Items
The main chart displays the Bollinger Bands and the 200-day moving average.
It also shows the entry and exit points along with the position size (in units of 100 shares).
1-2. Summary of Trading Rules
For long (buy) strategies, the trade enters when the price crosses above the +1σ line of the Bollinger Bands, aiming to ride an upward trend. The position is exited when the price crosses below the middle band.
For short (sell) strategies, the trade enters when the price crosses below the -1σ line of the Bollinger Bands, aiming to ride a downward trend. The position is exited when the price crosses above the middle band.
1-3. Strategic Enhancements
The strategy uses the slope of the 200-day moving average to determine the trend direction and enter trades accordingly. This improves the win rate and payoff ratio.
Additionally, to reduce the probability of ruin, the risk per trade is limited to 1.0% of capital, and position sizing is adjusted using ATR (a volatility indicator).
2. Trading Rules
2-1. Chart Type
Only daily charts are used.
2-2. Indicators Used
(1) Bollinger Bands** (used for entry and exit signals)
- Period: Fixed at 80 days
- Upper and lower bands: Fixed at ±1σ
(2) Moving Average** (used to determine trend direction)
- Period: Fixed at 200 days
- Trend direction is judged based on whether the difference from the previous day is positive (upward) or negative (downward)
2-3. Buy Rules
Setup:
- Price crosses above the +1σ line from below
- Both the middle band and 200-day moving average are upward sloping
Entry:
- Buy at the next day’s market open using a market order
Exit:
- If the price crosses below the middle band, sell at the next day’s open using a market order
2-4. Sell Rules
Setup:
- Price crosses below the -1σ line from above
- Both the middle band and 200-day moving average are downward sloping
Entry:
- Sell at the next day’s market open using a market order
Exit:
- If the price crosses above the middle band, buy back at the next day’s open using a market order
2-5. Risk Management Rules
- Risk per trade: 1.0% of total capital (acceptable loss = capital × 1.0%)
- Position size: Acceptable loss ÷ 2ATR (rounded down to the nearest unit of 100 shares)
2-6. Other Notes
- No brokerage fees
- No pyramiding
- No partial exits
- No reverse positions (no “stop-and-reverse” trades)
3. Strategy Parameters
The following settings can be specified:
3-1. Period Settings
- Start date: Set the start date for the backtest period
- Stop date: Set the end date for the backtest period
3-2. Display of Trend and Signals
- Show trend: When checked, the background color of the bars is light red for an uptrend and light blue for a downtrend
- Show signal: When checked, entry and exit signals are displayed (note: signals are executed at the next day’s open, so there is a one-day lag in the display)
3-3. Capital Management Settings
- Funds: Capital available for trading (in JPY)
- Risk rate: Specify what percentage of the capital to risk per trade
Settings in the “Properties” tab are not used in this strategy.
4. Backtest Results (Example)
Here are the backtest results conducted by the author:
- Target Stocks: All components of the Nikkei 225
- Test Period: January 4, 2000 – December 30, 2024
- Data Points: 12,886
- Win Rate: 33.45%
- Net Profit: ¥82,132,380
- Payoff Ratio: 2.450
- Expected Value: ¥6,373.8
- Risk Rate: 1.0%
- Probability of Ruin: 0.00%
---
デイリー・ボリンジャーバンド・ストラテジーの概要
1. ストラテジーの概要と特徴
このストラテジーは、ボリンジャーバンドを使ったトレード手法のバックテストを行うツールです。自動売買を行うツールではありません。
1-1. 主な表示項目
メインチャートにボリンジャーバンドと 200日移動平均線を表示します。
また、エントリーと手仕舞いのタイミングと数量(100株単位)も表示されます。
1-2. トレードルールの概要
買い戦略の場合、ボリンジャーバンドの +1σ 超えでエントリーして上昇トレンドに乗り、ミドルバンドを割ったら決済します。
売り戦略の場合、ボリンジャーバンドの -1σ 割りでエントリーして下降トレンドに乗り、ミドルバンドを上抜けたら決済します。
1-3. ストラテジーの工夫点
200日移動平均線の傾きを見てトレンド方向にエントリーをしています。こうして勝率とペイオフレシオの成績を向上しています。
また、破産確率を抑えるために、リスク資金比率を 1.0% にして、ATR(ボラティリティ指標) を使って注文数を調整しています。
2. 売買ルール
2-1. 使用するチャート
日足チャートに限定します
2-2. 使用する指標
(1) ボリンジャーバンド(仕掛けと手仕舞いのシグナルに使用)
期間は80日に固定
上下バンドは ±1σ に固定
(2) 移動平均線(トレンドの方向を見るために使用)
期間は200日に固定
移動平均の値の前日との差がプラスのとき上向き、マイナスのとき下向きと判断
2-3. 買いのルール
セットアップ:ボリンジャーバンドの +1σ を価格が下から上に交差 かつ ミドルバンドと 200日移動平均線が上向き
仕掛け:翌日の寄り付きに成行で買う
手仕舞い:ボリンジャーバンドのミドルバンドを価格が上から下に交差したら、翌日の寄り付きに成行で売る
2-4. 売りのルール
セットアップ:ボリンジャーバンドの -1σ を価格が上から下に交差 かつ ミドルバンドと 200日移動平均線が下向き
仕掛け:翌日の寄り付きに成行で売る
手仕舞い:ボリンジャーバンドのミドルバンドを価格が下から上に交差したら、翌日の寄り付きに成行で買い戻す
2-5. 資金管理のルール
リスク資金比率:資産の 1.0%(許容損失 = 資産 × 1.0%)
注文数:許容損失 ÷ 2ATR(単元株数未満は切り捨て)
2-6. その他
仲介手数料:なし
ピラミッディング:なし
分割決済:なし
ドテン:しない
3. ストラテジーのパラメーター
次の項目が指定できます。
3-1. 期間の設定
Staer date : バックテストの検証期間の開始日を指定します
Stop date : バックテストの検証期間の終了日を指定します
3-2. トレンドとシグナルの表示
Show trend : チェックを入れると、バーの背景色が、トレンドが上昇のときは薄い赤で、下落のときは薄い青で表示されます
Show signal : チェックを入れると、エントリーと手仕舞いのシグナルを表示します(シグナルの出た翌日の寄り付きに売買をするので表示に1日のずれがあります)
3-3. 資金管理用の設定
Funds : トレード用の資金(円)
Risk rate : 許容損失を資金の何%にするかで指定します
「プロパティタブ」で設定する値は、このストラテジーでは有効ではありません。
4. バックテストの結果(例)
作者がバックテストを実施した結果をお知らせします。
対象銘柄:日経225構成銘柄すべて
対象期間:2000年1月4日~2024年12月30日
データ件数:12,886
勝率:33.45%
純利益:82,132,380
ペイオフレシオ:2.450
期待値:6,373.8
リスク資金比率:1.0%
破産確率:0.00%
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.