
La estrategia utiliza la línea horizontal como soporte y resistencia, y genera una señal de negociación cuando el precio rompe la línea horizontal. La idea principal es: primero, trazar la línea horizontal de acuerdo con ciertas condiciones, hacer más cuando el precio rompe la línea horizontal hacia arriba, y cerrar la posición cuando el precio rompe la línea horizontal hacia abajo.
La estrategia utiliza la línea horizontal como un importante punto de resistencia de soporte, generando señales de negociación mediante la ruptura de la línea horizontal. La ventaja es que la lógica es simple, fácil de implementar y puede capturar mejor la tendencia. Sin embargo, la desventaja es que es posible comerciar en exceso, generar señales erróneas y solo puede hacer más para no quedarse vacío.
/*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ı")