
この戦略は,急上昇する株を識別し,新高を突破する時に多額のポジションを立て,固定パーセントのストップの方法で利益を得る.この戦略は,トレンドフォロー戦略の類である.
この戦略は主に2つの指標に基づいています.
急速RSI:最近の3つのK線の落変化を計算して価格動力を判断する.急速RSIが10を下回ると,株式が超下落状態にあると考えられる.
主体フィルター:最近20のK線における実体平均サイズを計算し,価格実体が平均実体より2.5倍大きいとき,有効な突破とみなす.
速度のRSIが10以下で実物フィルタが有効であるとき,多開口を行う.その後,20%の固定ストップポイントを設定し,開口価格を超えたとき*(1 + ストップ比) のとき,平仓ストップ.
この戦略の優点は,トレンドの初期段階の突破の機会を捕捉でき,急速なRSIによって下部地域を判断し,実体フィルタリングによって偽突破を避けることである.固定ストップ方式をとって,単一の利潤をロックし,市場動向を継続的に把握することができる.
この戦略の利点は以下の通りです.
急速RSIを利用して,下部超下位領域を判断することで,入場率の精度を向上させることができます.
主体フィルターメカニズムは,震動による偽突破を防ぐことができます.
固定比率のストップ方式をとれば,継続的に利益を得ることができ,市場動向を把握できます.
戦略の論理はシンプルで明快で,実行が分かりやすい.
コード構造は優雅で拡張性があり,戦略の最適化に便利です.
この戦略は,評価期間中に安定した正の利益を得て,勝利率が高い.
この戦略にはいくつかのリスクがあります.
ストップ・ロスの仕組みがなく,単一の損失が拡大するリスクがある.
固定停止点位が正しく設定されていない場合,早めに停止したり,停止点が深すぎたりする可能性があります.
状況が不安定になると,小規模な損失が連続して発生する可能性があります.
資金調達・融通コストを考慮しない場合,現時点で収益は減少する.
戦略パラメータの最適化が不足し,異なる品種はパラメータの調整が必要である.
この戦略は以下の点で最適化できます.
単一損失を制御する 損失防止メカニズムを追加する
ストップポイントを最適化し,動的にトレンドを追跡できるようにする.
突破の判断指標を最適化し,入学の正確性を向上させる.
ポジション管理モジュールを追加し,ポジション占有率を最適化します.
品種パラメータ最適化モジュールを追加し,異なる品種のパラメータを自動的に最適化します.
フィルタリング条件を増やして,市場が過度に揺れ動いたときに損失を避ける.
ポジションの平均コスト管理モジュールを追加することを検討してください.
この戦略は,全体的に非常に簡潔で優雅なトレンド追跡戦略である.それは,迅速なRSI判断超下,実体フィルタリングを使用して有効な突破を決定し,固定ストップポイント位置を固定して安定した収益を得る.いくつかの最適化可能なスペースがあるが,この戦略は,迅速に反応し,状況の急速な変化を捉えるのに適した,非常に実用的な取引戦略である.継続的な最適化によって,強力な信頼できる長線ポジション戦略になることができると信じられている.
/*backtest
start: 2022-10-26 00:00:00
end: 2023-11-01 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// this is based on https://www.tradingview.com/v/PbQW4mRn/
strategy(title = "ONLY LONG V4 v1", overlay = true, initial_capital = 1000, pyramiding = 1000,
calc_on_order_fills = false, calc_on_every_tick = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 50, commission_value = 0.075)
//study(title = "ONLY LONG V4 v1", overlay = true)
//Fast RSI
src = close
fastup = rma(max(change(src), 0), 3)
fastdown = rma(-min(change(src), 0), 3)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
//Body Filter
body = abs(close - open)
abody = sma(body, 20)
mac = sma(close, 20)
len = abs(close - mac)
sma = sma(len, 100)
max = max(open, close)
min = min(open, close)
up = close < open and len > sma * 2 and min < min[1] and fastrsi < 10 and body > abody * 2.5
// Strategy
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
var bool longCondition = na
longCondition := up == 1 ? 1 : na
// Get the price of the last opened long
var float last_open_longCondition = na
last_open_longCondition := longCondition ? close : nz(last_open_longCondition[1])
// Get the bar time of the last opened long
var int last_longCondition = 0
last_longCondition := longCondition ? time : nz(last_longCondition[1])
// Take profit
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
tp = input(20, "TAKE PROFIT %", type = input.float, minval = 0, step = 0.5)
long_tp = crossover(high, (1+(tp/100))*last_open_longCondition) and not longCondition
// Get the time of the last tp close
var int last_long_tp = na
last_long_tp := long_tp ? time : nz(last_long_tp[1])
Final_Long_tp = long_tp and last_longCondition > nz(last_long_tp[1])
// Count your long conditions
var int sectionLongs = 0
sectionLongs := nz(sectionLongs[1])
var int sectionTPs = 0
sectionTPs := nz(sectionTPs[1])
// Longs Counter
if longCondition
sectionLongs := sectionLongs + 1
sectionTPs := 0
if Final_Long_tp
sectionLongs := 0
sectionTPs := sectionTPs + 1
// Signals
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// Long
// label.new(
// x = longCondition[1] ? time : na,
// y = na,
// text = 'LONG'+tostring(sectionLongs),
// color=color.lime,
// textcolor=color.black,
// style = label.style_labelup,
// xloc = xloc.bar_time,
// yloc = yloc.belowbar,
// size = size.tiny)
// Tp
// label.new(
// x = Final_Long_tp ? time : na,
// y = na,
// text = 'PROFIT '+tostring(tp)+'%',
// color=color.orange,
// textcolor=color.black,
// style = label.style_labeldown,
// xloc = xloc.bar_time,
// yloc = yloc.abovebar,
// size = size.tiny)
ltp = iff(Final_Long_tp, (last_open_longCondition*(1+(tp/100))), na), plot(ltp, style=plot.style_cross, linewidth=3, color = color.white, editable = false)
// Backtesting
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
testStartYear = input(2019, "BACKTEST START YEAR", minval = 1, maxval = 2222)
testStartMonth = input(01, "BACKTEST START MONTH", minval = 1, maxval = 12)
testStartDay = input(01, "BACKTEST START DAY", minval = 1, maxval = 31)
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
strategy.entry("long", strategy.long, when = longCondition and (time >= testPeriodStart))
strategy.exit("TP", "long", limit = (last_open_longCondition*(1+(tp/100))))
// Alerts
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
alertcondition(longCondition[1], title="Long Alert", message = "LONG")
alertcondition(Final_Long_tp, title="Long TP Alert", message = "LONG TP")