
この策略は,トレンドが変化するポジションの格子策略を従う傾向であり,トレンドの方向と入場時刻を判断するために主にEMA,RSI,そしてサボる形状を使用します.この策略は,サボる形状の実体サイズに応じて,停止と停止の位置を調整し,同時に,ユーザが多,空,または多空の選択を可能にします.さらに,この策略は,トレンドフィルター条件としてMACDのオプションを提供します.
この戦略は200周期EMA線を使用して,大トレンドの方向を判断し,価格がEMA上部で上昇傾向にあり,EMA下部で下降傾向にあると考えられます. 9周期RSIは,動力を判断するために使用され,RSIは50以上の多頭動力が強い,空頭動力が強い50未満であると考えられます.同時に,戦略は,看板と看板の飲み込み形状を入場信号として使用します.
ストップとストップの位置は,飲み込む形状のエンティティのサイズに応じて決定されます.ストップの位置は,飲み込むエンティティの2倍であり,最小のストップ幅は入場価格の0.3%で設定されます.ストップの距離が小さすぎることが頻繁にストップを引き起こすのを避けるため.ストップの位置は,ストップの幅が,事前に設定された減率で掛けられ,減率が固定されることを保証します.さらに,戦略は,トレンド条件のフィルタリングのオプションとしてMACDを提供します.
トレンドフォロー:複数の指標を組み合わせてトレンドを判断する戦略で,トレンドの形成の初期に介入し,トレンドの動きを捉えるのに役立ちます.
ダイナミックストップストップ:吸収形状の実体サイズに応じてストップストップの位置を調整し,トレンドが強ければストップスペースを拡大し,トレンドが弱ければストップ範囲を縮小し,ポジションを柔軟に制御する。
ユーザは取引方向,リスク好みなどのパラメータをカスタマイズして,異なるユーザのニーズに適合することができる.
MACDをトレンドフィルター条件として提供し,トレンドの強さをさらに確認し,入場勝利率を高めます.
傾向判断誤り:戦略は複数の指標の合同判断を採用しているが,ある状況では依然として傾向判断誤りが発生し,損失を招く可能性がある.
縮小幅度:小型の形状を吸収すると,止損と停止距離が非常に近くなり,損益比が悪化する.これは震動の状況でより一般的である.
パラメータ最適化:異なる基準,異なる周期下では,最適なパラメータは大きく異なる可能性があり,ユーザが継続的にデビューと最適化する必要がある.
傾向判断: 傾向判断の正確性を向上させるために,ブリン帯,平均方向指数 (ADX) など,より多くの傾向確認ツールを導入してみることができます.
ストップ・ストップの最適化:ATRなどの波動率に関連する指標の導入を考慮し,ストップ・ストップの距離を動的に調整し,幅の過小がもたらすリスクを軽減する.
ポジション管理:トレンドの強さや弱さ,アカウントの収益状況などに合わせてポジションのサイズを動的に調整し,トレンドが強く安定した収益時にポジションを拡大し,頻繁に取引がもたらすコストを削減します.
多周期,多品種共生: トレンドシグナルをクロサイクル,クロ品種で検証し,トレンド把握の勝率を高め,単一の標本または周期のリスクを分散させる.
このトレンドは,変動ポジショングリッド戦略に従ってトレンド状況で良好なパフォーマンスを発揮し,トレンドの方向と強さを複数の指標で共同判断し,ストップとポジションを動的に調整し,トレンドをよりよく把握し,過剰な利益を得ることができます. しかし,トレンドが不明瞭または頻繁に波動する状況では,この戦略は一般的にパフォーマンスを発揮します. したがって,この戦略を使用する際には,トレンドの品種の選択に重点的に注意し,状況の変化に合わせてパラメータを調整する必要があります.
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © niosupetranmartinez
//@version=5
strategy("Trend Follower Scalping Strategy", overlay=true, process_orders_on_close = true)
// Inputs
emaLen = input(200, 'EMA Length')
rsiLen = input(9, 'RSI Length')
trendDirection = input.string("Both", 'Trend Direction', options=["Long Only", "Short Only", "Both"])
risk_reward_ratio = input(2, 'Risk Reward Ratio')
useMacdFilter = input.bool(true, "Use MACD Filter")
macdTimeframe = input("5", "MACD Timeframe")
// EMA and RSI
ema200 = ta.ema(close, emaLen)
customRsi = ta.rsi(close, rsiLen)
// MACD Filter
[macdLine, signalLine, _] = request.security(syminfo.tickerid, macdTimeframe, ta.macd(close, 12, 26, 9))
// Majority Body Candle Identification Function
isMajorityBodyCandle(candleOpen, candleClose, high, low) =>
bodySize = math.abs(candleClose - candleOpen)
fullSize = high - low
bodySize / fullSize > 0.6
// Engulfing Patterns
isBullishEngulfing = close > open and close[1] < open[1] and (close - open) > (open[1] - close[1]) and isMajorityBodyCandle(open, close, high, low)
isBearishEngulfing = close < open and close[1] > open[1] and (open - close) > (close[1] - open[1]) and isMajorityBodyCandle(open, close, high, low)
// Entry Conditions with MACD Filter
longCondition = close > ema200 and customRsi > 50 and isBullishEngulfing and (not useMacdFilter or macdLine > signalLine)
shortCondition = close < ema200 and customRsi < 50 and isBearishEngulfing and (not useMacdFilter or macdLine < signalLine)
// Trade Execution
var float stopLossPrice = na
var float entryPrice = na
// Long Entry
if (longCondition and (trendDirection == "Long Only" or trendDirection == "Both"))
entryPrice := close
engulfingBodySize = math.abs(close - open)
minimumStopLoss = entryPrice * 0.997
calculatedStopLoss = entryPrice - (engulfingBodySize * 2)
stopLossPrice := calculatedStopLoss < minimumStopLoss ? calculatedStopLoss : minimumStopLoss
risk = entryPrice - stopLossPrice
takeProfitPrice = entryPrice + (risk_reward_ratio * risk)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop = stopLossPrice, limit = takeProfitPrice)
// Short Entry
if (shortCondition and (trendDirection == "Short Only" or trendDirection == "Both"))
entryPrice := close
engulfingBodySize = math.abs(open - close)
minimumStopLoss = entryPrice * 1.003
calculatedStopLoss = entryPrice + (engulfingBodySize * 2)
stopLossPrice := calculatedStopLoss > minimumStopLoss ? calculatedStopLoss : minimumStopLoss
risk = stopLossPrice - entryPrice
takeProfitPrice = entryPrice - (risk_reward_ratio * risk)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop = stopLossPrice, limit = takeProfitPrice)
// Plotting
plot(ema200, color=color.blue, linewidth=2, title="EMA 200")