
이 전략은 평행선을 기반으로 한 추적 전략이다. 그것은 평행선의 방향과 촛불의 그림자선을 사용하여 가격의 경향과 강도를 판단하여 입지와 출구를 결정한다. 핵심 논리는 두 번째 평행선의 색이 바뀌면 상위 / 공백을 하고, 세 번째 평행선의 강력한 신호를 사용하여 최대 5 번까지 더하기 위해.
전략은 Heikin Ashi 평균선을 사용하여 추세를 판단합니다. 구체적으로, 전략은 3개의 평균선을 정의합니다.
AddEntry 논리:
출구 논리:
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
스톱로스, 리저지 조정, 파라미터 최적화를 통해 위험을 제어할 수 있다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
이 전략은 전체적으로 양평선 방향에 기반한 추적 전략이다. 이 전략은 트렌드 판단과 돌파 판단의 장점을 결합하고, 부가가치를 확대하여 이익을 얻는다. 그러나 또한 위험을 통제하고, 적절한 변수를 조정하는 데 주의를 기울여야 한다. 향후에는 스톱로스 최적화, 변수 조정 등의 측면에서 개선할 수 있다.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("平均K腳本交易策略", overlay=true)
// 定義 Heikin Ashi 指標
ha_open = security(heikinashi(syminfo.tickerid), "60", open)
ha_high = security(heikinashi(syminfo.tickerid), "60", high)
ha_low = security(heikinashi(syminfo.tickerid), "60", low)
ha_close = security(heikinashi(syminfo.tickerid), "60", close)
// 確定 Heikin Ashi 指標的顏色
isGreen = ha_open < ha_close
// 定義加碼次數
var int add_on_buy = 10
var int add_on_sell = 10
// 定義進場和出場條件
long_condition = crossover(ha_close, ha_open) and isGreen and ha_low == ha_open
short_condition = crossunder(ha_close, ha_open) and not isGreen and ha_high == ha_open
exit_condition = crossover(ha_open, ha_close) or crossunder(ha_open, ha_close)
// 如果條件符合,進行進場和出場操作
if (long_condition)
strategy.entry("Buy", strategy.long)
if (short_condition)
strategy.entry("Sell", strategy.short)
if (exit_condition)
strategy.close("Buy")
strategy.close("Sell")
// 繪製 Heikin Ashi 蠟燭圖
plotcandle(iff(ha_open < ha_close, ha_open, na), ha_high, ha_low, ha_close, title='Green Candles', color=#53b987, wickcolor=#53b987, bordercolor=#53b987)
plotcandle(iff(ha_open >= ha_close, ha_open, na), ha_high, ha_low, ha_close, title='Red Candles', color=#eb4d5c, wickcolor=#eb4d5c, bordercolor=#eb4d5c)