가격량 트렌드 전략

저자:차오장, 날짜: 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())








더 많은