
この策略は,単に多行策略であり,ATRチャネルの下限を破る価格を使用して入場を決定し,ATRチャネルの平均線またはATRチャネルの上限を止まりとして退出する.同時に,ATRを止損価格を計算するために使用します.この策略は,迅速なショートライン取引を行うのに適しています.
価格がATRチャネルの下限を下回ったとき,価格が異常な下落を示している.このとき,戦略は次のK線開盤時に多入場を行う.停止価格は,入場価格としてATRの停止係数をATRで減算する.停止価格はATRチャネルの均線またはATRチャネルの上限であり,現在のK線閉盤価格が前K線の最低価格を下回った場合,前K線の最低価格が停止価格として使用されます.
具体的には,この戦略は以下の論理を基本に含んでいます.
この戦略の利点は以下の通りです.
この戦略にはいくつかのリスクがあります.
ATRサイクルを調整し,ストップ・ローカーを縮小するなどの方法によって上記のリスクを軽減することができます.また,取引手数料が低いブローカーを選択することも重要です.
この戦略は,以下の点で最適化できます.
この戦略は,全体として,シンプルで実用的なショートライン突破均線逆転戦略である. 明確な入場ルール,厳格な止損機構,完善した止まり方法がある. また,いくつかのパラメータの調整のための最適化スペースも提供している. 取引者が適切な標識を選択し,止まりを伴ってリスクを制御できれば,この戦略は良い結果を得ることができるべきである.
/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
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/
// © Bcullen175
//@version=5
strategy("ATR Mean Reversion", overlay=true, initial_capital=100000,default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=6E-5) // Brokers rate (ICmarkets = 6E-5)
SLx = input(1.5, "SL Multiplier", tooltip = "Multiplies ATR to widen stop on volatile assests, Higher values reduce risk:reward but increase winrate, Values below 1.2 are not reccomended")
src = input(close, title="Source")
period = input.int(10, "ATR & MA PERIOD")
plot(open+ta.atr(period))
plot(open-ta.atr(period))
plot((ta.ema(src, period)), title = "Mean", color=color.white)
i_startTime = input(title="Start Filter", defval=timestamp("01 Jan 1995 13:30 +0000"), group="Time Filter", tooltip="Start date & time to begin searching for setups")
i_endTime = input(title="End Filter", defval=timestamp("1 Jan 2099 19:30 +0000"), group="Time Filter", tooltip="End date & time to stop searching for setups")
// Check filter(s)
f_dateFilter = true
atr = ta.atr(period)
// Check buy/sell conditions
var float buyPrice = 0
buyCondition = low < (open-ta.atr(period)) and strategy.position_size == 0 and f_dateFilter
sellCondition = (high > (ta.ema(close, period)) and strategy.position_size > 0 and close < low[1]) or high > (open+ta.atr(period))
stopDistance = strategy.position_size > 0 ? ((buyPrice - atr)/buyPrice) : na
stopPrice = strategy.position_size > 0 ? (buyPrice - SLx*atr): na
stopCondition = strategy.position_size > 0 and low < stopPrice
// Enter positions
if buyCondition
strategy.entry(id="Long", direction=strategy.long)
if buyCondition[1]
buyPrice := open
// Exit positions
if sellCondition or stopCondition
strategy.close(id="Long", comment="Exit" + (stopCondition ? "SL=true" : ""))
buyPrice := na
// Draw pretty colors
plot(buyPrice, color=color.lime, style=plot.style_linebr)
plot(stopPrice, color=color.red, style=plot.style_linebr, offset=-1)