
空間指向価格逆転戦略は,価格チャネル中央線を計算して,価格変動の傾向方向を判断する.価格がチャネル中央線に近づくと,多額のまたは空っぽの信号を発信する.この戦略は,複数のフィルタリング条件を組み合わせて,高い確率の取引機会を探している.
この戦略の核心指標は,価格チャネルの中央線である.計算方法は,最近30のK線の最高価格と最低価格の平均値を取ることである.低点が中央線より高いときは上昇傾向とみなされ,高点が中央線より低いときは下降傾向とみなされる.
戦略は,トレンド背景が変化したときにのみ取引信号を発信する.つまり,上昇の背景では,K線が赤くなったときにのみ空白をします. 減少の背景では,K線が緑になったときにのみ多めにします.
さらに,戦略は2つのフィルタリング条件を設定します. 実体フィルタリングと価格チャネルバーのフィルタリング. 実体体積が平均値の20%以上である場合にのみシグナルが誘発されます. フィルタリングサイクル内で連続したトレンドシグナルが必須です.
この戦略は,トレンド,価値領域,K線形状を組み合わせて,非常に効率的な反転取引戦略である.主な利点は:
この戦略の主なリスクは,価格転換点を逃し,信号を待つことによるものです.以下の方法で最適化できます.
この戦略は以下の点で最適化できます.
空間指向の価格逆転戦略は,価格チャネルを判断して逆転のタイミングを判断し,ダブルフィルター条件を設定して高品質の信号を生成する.パラメータ調整と風制御に基づいて,信頼できる量化戦略である.
/*backtest
start: 2023-11-19 00:00:00
end: 2023-11-26 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Noro's PriceChannel for D1 v1.0", shorttitle = "PriceChannel D1", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 0)
//Settings
needlong = input(true, "long")
needshort = input(true, "short")
slowlen = input(30, defval = 30, minval = 2, maxval = 200, title = "PriceChannel Period")
pcbars = input(1, defval = 1, minval = 1, maxval = 20, title = "PriceChannel Bars")
usecol = input(true, "Use color-filter")
usebod = input(true, "Use body-filter")
needbg = input(false, defval = false, title = "Need trend Background?")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
src = close
//PriceChannel
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2
//Trend
ub = low > center ? 1 : 0
db = high < center ? 1 : 0
trend = sma(ub, pcbars) == 1 ? 1 : sma(db, pcbars) == 1 ? -1 : trend[1]
//Body
body = abs(close - open)
abody = sma(body, 10)
//Signals
up = trend == 1 and (close < open or usecol == false) and (body > abody / 5 or usebod == false)
dn = trend == -1 and (close > open or usecol == false) and (body > abody / 5 or usebod == false)
//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "PriceChannel Center")
//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 80)
//Trading
if up
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59)
strategy.close_all()