
이 전략은 수평선을 지지점과 저항점으로 사용하며, 가격이 수평선을 돌파할 때 거래 신호를 발생시킨다. 주요 아이디어는 다음과 같다. 우선, 특정 조건에 따라 수평선을 그리고, 가격이 수평선을 상향으로 돌파할 때 더 많이 하고, 가격이 수평선을 하향으로 돌파할 때 평소한다. 동시에 수평선의 생성은 또한 상응하는 조건이 있다.
이 전략은 수평선을 중요한 지지 저항점으로 삼고, 수평선을 뚫고 거래 신호를 생성한다. 장점은 논리적으로 간단하고, 구현하기 쉽고, 트렌드를 더 잘 포착할 수 있다는 것이다. 하지만 단점은 과도하게 거래되어 잘못된 신호를 생성할 수 있으며, 더 많은 것을 할 수 밖에 없다는 것이다. 이후에는 다른 지표와 결합하여 거래 빈도를 줄이고, 공백 메커니즘과 동적 조정 매개 변수를 추가하는 등의 측면에서 최적화 및 개선을 할 수 있다.
/*backtest
start: 2023-04-20 00:00:00
end: 2024-04-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Traderxprox
//@version=5
strategy("Alarm Trader_ALL", overlay=true)
// Yatay çizgi oluşum
yatayc = low[1] > close[0]
if yatayc
if strategy.opentrades > 0
strategy.close("AL", comment = "Fiyat:" + str.tostring(low[1], "#.##") + "\n" + timeframe.period +"\n Yatay Direnç Oluştu")
else
strategy.entry("AL", strategy.long, comment = "Fiyat:" + str.tostring(low[1], "#.##") + "\n" + timeframe.period +"\n Yatay Direnç Oluştu")
//YATAY ÇİZGİ
int cizgilen = input.int(20, "Çizgi uzunluğu?", group = "Yatay Çizgi Ayarları")
var array<line> lines = array.new<line>()
int numberOfLines = input.int(10, "Son Kaç Çizgi?", 0, group = "Yatay Çizgi Ayarları")
kural22 = low[1] > close[0]
// if kural22
// newLine = line.new(bar_index-2, low[1], bar_index+cizgilen, low[1] ,color=color.red, width=1, style=line.style_solid)
// // Push the `newLine` into the `lines` array.
// lines.push(newLine)
// // Delete the oldest line when the size of the array exceeds the specified `numberOfLines`.
// if array.size(lines) > numberOfLines
// line.delete(lines.shift())
// Alarm kırılım için koşul
var float lastLinePrice = na
if not na(close) and array.size(lines) > 0
lastLinePrice := line.get_price(array.get(lines, array.size(lines) - 1), bar_index)
if open < lastLinePrice and close > lastLinePrice
if strategy.opentrades > 0
strategy.close("AL", comment = "Fiyat:" + str.tostring(lastLinePrice, "#.##") + "\n" + timeframe.period +" \n Yatay çizgi yukarı kırılımı")
else
strategy.entry("AL", strategy.long, comment = "Fiyat:" + str.tostring(lastLinePrice, "#.##") + "\n" + timeframe.period +" \n Yatay çizgi yukarı kırılımı")