
중심을 측정하는 거래 전략은 이동 평균을 기반으로 한 거래 전략이다. 그것은 가격의 중심을 계산하고, 즉 중심을 위치하고, 가격 통로를 구성하여 자산의 가격에 대한 통로로 만든다. 이 전략은 입력 설정에서 더 많은 것을 변경할 수 있습니다.
이 전략은 선형 회귀 함수를 통해 중심 위치를 계산한다. 구체적으로, 길이가 Length 사이클의 종결 가격의 선형 회귀 값을 계산한다. 즉, 가격 의 중심 이다. 그리고 이 기초에서 상향과 하향으로 이동하는 Percent%를 사용하여 가격 채널을 구성한다. 가격 채널 상의 하위 경계선은 각각 더 많은 것과 더 적은 신호로 작용한다. 가격이 궤도를 돌파 할 때, 더 많은 것을하고, 가격이 궤도를 벗어나면, 더 많은 것을한다.
이것은 매우 간단한 돌파구 전략으로 다음과 같은 장점이 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
Bands, Length 등과 같은 파라미터를 조정하여 위험을 제어할 수 있다. 또한 최대 손실을 제한하기 위해 스톱로스를 설정할 수 있다.
이 전략은 더욱 개선될 수 있습니다.
중점 리테크 거래 전략은 간단한 돌파구 전략이다. 그것은 명확한 생각, 강한 실전성, 유연한 파라미터 설정을 가지고 있다. 동시에 특정 위험도 존재하며 적절한 최적화 제어가 필요합니다. 이 전략은 기본 전략으로 실전 및 최적화를 위해 적합하며 초보자 학습에도 적합하다.
/*backtest
start: 2023-11-11 00:00:00
end: 2023-12-11 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 15/03/2018
// The indicator is based on moving averages. On the basis of these, the
// "center" of the price is calculated, and price channels are also constructed,
// which act as corridors for the asset quotations.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Center Of Gravity Backtest", shorttitle="CFO", overlay = true)
Length = input(20, minval=1)
m = input(5, minval=0)
Percent = input(1, minval=0)
SignalLine = input(1, minval=1, maxval = 2, title = "Trade from line (1 or 2)")
reverse = input(false, title="Trade reverse")
xLG = linreg(close, Length, m)
xLG1r = xLG + ((close * Percent) / 100)
xLG1s = xLG - ((close * Percent) / 100)
xLG2r = xLG + ((close * Percent) / 100) * 2
xLG2s = xLG - ((close * Percent) / 100) * 2
xSignalR = iff(SignalLine == 1, xLG1r, xLG2r)
xSignalS = iff(SignalLine == 1, xLG1s, xLG2s)
pos = iff(close > xSignalR, 1,
iff(close < xSignalS, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xLG, color=blue, title="CFO")
plot(xLG1r, color=green, title="LG1r")
plot(xLG2r, color=green, title="LG2r")
plot(xLG1s, color=red, title="LG1s")
plot(xLG2s, color=red, title="LG2s")