MA クロスオーバー

作者: リン・ハーンチャオチャン, 日時: 2023-09-04 15:55:46
タグ:

MAクロスオーバー戦略は,移動平均クロスオーバーを使用して取引機会を特定する技術的な取引戦略である.この戦略は,日々のタイムフレームで使用するように設計されており,ロングおよびショートポジションの両方を取引するために使用することができる.

この戦略は,高速移動平均と遅移動平均の間のクロスオーバーを特定することによって機能する.高速移動平均がスロー移動平均を超えると,購入信号が生成される.高速移動平均がスロー移動平均を下回ると,販売信号が生成される.

MAのクロスオーバー戦略は,比較的使いやすい戦略ですが,非常に効果的です.この戦略は,健全な技術的原則に基づいています.

以下は,MAクロスオーバー戦略の利用の利点の一部です.

簡単な戦略で,あらゆる経験レベルのトレーダーが利用できます. 健全な技術原理に基づいているので 成功する可能性が高いのです トレンドをフォローする戦略です つまりトレーダーはトレンドをフォローするのに役立ちます ロング・ショート・ポジションの両方を取引するために使用でき,汎用的な戦略です. MAのクロスオーバー戦略の使用に関連するリスクは以下の通りです.

この戦略は,過去の価格データに基づいているため,将来的に利益を得られる保証はない. この戦略は,両方向に急激に動いている場合です. 戦略は不安定で,大きな損失のリスクがある. MAクロスオーバー戦略は,すべての経験レベルのトレーダーが使用できる比較的シンプルで効果的な取引戦略です.しかし,どの取引戦略も利益をもたらすことは保証されないことを覚えておくことは重要です.そして,トレーダーはいつでもいかなる取引戦略も使用する際に注意を払うべきです.

MA クロスオーバー戦略を使用する際には注意すべき事項は以下の通りです.

移動平均の長さは,あなたの取引スタイルとリスク耐性に合わせて調整できます. さらに複雑な戦略を作成するために複数の移動平均値を使用することもできます リアルタイム取引に使用する前に,戦略が収益性のあることを確認するために,過去のデータでバックテストすることが重要です. ストップロスを使って 損失を制限してください この 記事 が 役立ち,情報 を 提供 し て くれ た と 期待 し て い ます.さらに 疑問 が ある なら,気軽 に 尋ね て ください.


/*backtest
start: 2022-08-28 00:00:00
end: 2023-02-10 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":10000}]
*/

//@version=5
strategy("EMA-Cross-JC Intraday with Trailing SL", overlay=true)

// emabasel = input(100, "Base Length")
emaslen = input(15, "Slow Length")
emaflen = input(9, "Fast Length")
intra =input(true, title = "Intraday?")
sq_time_hr = input(15, title="Exit Hr")
sq_time_min = input(20, title="Exit Min")

emaslow = ta.ema(close, emaslen)
emafast = ta.ema(close, emaflen)
// emabase = ta.ema(close, emabasel)

emaup = ta.crossover(emafast, emaslow)
emadown = ta.crossunder(emafast, emaslow)

tsival = ta.tsi(close, 13, 55)

plot(emaslow, title="Slow EMA", color=color.yellow, linewidth=1)
plot(emafast, title="Fast EMA", color=color.green, linewidth=1)
// plot(emabase, title="Base EMA", color=color.white, linewidth=3)

takeProfitPoints = input(200, title="Take Profit")
// tp_off = input(4000, title="Keep trailing")
stopLossPoints = input(100, title="Stop Loss")

// Define the time to square off positions
squareOffTime = timestamp(year, month, dayofmonth, sq_time_hr, sq_time_min)

var float trailingStop = na

if emaup and barstate.isconfirmed and time < squareOffTime //and tsival >=0
    strategy.entry("Buy", strategy.long)
    strategy.exit("Sell", "Buy", stop=close - stopLossPoints, limit=close + takeProfitPoints)
    // trailingStop := emabase - stopLossPoints
    strategy.exit("Trailing Stop", "Buy", stop=trailingStop)

if emadown and barstate.isconfirmed and time < squareOffTime //and tsival <=0
    strategy.entry("Sell", strategy.short)
    strategy.exit("Cover", "Sell", stop=close + stopLossPoints, limit=close - takeProfitPoints)
    // trailingStop := emabase + stopLossPoints
    strategy.exit("Trailing Stop", "Sell", stop=trailingStop)

// Close any open positions before the end of the trading day
if ta.barssince(strategy.opentrades) == 0 and time >= squareOffTime and intra == true
    strategy.close_all()

// plot(tsival, title = "TSI Value")
plotshape(emaup and barstate.isconfirmed, title="Crossover", style = shape.triangleup , size=size.small,color = color.green, location = location.belowbar)
plotshape(emadown and barstate.isconfirmed, title="Crossunder",style = shape.triangledown, size=size.small,color = color.red, location = location.abovebar)


もっと