가격 마찰 구역에 기초한 전략을 따르는 경향

저자:차오장, 날짜: 2023-09-20 16:46:17
태그:

전반적인 설명

이 전략은 낮은 마찰 영역을 식별하기 위해 서로 다른 영역에서 가격 체류 시간을 측정하고 이러한 영역에서 브레이크오웃을 거래합니다. 트렌드 다음 전략에 속합니다.

전략 논리

  1. 지난 N 기간 동안 현재 수준에 대한 가격 유지 비율을 가격 마찰로 계산합니다.

  2. 가격이 최근 최소 유지 시간으로 낮은 마찰 구역으로 진입하는지 확인합니다.

  3. 최근 트렌드 방향을 결정하기 위해 빠르게 가중된 MA를 사용하십시오. 트렌드를 따라 낮은 마찰 영역에서 거래 브레이크.

  4. 가격이 높은 마찰 구역으로 다시 들어가게 되면 수익을 얻습니다.

  5. 마찰 룩백, 브레이크아웃 영역 등 등 사용자 정의 가능한 매개 변수

장점

  1. 가격 마찰은 다양한 시장을 피하고 트렌드 발발 지역을 찾습니다.

  2. 빠른 MA는 방향을 결정하기 위해 마찰과 결합합니다.

  3. 가격 마찰 수준을 보여주는 직관적인 영상.

  4. 암호화 고주파 거래에 최적화된 기본 매개 변수

  5. 단순하고 명확한 논리, 이해하기 쉽고 사용자 정의 할 수 있습니다.

위험성

  1. 가격 마찰은 미래의 움직임을 완전히 예측할 수 없습니다.

  2. 빠른 MA는 정확하지 않은 타이밍을 만들 수 있습니다.

  3. 비효율적인 거래의 진입과 출입

  4. 최적화는 너무 적합할 위험이 있습니다.

  5. 고정 매개 변수들은 변동성 있는 시장에서 실적이 떨어질 수 있습니다.

강화

  1. 가격 마찰을 계산하기 위해 다른 기간을 테스트합니다.

  2. 최근 경향을 결정하기 위해 다양한 MA 유형을 평가합니다.

  3. 더 높은 안정성을 위해 탈출 구역 매개 변수를 최적화하십시오.

  4. 스톱 로스를 추가하고 리스크 관리를 위해 수익을 취합니다.

  5. 변화하는 시장에 적응하기 위해 동적 매개 변수를 고려하십시오.

  6. 더 많은 기호와 시간 프레임에 대한 백테스트입니다.

결론

이 전략은 높은 확률의 브레이크아웃 잠재력을 가진 가격 마찰 구역을 거래하고 있으며 장단점이 있습니다. 동적 최적화 및 위험 관리와 같은 개선은 더 견고하고 효율적으로 만들 수 있습니다.


/*backtest
start: 2023-08-20 00:00:00
end: 2023-09-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
//made for 30m chart with BTCUSD or other cryptocurrency
strategy("LUBE",overlay=false )
friction=0.0
barsback=input(500,"bars back to measure friction",step=100)
flevel=input(50,"0-100 friction level to stop trade",step=2)
tlevel=input(-10,"pic lower than 0 to number selected above to initiate trade",step=2)
fl=flevel/100
tl=tlevel/100

for i = 1 to barsback
    friction := if high[i] >= close and low[i] <= close 
        friction+(1+barsback)/(i+barsback)
    else
        friction

range=input(100,"bars back to measure lowest friction",step=10)
lowf = lowest(friction,range)
highf = highest(friction,range)
midf = (lowf*(1-fl)+highf*fl)
lowf2 = (lowf*(1-tl)+highf*tl)
plot(friction)
m=plot(midf[5],color=color.red)
l=plot(lowf2[5],color=color.white)
h=plot(highf[5],color=color.white)
fill(l,h,color.white)

src = input(title="Source", type=input.source, defval=close)

//FIR Filter
_fir(src) =>
    (4 * src + 3 * nz(src[1]) + 2 * nz(src[2]) + nz(src[3])) / 10

fir = _fir(src)

trend =  fir > fir[1]? 1:-1

//bgcolor(trend==1?color.lime:color.red,transp=50)

long=friction<lowf2[5] and trend == 1
short=friction<lowf2[5] and trend == -1
end=friction > midf[5]

keeplong=0
keeplong:=long?1:nz(keeplong[1])
keeplong:=short or end?0:keeplong

keepshort=0
keepshort:=short?1:nz(keepshort[1])
keepshort:=long or end?0:keepshort

bgcolor(keeplong==1?color.lime:keepshort==1?color.red:na,transp=50)

leverage=input(2,"leverage",step=.5)
enableshort=input(true,"enable shorts?")

barcount=0
barcount:=nz(barcount[1])+1

contracts=min(max(.000001,(strategy.equity/close)*leverage),50000)
strategy.entry("Long",strategy.long,when=long and barcount>20, qty=contracts)

strategy.close("Long",when=short or end )

strategy.entry("Short",strategy.short,when=short and enableshort==true and barcount>20, qty=contracts)

strategy.close("Short",when=(long or end) and enableshort==true)

alertcondition(keeplong==1 and keeplong[1]==0,"LONG")
alertcondition(keepshort==1 and keepshort[1]==0,"SHORT")
alertcondition((keeplong[1]==1 or keepshort[1]==1) and (keeplong==0 and keepshort==0),"CLOSE TRADE")


더 많은