
この戦略は,ブリン帯の指標と移動平均に基づいて,価格がブリン帯の下線に近づいているかどうかを判断し,価格がブリン帯の上線を突破したときに空を見上げ,価格がブリン帯の下線を突破したときに空を見上げます.それは,トレンドの逆転とブリン帯の下線を突破した時の2つの取引戦略の優位性を組み合わせて,トレンドの揺れ動いたときにより良い利益を得ることができます.
この戦略は,以下の2つの入場信号を判断します.
多頭シグナル:閉盘価格が下線に触れて,閉盘価格がEMA平均線より高く,前K線実体が陰線,現在のK線実体が陽線であるときに多行する.
空頭シグナル:閉盘価格が上線に触れ,閉盘価格がEMA平均線より低いとき,前K線実体が陽線,現在のK線実体が陰線であるとき空空する.
止損方法:固定止損. 止損点は,入場価格から相手側の軌道距離のリスク・リターン係数倍である.
止方法:目標利を相手側の軌道に。つまり多止を下軌道に,空止を上軌道に。
トレンドと逆転戦略の優位性を組み合わせて,トレンドの揺れの中でのパフォーマンスを向上させる.
ブリン帯の指標を使って,過剰買いと過剰売りを判断し,逆転の機会を正確に判断する.
固定ストップポイントは合理的に設定され,リスク管理に役立ちます.
移動式停止は利潤を最大化します.
突破型戦略は利回りしやすいので,偽突破に注意してください.
ストップダストは,状況が不安定なときに頻繁に発生する可能性があります.
固定ストップは市場の変動に合わせて調整できないし,過度に緩やかまたは過度に激進的かもしれない.
ブリン帯のパラメータが設定されていない場合,効果が悪くなる可能性があります.
組み合わせRSI指標のフィルタリング入力信号を考慮することができる.例えば,RSIが50以上なら再多行し,RSIが50未満なら再空行し,誤信号を回避することができる.
固定ストップ距離を自動的に調整する機能を追加し,ストップ距離をより柔軟にします.例えば,ATR指標に基づいてストップ距離を動的に設定します.
ブリン帯のパラメータを最適化して,最適なパラメータの組み合わせを探します.
EMA平均線の異なるパラメータをテストして平均線の護城河効果を最適化することができる.
この戦略は,トレンドと逆転を総合的に考慮し,ブリン帯を利用して超買い超売りポイントの入場を判定し,移動ストップにより利益を最大化する.傾向の揺動の状況で優れたパフォーマンスを発揮する.しかし,策略の効果を最適化するためにパラメータを調整する一方で,策略の効果を調整する注意が必要である.全体的には,比較的実用的で高効率な策略である.
/*backtest
start: 2023-10-24 00:00:00
end: 2023-10-31 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// Welcome to yet another script. This script was a lot easier since I was stuck for so long on the Donchian Channels one and learned so much from that one that I could use in this one
// This code should be a lot cleaner compared to the Donchian Channels, but we'll leave that up to the pro's
// This strategy has two entry signals, long = when price hits lower band, while above EMA, previous candle was bearish and current candle is bullish
// Short = when price hits upper band, while below EMA, previous candle was bullish and current candle is bearish
// Take profits are the opposite side's band(lower band for long signals, upper band for short signals). This means our take profit price will change per bar
// Our stop loss doesn't change, it's the difference between entry price and the take profit target divided by the input risk reward
// At the time of writing this, I could probably calculate that much easier by simply multiplying the opposite band by the input risk reward ratio
// Since I want to get this script out and working on the next one, I won't clean that up, I'm sorry
// strategy(shorttitle="BB Trending Reverse Strategy", title="Bollinger Bands Trending Reverse Strategy", overlay=true, default_qty_type = strategy.cash, default_qty_value = 150, initial_capital = 1000, currency = currency.USD, commission_type = "percent", commission_value = 0.036)
// The built-in Bollinger Band indicator inputs and variables, added some inputs of my own and organised the code
length = input(20, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
emaInput = input(title = "EMA Input", type = input.integer, defval = 200, minval = 10, maxval = 400, step = 1)
riskreward = input(title = "Risk/Reward Ratio", type = input.float, defval = 1.50, minval = 0.01, maxval = 100, step = 0.01)
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
ema = ema(close, emaInput)
// These are our conditions as explained above
entryLong = low[1] <= lower[1] and low <= lower and low > ema
entryShort = high[1] >= upper[1] and high >= upper and high < ema
reversecandleLong = close > open and close[1] < open[1]
reversecandleShort = close < open and close[1] > open[1]
var stopLong = 0.0
var stopShort = 0.0
// These are our entry signals, notice how the stop condition is within the if statement while the strategy.exit is outside of the if statement, this way the take profit targets trails up or down depending on what the price does
if reversecandleLong and entryLong and strategy.position_size == 0
stopLong := (((close / upper - 1) * riskreward + 1) * close)
strategy.entry("Long Entry", strategy.long, comment = "Long Entry")
strategy.exit("Exit Long", "Long Entry", limit = upper, stop = stopLong, comment = "Exit Long")
if reversecandleShort and entryShort and strategy.position_size == 0
stopShort := (((close / lower - 1) / riskreward + 1) * close)
strategy.entry("Short Entry", strategy.short, comment = "Short Entry")
strategy.exit("Exit Short", "Short Entry", limit = lower, stop = stopShort, comment = "Exit Short")
// The built-in Bollinger Band plots
plot(basis, "Basis", color=#872323, offset = offset)
p1 = plot(upper, "Upper", color=color.teal, offset = offset)
p2 = plot(lower, "Lower", color=color.teal, offset = offset)
fill(p1, p2, title = "Background", color=#198787, transp=95)
plot(ema, color=color.red)
// These plots are to check the stoplosses, they can make a mess of your chart so only use these if you want to make sure these work
// plot(stopLong)
// plot(stopShort)