
이 전략은 부린띠의 이중평균선에 기초하여 트렌드를 따르는 거래결정을 한다. 부린띠의 하단 궤도에서의 수렴과 분산을 사용하여 트렌드 변화를 판단하고, 부린띠의 하단 궤도 근처에서 구매하고, 상단 궤도 근처에서 판매하고, 낮은 가격으로 구매하고, 높은 가격으로 판매하고, 이익을 얻는다.
이 전략은 브린띠의 단순 브린띠와 강화된 브린띠 두 가지 버전을 동시에 적용한다.
간단한 브린띠는 종결 가격을 사용하는 SMA 계산의 중간 궤도, 강화된 브린띠는 종결 가격을 사용하는 EMA 계산의 중간 궤도.
위아래 궤도는 중궤도±N배 표준차를 통해 계산된다.
이 전략은 브린의 상하이역 사이의 거리를 기준으로 트렌드를 판단합니다. 스프레드가 설정된 하위값보다 작으면 트렌드 범위에 진입하고 트렌드를 따라 거래할 수 있습니다.
구체적으로, 가격이 하향 궤도에 접근할 때 더 많이 구매하고, 상향 궤도에 접근할 때 평점을 판매한다. 중지 방법은 고정 중지 비율이며, 동시에 추적 중지 설정이 가능하다.
목표 수익은 중간 또는 상단 근처의 평평한 위치를 선택하는 것에 달려 있습니다.
이 전략은 또한 손실을 방지하기 위해 수익을 보장하는 경우에만 판매 할 수 있습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
간단한 브린띠와 강화된 브린띠를 적용하여 두 종류의 브린띠의 효과를 비교하고, 더 나은 버전을 선택하여 의사결정을 효율적으로 수행할 수 있다.
브린이 좁아지면 트렌드에 들어가는 것을 의미하며, 트렌드를 따르는 거래의 확률이 높습니다.
고정 비율의 스톱로스를 사용하여 단편 손실을 제어한다. 또한 중간 또는 상단 근처의 스톱로스를 선택할 수 있으며, 트래킹 스톱로스를 활성화하여 더 많은 이익을 잠금화한다.
수익을 보장하는 경우에만 판매하면 손실의 확산을 방지할 수 있다.
이 전략에는 다음과 같은 위험도 있습니다.
트렌드 트레이딩 자체에는 회수 위험이 있으며, 지속적인 손실에 대한 심리적 압박이 필요합니다.
브린이 폭이 넓을 때, 시장이 충격에 빠질 수 있음을 나타냅니다. 이 전략은 거래 효과가 좋지 않으며, 트렌드가 다시 형성될 때까지 거래를 중단해야 합니다.
고정 퍼센트 스톱은 너무 급진적일 수 있으며, ATR 스톱과 같은 더 온화한 스톱으로 조정할 필요가 있다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
다른 평균선 변수, 표준차의 배수를 테스트할 수 있으며, 다른 시장에 더 적합한 브린띠 변수 조합을 찾을 수 있다.
브린 밴드 신호를 기반으로 MACD, KD 등의 지표의 필터링을 추가하여 흔들리는 시장의 거래를 줄일 수 있다.
다양한 모션 스톱을 테스트할 수 있으며, 앰브, ATR 등에 기반한 스톱을 최적화할 수 있다.
각 거래의 포지션 관리를 최적화하고 다양한 포지션 보충 전략을 테스트하십시오.
이 전략은 이중 부린밴드 지표의 장점을 통합하고, 부린밴드 통로 폭에 따라 트렌드 정도를 판단하고, 트렌드 기간 동안 낮은 흡수 높은 팔을 추적하는 거래를 한다. 동시에 과학적 중지 메커니즘을 설정하여 위험을 제어한다. 이 전략은 파라미터를 최적화하고 다른 지표 필터링과 결합하여 안정성을 더욱 향상시킬 수 있다.
/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-31 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JCGMarkets
//@version=4
strategy("B.Bands | Augmented | Intra-range | Long-Only", shorttitle = "BB|A|IR|L", initial_capital=5000, commission_value=0.075, slippage = 1, overlay = true)
//Technical Indicators Data
show_simp = input(false, title="Trade on Simple Bollinger Bands ", type= input.bool, group="Select Strategy System")
show_augm = input(true, title="Trade on Augmented Bollinger Bands", type= input.bool, group="Select Strategy System")
periods = input(20, title="Periods for Moving Average", type =input.integer, minval = 2, step = 1, group="Technical Inputs")
std = input(2, title="Std", type = input.float, minval=0.1 , step = 0.1, group="Technical Inputs")
// Strategy data
max_spread_bb = input(20000.0, title="Max Spread Tolerance Beetween Bands", type=input.float, step=0.1, group="Strategy Inputs")
entry_source = input(close, title="Entry data source", type=input.source, group="Strategy Inputs")
exit_source = input(high, title="Exit data source", type=input.source, group="Strategy Inputs")
take_profit = input("middle", title = "Profit to band:", options = ["middle", "opposite"], group="Strategy Inputs")
stop_loss = input(3.00, title="Stop Loss %", type=input.float, step=0.05, group="Strategy Inputs")
trailing = input(false, title="Activate trailing stop?", type = input.bool, group="Strategy Inputs")
stop_perc = input(6.00, title="Trailing %", type=input.float, step=0.125, group="Strategy Inputs") * 0.01
sell_profit = input(false, title="Only sell in profit (Stop Loss still active) ", type= input.bool, group="Strategy Inputs")
var SL = 0.0
var SLT= 0.0
//Simple BB Calculation -> adapt if needed with different std for upper-lower, sma-ema, etc
middle_sim = sma(close, periods)
//Augmented BB Calculation -> adapt if needed with different std for upper lower, etc
middle_augm = ema(close, periods)
middle_upp = ema(high, periods)
middle_low = ema(low, periods)
//Multiplier
dev = stdev(close, periods) * std
//Upper & Lower Bands
upper = (middle_sim + dev)
lower = (middle_sim - dev)
//Augmented Bands
upper_augm = (middle_upp + dev)
lower_augm = (middle_low - dev)
//Bands Spread
spread = upper - lower
spread_augm = upper_augm - lower_augm
//From date
filter_from = input( true, title="===> From", group="Date Control")
from_y = input( 2010, title = "from year", group="Date Control")
from_m = input( 1, title = "from month", minval =1, maxval=12, group="Date Control")
from_d = input( 1, title = "from day", minval=1, maxval=31, group="Date Control")
//To date
filter_to = input( true, title="===> To", group="Date Control")
to_y = input( 2030, title = "To year", group="Date Control")
to_m = input( 1, title = "To month", minval =1, maxval=12, group="Date Control")
to_d = input( 1, title = "To day", minval=1, maxval=31, group="Date Control")
// Date Condition
In_date() => true
in_position = strategy.position_size > 0
// Trailing stop
SLT := if in_position and In_date()
stop_inicial = entry_source * (1 - stop_perc)
max(stop_inicial, SLT[1])
else
0
slts = (low <= SLT) and (trailing == true)
//Essential Trade logics
entry_long = (entry_source <= lower) and (spread < max_spread_bb)
entry_long_augm = (entry_source <= lower_augm) and (spread_augm < max_spread_bb)
// Simple Bollinger Conditions
if (not in_position and show_simp and In_date())
if entry_long
// Trigger buy order
position_size = round( strategy.equity / close ) // All available equity for this strategy example
strategy.entry("Entry", strategy.long, qty = position_size )
SL := close * (1 - (stop_loss / 100)) // You could determine wether or not implement stop loss with bool input and if condition here.
if in_position and show_simp and not sell_profit and In_date()
//Exits if not sell in profit
if take_profit == "middle"
strategy.exit("Target", "Entry", limit = middle_sim, stop = SL, comment="Exit")
if take_profit == "opposite"
strategy.exit("Target", "Entry", limit = upper, stop = SL, comment="Exit")
if in_position and show_simp and sell_profit and In_date()
//Exits if sell in profit
if take_profit == "middle"
strategy.exit("Target", "Entry", limit = (strategy.openprofit > 0 ? middle_sim: na), stop = SL, comment="Exit")
if take_profit == "opposite"
strategy.exit("Target", "Entry", limit = (strategy.openprofit > 0 ? upper: na), stop = SL, comment="Exit")
if in_position and show_simp and slts and In_date()
//Trailing activation
strategy.close("Entry", comment="SLT")
if not In_date()
//Exit due out of date range
strategy.close("Entry", comment="Out of date range")
// Augmented Bollinger Conditions
if (not in_position and show_augm and In_date())
if entry_long_augm
// Trigger buy order
position_size = round( strategy.equity / close )
strategy.entry("Entry_A", strategy.long, qty = position_size )
SL := close * (1 - (stop_loss / 100) )
if in_position and show_augm and not sell_profit and In_date()
//Exits and not sell in profit
if take_profit == "middle"
strategy.exit("Target", "Entry_A", limit = middle_augm, stop = SL, comment="Exit")
if take_profit == "opposite"
strategy.exit("Target", "Entry_A", limit = upper_augm, stop = SL, comment="Exit")
if in_position and show_augm and sell_profit and In_date()
//Exit only in profit
if take_profit == "middle"
strategy.exit("Target", "Entry_A", limit = (strategy.openprofit > 0 ? middle_augm:na), stop = SL, comment="Exit")
if take_profit == "opposite"
strategy.exit("Target", "Entry_A", limit = (strategy.openprofit > 0 ? upper_augm: na) , stop = SL, comment="Exit")
if in_position and show_augm and slts and In_date()
//Trigger trailing
strategy.close("Entry_A", comment="SLT")
if not In_date()
//Out of date trigger
strategy.close("Entry_A", comment= "Out of date range")
// Plotting
plot(in_position ? SL > 0 ? SL : na : na , style = plot.style_circles, color = color.red, title = "Stop Loss")
plot(in_position ? trailing ? SLT > 0 ? SLT : na : na : na , style = plot.style_circles, color = color.blue, title = "Trailing Stop" )
s = plot(show_simp ? upper : na , color = color.aqua)
plot(show_simp ? middle_sim : na , color=color.red)
i = plot(show_simp ? lower : na , color = color.aqua)
fill(s,i, color=color.new(color.aqua,90))
plot(show_augm ? middle_augm : na , color=color.blue)
s_a = plot( show_augm ? upper_augm : na, color=color.orange)
i_a = plot( show_augm ? lower_augm : na, color= color.orange)
fill(s_a,i_a, color=color.new(color.orange, 90))