ノロの脱出戦略 v1.0

作者: リン・ハーンチャオチャン, 日時: 2023-09-21 15:09:43
タグ:

概要

この戦略は,最近の極値を超えた価格ブレイクに基づいて取引します. 期間中の最高値と最低値を計算し,価格がこれらの水準を突破したときの信号を生成します.

働き方

  1. N 期間の最大高峰と最低低峰を計算する.

  2. 価格が最高値を超えるとロングする.

  3. 価格が dnex以下になるとショートする.

  4. 設定可能なのは長時間のみ,短時間のみ,または両方向.

  5. 設定可能な資本利用率

  6. 設定可能な取引時間帯

利点

  • 突破信号を捕捉し,トレンド取引に役立ちます
  • シンプルで直感的なルール 実行が簡単
  • 方向設定は異なる市場に適応します
  • 取引時間範囲を制限できる
  • 資本利用を制御する

リスク

  • 誤ったブレイクを効果的にフィルタリングできない.
  • 双方向貿易はコストを増加させる
  • 高額な資本利用はリスクを増やす

オプティマイゼーションの方向性

  • 偽のブレイクを避けるために検証を追加する
  • 最適な性能のためにN値を最適化する
  • スクリーン信号への追加フィルター
  • 異なる資本利用率をテストする
  • 取引日数制限

結論

この戦略は,価格ブレイクシグナルを使用してトレンドをフォローする.ブレイクシグナルの有効性と調整パラメータを向上させることでパフォーマンスを向上させることができます.しかし,偽ブレイクシグナルとリスクコントロールは対処する必要があります.全体として,シンプルで効果的なトレンド取引ソリューションです.


/*backtest
start: 2023-09-18 00:00:00
end: 2023-09-20 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's Brakeout Strategy v1.0", shorttitle = "Brakeout str 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 = "Capital, %")
len = input(4, defval = 4, minval = 1, maxval = 1000, title = "Length")
showlines = input(true, defval = true, title = "Show Lines?")
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")

//Extremums
upex = highest(high, len)
dnex = lowest(low, len)
col = showlines ? blue : na
plot(upex, color = col, linewidth = 2)
plot(dnex, color = col, linewidth = 2)

//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 : lot[1]

if (not na(close[len]))
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)), stop = upex + syminfo.mintick)
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)), stop = dnex - syminfo.mintick)

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()

もっと