価格量動向戦略

作者: リン・ハーンチャオチャン, 日時: 2023-12-25 13:09:48
タグ:

img

概要

この戦略は,短期間の価格動向を追跡し,買取・売却取引の市場動向方向を決定するためにモメンタム指標を使用する.戦略名"価格量動向戦略"は,傾向を判断するために価格変化と量変化を使用するというアイデアを反映している.

原則

この戦略は,まず価格の勢いを計算する.現在の期間の価格と前の期間の価格の差を計算することによって,最新の期間の価格の絶対変化を反映することができる. ポジティブな値は価格上昇を示し,負の値は価格減少を示します. その後,この差値の移動平均は,平均の勢い指標を得るためのフィルタリングのために計算されます.

最新価格が平均モメンタムより大きいとき,価格は上昇していることを示します. 最新価格が平均モメンタムより低いとき,価格は下がっていることを示します. この指標に基づいて価格傾向の方向性を決定します. ボリューム増幅フィルタリングと組み合わせると,実際の取引では比較的大きな取引量を持つ信号のみが選択されます.

価格上昇と下落の傾向が確認され,それに応じた買取・売却が行われます.

利点分析

  • 戦略は,短期間の取引に適した短期間の価格動向を迅速に捉えることができます.
  • ボリュームフィルタリングによって偽のブレイクによって誤導されるのを避ける
  • 追いかけるのが上昇し,殺すのが落ちるという操作論理を実装しました
  • 積極的な投資家に適した高い取引頻度

リスク分析

  • 異常な市場変動の影響に脆弱で,特定の誤った信号リスクがある
  • 取引頻度が高いため,リスクが下がる
  • 中期と長期の傾向を見逃す可能性があり,長期の収益性を確認する必要がある

オプティマイゼーションの方向性

  • 判断効果を最適化するためにモメント指標のパラメータを調整
  • 音量フィルタリングパラメータを最適化して信号品質を向上させる
  • 単一の損失を制御するためのストップ・ロスのメカニズムを増やす
  • 複数の要因を考慮して

結論

戦略全体では,モメンタム指標を通じて短期的な価格変動傾向を追跡し,エントリーと出口のタイミングを迅速に決定する.利点としては,高速な操作,上昇を追いかける,落ちる殺す.欠点は,信号品質と長期的収益性である.パラメータ調整と強化されたリスク管理メカニズムを通じて,戦略は他の低周波戦略と組み合わせて,高周波戦略の重要な構成要素になることができます.


