
この戦略は,3つの異なる周期の単純な移動平均 (SMA) とカフマン自律移動平均を使用する組み合わせによって,長線入場信号を形成する.短周期SMA上でより長い周期のSMAを穿越するときに買い信号を生成する.さらに,戦略は,K線実体色を組み合わせて主動トレンドを判断し,多頭トレンドのみで買い信号を生成し,偽突破を避ける.
この戦略は,SMA 4 ,SMA 9 ,およびSMA 18を含む3つの異なる周期のSMAを使用します. この3つのSMAの交差組み合わせは,トレンドの方向を判断する古典的な技術的な指標です.
偽のブレイクをフィルターするために,この戦略はKaufman自律移動平均も導入している.SMAの金叉信号は,閉盘価格が自律移動平均より高く,つまり多頭トレンドにある場合にのみ有効であり,ロングラインを起動する.
さらに,この戦略は, 100 周期の SMA を使って主動トレンドを判断する. 100 周期の SMA を越えたときに,価格が多頭トレンドに入ることを確認する. この戦略は,主多頭トレンドの中でのみ買い信号を生成する.
この戦略の買い付けシグナルは,以下のような要素の組み合わせから生まれています.
上記の3つの条件が同時に満たされると,長線買取信号が生成される.
この戦略には以下の利点があります.
この戦略にはいくつかのリスクがあります.
言語の使い方を最適化するには
この戦略は,さらに改善できる余地があります.
この戦略は,複数のSMAの交差によって長線信号を形成し,同時に,移動平均と主動トレンドの判断を自律的に組み合わせることで,トレンドの状況で大きな利益を得ることができ,安定した論理と強力な実戦効果があります. しかし,一定のリスクもあります.
/*backtest
start: 2022-11-17 00:00:00
end: 2023-11-23 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/
// © Wielkieef
//@version=5
strategy(title='twisted SMA strategy [4h] ', overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_order_fills=false, slippage=0, commission_type=strategy.commission.percent, commission_value=0.03)
src = close
Length1 = input.int(4, title=' 1-SMA Lenght', minval=1, group='SMA')
Length2 = input.int(9, title=' 2-SMA Lenght', minval=1, group='SMA')
Length3 = input.int(18, title=' 3-SMA Lenght', minval=1, group='SMA')
SMA1 = ta.sma(close, Length1)
SMA2 = ta.sma(close, Length2)
SMA3 = ta.sma(close, Length3)
Long_ma = SMA1 > SMA2 and SMA2 > SMA3
Short_ma = SMA1 < SMA2 and SMA2 < SMA3
LengthMainSMA = input.int(100, title=' SMA Lenght', minval=1)
SMAas = ta.sma(src, LengthMainSMA)
// Powered Kaufman Adaptive Moving Average by alexgrover (modificated by Wielkieef)
lengthas = input.int(25, title=' Lenght')
sp = input.bool(true, title=' Self Powered')
er = math.abs(ta.change(close, lengthas)) / math.sum(math.abs(ta.change(close)), lengthas)
pow = sp ? 1 / er : 2
per = math.pow(math.abs(ta.change(close, lengthas)) / math.sum(math.abs(ta.change(close)), lengthas), pow)
a = 0.
a := per * src + (1 - per) * nz(a[1], src)
mad4h = 0.
a_f = a / a[1] > .999 and a / a[1] < 1.001
///.
Bar_color = close > SMAas ? color.green : Long_ma ? color.blue : Short_ma ? color.maroon : color.gray
barcolor(color=Bar_color)
long_cond = Long_ma and SMAas < close and not a_f
long_stop = Short_ma
if long_cond
strategy.entry('BUY', strategy.long)
strategy.close_all(when=long_stop)
//by wielkieef