Tài nguyên đang được tải lên... tải...

SuperJump quay lại Bollinger Band

Tác giả:ChaoZhang, Ngày: 2022-05-18 11:17:53
Tags:RMASMAEMAWMAATR

Đây là một chỉ số đơn giản sử dụng Bolinger Band Return.

Sau khi ngọn nến nổ tung, Quay lại bên trong BB là điểm vào.

Thông thường có nhiều hơn hai hình tam giác, vì vậy bạn có thể đợi sau khi đặt hàng một mức giá tốt hơn.

backtest

img


/*backtest
start: 2022-04-17 00:00:00
end: 2022-05-16 23:59:00
period: 30m
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/
//@SuperJump
//@version=5
indicator(shorttitle="SuperJump TBBB", title="SuperJump Turn Back Bollinger Band", overlay=true, timeframe="", timeframe_gaps=true)
length = input.int(68, minval=1, group="Bollinger", inline='1')
src = input(open, title="Source", group="Bollinger", inline='1')
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger", inline='1')
b_mult = input.float(2.5, minval=0.001, maxval=50, title="Wide StdDev", group="Bollinger", inline='1')


basis = ta.sma(src, length)

dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev

b_dev = b_mult * ta.stdev(src, length)
b_upper = basis + b_dev
b_lower = basis - b_dev


atrlength = input.int(title="ATR Length", defval=14, minval=1,group="ATR" ,inline='2')
smoothing = input.string(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"],group="ATR", inline='2')
SLAtr = input.float(title="Stop Loss ATR Ratio", defval=1.0, minval=1,group="ATR" ,inline='2')
ma_function(source, length) =>
	switch smoothing
		"RMA" => ta.rma(source, length)
		"SMA" => ta.sma(source, length)
		"EMA" => ta.ema(source, length)
		=> ta.wma(source, length)
		
atr = ma_function(ta.tr(true), atrlength)


LongSig = ta.crossunder(lower,src) and close > open 
ShortSig = ta.crossover(upper,src) and close < open 
WLongSig = ta.crossunder(b_lower,src) and close > open 
WShortSig = ta.crossover(b_upper,src) and close < open 



//Plots

plot(basis, "Basis", color=#FF6D00)
plot(upper, "Upper", color=#2962FF)
plot(lower, "Lower", color=#2962FF)
plot(b_upper, "Wide Upper", color=#2962FF)
plot(b_lower, "Wide Lower", color=#2962FF)

plot(b_upper + atr*SLAtr, "SL Upper", color=color.red)
plot(b_lower - atr*SLAtr, "SL Lower", color=color.red)


plotchar(ShortSig and WShortSig == false ? src : na, location = location.abovebar, char= "▼", size = size.tiny, color = color.white )
plotchar(LongSig and WLongSig == false ? src : na, location = location.belowbar, char= "▲", size = size.tiny, color = color.white)

plotchar(WShortSig ? src : na, location = location.abovebar, char= "▼", size = size.tiny, color = color.yellow )
plotchar(WLongSig ? src : na, location = location.belowbar, char= "▲", size = size.tiny, color = color.yellow)


alertcondition(LongSig and WLongSig == false, title='Bollinger Band Long', message='Bollinger Band Long Price is {{close}}, SL :{{plot_4}}')
alertcondition(ShortSig and WShortSig == false, title='Bollinger Band Short', message='Bollinger Band Short Price is {{close}},SL :{{plot_3}} ')
alertcondition(WLongSig, title='Wide Bollinger Band Long', message='Wide Bollinger Band Long Price is {{close}}, SL :{{plot_4}}')
alertcondition(WShortSig, title='Wide Bollinger Band Short', message='Wide Bollinger Band Short Price is {{close}},SL :{{plot_3}} ')


if LongSig
    strategy.entry("Enter Long", strategy.long)
else if ShortSig
    strategy.entry("Enter Short", strategy.short)

Có liên quan

Thêm nữa