
Chiến lược này sử dụng đường ngang làm mức hỗ trợ và mức kháng cự, tạo ra tín hiệu giao dịch khi giá vượt qua đường ngang. Ý tưởng chính là: Đầu tiên vẽ đường ngang theo một số điều kiện, làm nhiều hơn khi giá vượt qua đường ngang lên, khi giá vượt qua đường ngang xuống.
Chiến lược này sử dụng đường ngang làm mức kháng cự hỗ trợ quan trọng, tạo tín hiệu giao dịch bằng cách phá vỡ đường ngang. Ưu điểm là logic đơn giản, dễ thực hiện, có thể nắm bắt xu hướng tốt hơn. Tuy nhiên, nhược điểm là có thể giao dịch quá mức, tạo ra tín hiệu sai, và chỉ có thể làm nhiều hơn không thể trống.
/*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ı")