- 사각형
- 알파 트렌드 사용
알파 트렌드 사용
저자:
발명가 양자화2022-04-28 17:53:04
태그:
ATR
/*backtest
start: 2021-05-05 00:00:00
end: 2022-05-04 23:59:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Bitfinex","currency":"BTC_USD"}]
*/
indicator('AlphaTrend', shorttitle='AT', overlay=true)
coeff = input.float(5, 'Multiplier')
AP = input(14, 'Common Period')
ATR = ta.sma(ta.tr, AP)
src = input.source(close, "source")
upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := ta.mfi(hlc3, 14) >= 50 ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT
plot(AlphaTrend)
if ta.crossover(low, AlphaTrend)
strategy.entry("BUY", strategy.long)
else if ta.crossunder(high, AlphaTrend)
strategy.entry("SELL", strategy.short, when=ta.crossunder(high, AlphaTrend))
관련
더 많은