この戦略は,RSIとMFIの2つの指標の優位性を組み合わせたAlphaTrend指標に基づいています.この戦略は,多空のトレンド市場において優れた戦略効果を得ることができます.
この戦略は,主にAlphaTrend曲線による価格トレンドの方向を判断する.この戦略は,ATR市場の波動度量,RSIとMFI多空指標を総合的に考慮し,価格トレンドを効果的に追跡することができます.価格が曲線を破るとき,トレンドの転換が発生することを示す.この時間点は入場の時間点である.
全体として,この戦略は多空市場に適用され,市場のノイズを効果的にフィルターし,トレンドを正確に識別し,精密な高効率のトレンドフォロー戦略である.
リスクに応じて,単一の損失を制御するためにストップロスを設定できます. 他の指標の組み合わせを使用して無効信号を減らすためにパラメータの組み合わせを最適化します. 異なる市場に応じてパラメータの設定を調整します.
市場やパラメータをテストすることで,さらに多くの種類の状況に対応できるように,この戦略を最適化することもできます.
アルファトレンド戦略は,全体として,シンプルで効率的なトレンドフォロー戦略である.価格と取引量と組み合わせて,多空の状況に適応できる.突破的な操作方法で入場タイミングを明確にする.リスクを適切に管理する前提で,良い戦略効果を得ることができる.さらにテストする価値のある最適化により,より多くの市場で安定した利益を得ることができる.
/*backtest
start: 2023-09-20 00:00:00
end: 2023-09-26 00:00: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/
// author © KivancOzbilgic
// developer © KivancOzbilgic
// pv additions, simplification and strategy conversion @ treigen
//@version=5
strategy('AlphaTrend For ProfitView', overlay=true, calc_on_every_tick=true, process_orders_on_close=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, initial_capital=1000)
coeff = input.float(1.5, 'Multiplier', step=0.1)
AP = input(15, 'Common Period')
ATR = ta.sma(ta.tr, AP)
novolumedata = input(title='Change calculation (no volume data)?', defval=false)
i_startTime = input(defval = timestamp("01 Jan 2014 00:00 +0000"), title = "Backtesting Start Time", inline="timestart", group='Backtesting')
i_endTime = input(defval = timestamp("01 Jan 2100 23:59 +0000"), title = "Backtesting End Time", inline="timeend", group='Backtesting')
timeCond = true
pv_ex = input.string('', title='Exchange', tooltip='Leave empty to use the chart ticker instead (Warning: May differ from actual market name in some instances)', group='PV Settings')
pv_sym = input.string('', title='Symbol', tooltip='Leave empty to use the chart ticker instead (Warning: May differ from actual market name in some instances)', group='PV Settings')
pv_acc = input.string("", title="Account", group='PV Settings')
pv_alert_long = input.string("", title="PV Alert Name Longs", group='PV Settings')
pv_alert_short = input.string("", title="PV Alert Name Shorts", group='PV Settings')
pv_alert_test = input.bool(false, title="Test Alerts", tooltip="Will immediately execute the alerts, so you may see what it sends. The first line on these test alerts will be excluded from any real alert triggers" ,group='PV Settings')
upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := (novolumedata ? ta.rsi(close, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT
k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3)
k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3)
buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2])
sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2])
var exsym = ""
if barstate.isfirst
exsym := pv_ex == "" ? "" : "ex=" + pv_ex + ","
exsym := pv_sym == "" ? exsym : exsym + "sym=" + pv_sym + ","
if barstate.isconfirmed and timeCond
if strategy.position_size <= 0 and buySignalk
strategy.entry("Buy", strategy.long)
alert(pv_alert_long + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar_close)
if strategy.position_size >= 0 and sellSignalk
strategy.entry("Sell", strategy.short)
alert(pv_alert_short + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar_close)
// Only used for testing/debugging alert messages
if pv_alert_test
alert("<![Alert Test]!>\n" + pv_alert_long + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar)
alert("<![Alert Test]!>\n" + pv_alert_short + "(" + exsym + "acc=" + pv_acc + ")", alert.freq_once_per_bar)