/*backtest
start: 2022-12-18 00:00:00
end: 2023-12-24 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/
// © russtic

//@version=2

strategy("HA smoothed eliminator v2  ",pyramiding=1, slippage=10, default_qty_type=strategy.percent_of_equity, 
     commission_type=strategy.commission.percent, commission_value=0.075, overlay=true, 
     default_qty_value=100, initial_capital=1000)

FromMonth1 = input(defval=1, title="From Month", minval=1, maxval=12)
FromDay1 = input(defval=1, title="From Day", minval=1, maxval=31)
FromYear1 = input(defval=2019, title="From Year", minval=2010)
ToMonth1 = input(defval=12, title="To Month", minval=1, maxval=12)
ToDay1 = input(defval=31, title="To Day", minval=1, maxval=31)
ToYear1 = input(defval=2020, title="To Year", minval=2010)
start1 = timestamp(FromYear1, FromMonth1, FromDay1, 00, 00)
finish1 = timestamp(ToYear1, ToMonth1, ToDay1, 23, 59)
window1() => true
    
t1 = time(timeframe.period, "0300-1200")
t2 = time(timeframe.period, "0930-1700")
London = na(t1) ? na : green
NY = na(t2) ? na : red

bgcolor(London, title="London")
bgcolor(NY, title="New York")
///////////////////////////
// HA smoothed

len=(1 )
o=ema(open,len)
c=ema(close,len)
h=ema(high,len)
l=ema(low,len)

haclose = (o+h+l+c)/4
haopen = na(haopen[1]) ? (o + c)/2 : (haopen[1] + haclose[1]) / 2
hahigh = max (h, max(haopen,haclose))
halow = min (l, min(haopen,haclose))

len2=(len)
o2=ema(haopen, len2)
c2=ema(haclose, len2)
h2=ema(hahigh, len2)
l2=ema(halow, len2)

buy= (o2<c2) 

closebuy= (o2>c2)

sell= (o2>c2)

closesell= (o2<c2)

//
/// END NEW SCRIPT 

//
//
//                  MERGE SCRIPTS
a1= o2<c2
b1=o2>c2
is_uptrend = (a1)// and (p> 0)
is_downtrend =  (b1)// and (p <0)
barcolor(b1 ? red: a1 ? lime : blue)

//end


// =========================start     PVT -GIVES EACH BAR A VALUE
facton = (true)//, title="arrow elimination (factor) on ")
Length1 = 2//input(2, title="PVT Length", minval=1)

xPrice = close//input(title="Source", type=source, defval=close)
xsma = wma(xPrice, Length1) 
nRes = xPrice - xsma  
pos = iff(nRes > 0, 1,
	     iff(nRes < 0, -1, nz(pos[1], 0))) 
forex= input(true, title = 'strength toggle ')
forexyes = (forex == true)? 10000 : (forex == false)? 1: na

plot(nRes*forexyes , color=aqua, title="strength", transp=100)
// =========================         end pvt
//
//=============================     start factor // ELIMINATES  weak signals
//                  start trend
//
factor = input(600.00, title = "strength elimination") 
factor1 = factor - (factor*2)//input(-100.00, title = "sell strength elimination ") 
facton1 = (facton == true) and is_uptrend == 1 and nRes*forexyes>factor ? 1 : (facton == true) and is_downtrend == 1 and nRes*forexyes<factor1 ? -1 : (facton == false)
// ==================== =====
// 
//===========================    end factor
nRestrend = (nRes*forexyes)
//=========================== plot arrows 
plot1 = iff(is_uptrend[1] == 1, 0 , 1)  
plot2 = iff(is_downtrend[1]  == 1, 0 , 1)
uparrowcond =  is_downtrend ? false : nz(uparrowcond[1], false) == true ? uparrowcond[1] : (facton1 and is_uptrend and nRes*forexyes>factor)
downarrowcond =  is_uptrend ? false : nz(downarrowcond[1], false) == true ? downarrowcond[1] : (facton1 and is_downtrend and nRes*forexyes<factor1)
//prevarrowstate = uparrowcond  ? 1 : downarrowcond ? -1 : nz(prevarrowstate[1], 0)


candledir = (open < close)? 1: (open>close)? -1 : na // ONLY OPENS ON SAME BAR DIRECTION AS SIGNAL



up=nz(uparrowcond[1], false) == false and ( is_uptrend and nRes*forexyes>factor) and candledir ? 1:na
dn=nz(downarrowcond[1], false) == false and ( is_downtrend and nRes*forexyes<factor1) and candledir? -1:na



sig=0
if up==1 
    sig:=1
else
    if dn==-1
        sig:=-1
    else
        sig:=sig[1]
plotarrow(sig[1]!=1 and sig==1?1:na, title="BUY ARROW", colorup=lime, maxheight=80, minheight=50, transp=0)// up arrow 
plotarrow(sig[1]!=-1 and sig==-1?-1:na, title="SELL ARROW", colordown=red, maxheight=80, minheight=50, transp=0)// down arrow

//========================= alert condition
alertcondition(sig[1]!=1 and sig==1?1:na, title="BUY eliminator", message="BUY " ) 
alertcondition(sig[1]!=-1 and sig==-1?-1:na, title="SELL eliminator",  message="SELL ") 


strategy.entry("B", true, when=(sig[1]!=1 and sig==1?1:na) and window1())
strategy.entry("S", false,when=(sig[1]!=-1 and sig==-1?-1:na) and window1())








もっと