
この戦略は,価格チャネル指標に基づいて,動量パラメータを設定し,異なる周期の最高価格と最低価格の平均値を計算することによって,価格チャネルの中線を形成し,これを基準として,長線と短線を設定します. 価格が長線を破るとき,多めに; 価格が短線を破るとき,空いてください.平仓条件は価格のチャネルの中線への戻りです.
この策略は,価格チャネル指標を使用して,異なる周期における最高価格と最低価格の平均値を計算し,価格チャネルの中線を形成する. 中線をベースとして,シフトパラメータを使用して長線と短線を設定する. 具体的には,長線計算の公式は: 中線+(中線×長線パラメータ%); 短線計算の公式は: 中線+(中線×短線パラメータ%) である.
価格が長線より低ければ,限価格単一で多発券を開く.価格が短線より高ければ,限価格単一で空券を開く.多発券の止損方法は,価格の回帰通路の中線である.
この戦略の利点は以下の通りです.
この戦略にはいくつかのリスクがあります.
上記のリスクは,最適化パラメータ,ストップ・ロードの設定,または他の指標判断と組み合わせて軽減することができます.
この戦略は以下の点で最適化できます.
この戦略は,価格チャネル指標の設計理念が明確であり,突破開口を使用してリスクを効果的に制御できます。しかし,パラメータ最適化の余地が大きく,止損機構が完善される必要があるなどの問題もあります。全体的に,この戦略には一定の実用価値があり,さらなるテストと最適化の価値があります。
/*backtest
start: 2022-11-29 00:00:00
end: 2023-12-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=3
strategy(title = "Noro's PCMA Strategy v1.0", shorttitle = "PCMA 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot, %")
per = input(3, title = "Length")
shortlevel = input(10.0, title = "Short line (red)")
longlevel = input(-5.0, title = "Long line (lime)")
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")
//Price Channel
h = highest(high, per)
l = lowest(low, per)
c = (h + l) / 2
ll = c + ((c / 100) * longlevel)
sl = c + ((c / 100) * shortlevel)
//Lines
shortcolor = needshort ? red : na
longcolor = needlong ? lime : na
plot(sl, linewidth = 2, color = shortcolor, title = "Short line")
plot(c, linewidth = 2, color = blue, title = "SMA line")
plot(ll, linewidth = 2, color = longcolor, title = "Long line")
//Trading
size = strategy.position_size
lot = 0.0
lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]
if (not na(close[per])) and size == 0 and needlong
strategy.entry("L", strategy.long, lot, limit = ll, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size == 0 and needshort
strategy.entry("S", strategy.short, lot, limit = sl, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size > 0
strategy.entry("Close", strategy.short, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size < 0
strategy.entry("Close", strategy.long, 0, limit = c, 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()