勢い 突破 シルバーライン戦略

作者: リン・ハーンチャオチャン開催日:2024年2月1日15時01分55秒
タグ:

img

概要

この戦略は,価格動向指標MACDと移動平均をベースとしたブレイクアウト戦略で,銀 (XAG/USD,XAG/EUR) の1時間の時間枠に適しています.鍵は,価格動向と動向指標を組み合わせてトレンド逆転のタイミングを決定することです.

戦略の論理

MACDヒストグラムがマイナスから正に変化し,シグナルラインを継続的に突破すると,短期上向き傾向がより強いことを示します.同時に,閉値が移動平均の上昇傾向を突破した場合,それは長い信号を生成します.同様に,MACDヒストグラムがポジティブからマイナスに変化し,信号ラインを下回り,閉値が移動平均の下向き傾向を下回ると,それはショート信号を生成します.

具体的には,この戦略のロングエントリー信号を決定するための条件は以下のとおりです.

  1. MACDヒストグラムは正です.
  2. 現在のヒストグラムバーは,前のものより高い.
  3. 閉じる価格は移動平均値より高い
  4. 閉じる価格は最近の3Kラインの最高値より高い.

短距離信号を決定する条件は正反対です

ポジションが開かれたら,次のKラインが閉じる時に無条件に閉じる.この戦略は,トレンドブレイクの出発点を捕捉することを目的として,利益を取ったりストップ損失を設定したりしない.

利点分析

この戦略は,トレンド逆転のタイミングをより正確に決定するために,価格とモメント指標を組み合わせ,より高い勝ち率を設定する.次のKラインで無条件で閉じる方法は,逆転が失敗した後,再び損失を効果的に回避することができます.

利回りやストップロスの設定は 高利回りを求める投資家のニーズを満たさない.

リスク分析

ストップ・ロスの欠如は,簡単に損失固定と損失のリスクの増加につながります.逆転信号が失敗した場合,損失を間に合わずに停止することができないため,損失が増加する可能性があります.

次のK線で無条件に閉じる方法により,トレンド利益を継続的に把握することは困難です.

最適化 の 提案

損失リスクを減らすために,高利益の突破買いに基づいて適切なストップ損失戦略を追加することを検討することが可能です.

また,先端技術を使って 閉店後にポジションを再開し,トレンド利益を引き継ぐことも可能です.

概要

一般的には,この戦略は積極的な高リスク戦略に属します.ストップ損失設定がないため,投資家は損失のリスクが大きいことを負わなければなりません.しかし,逆転が成功した場合,最初の位置で完全なロットでポジションを開く機会も高いリターンをもたらします.比較的強い心理的な耐久性を持つ積極的な投資家に適しています.


/*backtest
start: 2023-01-31 00:00:00
end: 2024-01-13 05:20: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/
// © SoftKill21

//@version=4
strategy("XAG strategy 1h",overlay=true)
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
var gica = 0
var marcel = gica+2
 //monday and session 
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)

startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
len = input(10, minval=1, title="Length")
src = input(close, title="Source")
out = sma(src, len)

//distanta = input(1.004)

fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)
// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00
// Calculating
fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)
slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal

option1=input(true)
option2=input(true)

long2 =  close > open  and time_cond and close > out and hist > 0 and hist > hist[1] 
short2 =  close < open  and time_cond and close < out and hist < 0 and hist < hist[1] 

long1 = (close > open ) and time_cond and close > out and hist > 0 and  hist > hist[1] and high > high[1] and high[1] > high[2] and close > high[1] and close > high[2] and close > high[3] 
short1 = (close < open)  and time_cond and close < out and hist < 0 and  hist < hist[1] and low < low[1] and low[1] < low[2]  and close < low[1] and close < low[2] and close < low[3] 

if(option1)
    strategy.entry("long",1,when= short1)
    strategy.entry("short",0,when=long1)
    strategy.close_all()

if(option2)

    strategy.entry("long",1,when= short2)
    strategy.entry("short",0,when=long2)
    strategy.close_all()

// if(strategy.openprofit < 0)
//     strategy.close_all()
// if(strategy.openprofit>0)
//     strategy.close("long",when = close < open )
//     strategy.close("short",when = close > open)
//     strategy.close("long",when= close < open)
//     strategy.close("short",when= close> open)


// tp = input(0.0003)
// sl = input(0.005)
// strategy.exit("closelong", "long" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closelong")
// strategy.exit("closeshort", "short" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closeshort")


もっと