OPEN-SOURCE SCRIPT
已更新 Avg High/Low Lines with TP & SL

아래 코드는 TradingView Pine Script v6으로 작성된 스크립트로, 주어진 캔들 수 동안의 평균 고가와 저가를 계산해서 그 위에 수평선을 그리며, 해당 수평선 돌파 시 진입 가격을 기록하고, 손절가(SL)와 목표가(TP)를 자동으로 계산하여 표시하는 전략입니다. 알림(alert) 기능도 포함되어 있습니다.
코드 주요 기능 요약
length 기간 동안 평균 고가, 저가를 단순 이동평균(SMA)으로 계산
평균 고가선, 저가선 수평선을 일정 바 개수만큼 좌우 연장하여 차트에 표시
평균 고가 돌파 시 매수 진입, 평균 저가 돌파 시 매도 진입 처리
진입 가격 저장 및 상태 관리 (inLong, inShort 플래그)
손절가(SL): 롱이면 평균 저가, 숏이면 평균 고가
목표가(TP): 진입가에서 손절 거리의 1.5배만큼 설정
진입가 기준으로 TP, SL 라인과 라벨 표시
상단 돌파 후 종가 마감 시 매수 알림, 하단 돌파 후 종가 마감 시 매도 알림
Sure! Here’s the English explanation of your TradingView Pine Script v6 code:
Summary of Key Features
Calculates the simple moving average (SMA) of the high and low prices over a user-defined number of candles (length).
Draws horizontal lines for the average high and average low, extending them a specified number of bars to the left and right on the chart.
Detects breakouts above the average high to trigger a long entry, and breakouts below the average low to trigger a short entry.
Records the entry price and manages trade states using flags (inLong, inShort).
Sets the stop loss (SL) at the average low for long positions, and at the average high for short positions.
Calculates the take profit (TP) level based on the entry price plus 1.5 times the stop loss distance.
Draws lines and labels for the TP and SL levels starting from the entry bar, extended to the right.
Sends alerts when the price closes above the average high after a breakout (long signal), or closes below the average low after a breakout (short signal).
-onestar-
코드 주요 기능 요약
length 기간 동안 평균 고가, 저가를 단순 이동평균(SMA)으로 계산
평균 고가선, 저가선 수평선을 일정 바 개수만큼 좌우 연장하여 차트에 표시
평균 고가 돌파 시 매수 진입, 평균 저가 돌파 시 매도 진입 처리
진입 가격 저장 및 상태 관리 (inLong, inShort 플래그)
손절가(SL): 롱이면 평균 저가, 숏이면 평균 고가
목표가(TP): 진입가에서 손절 거리의 1.5배만큼 설정
진입가 기준으로 TP, SL 라인과 라벨 표시
상단 돌파 후 종가 마감 시 매수 알림, 하단 돌파 후 종가 마감 시 매도 알림
Sure! Here’s the English explanation of your TradingView Pine Script v6 code:
Summary of Key Features
Calculates the simple moving average (SMA) of the high and low prices over a user-defined number of candles (length).
Draws horizontal lines for the average high and average low, extending them a specified number of bars to the left and right on the chart.
Detects breakouts above the average high to trigger a long entry, and breakouts below the average low to trigger a short entry.
Records the entry price and manages trade states using flags (inLong, inShort).
Sets the stop loss (SL) at the average low for long positions, and at the average high for short positions.
Calculates the take profit (TP) level based on the entry price plus 1.5 times the stop loss distance.
Draws lines and labels for the TP and SL levels starting from the entry bar, extended to the right.
Sends alerts when the price closes above the average high after a breakout (long signal), or closes below the average low after a breakout (short signal).
-onestar-
發行說明
Hello,According to TradingView's current policy, once a script has been published publicly, it cannot be changed to Private or Invite-only.
Therefore, if you'd like to change the code visibility or access permissions, you must either delete the original post (within 15 minutes of publishing) or create a new script and publish it as Private or Invite-only.
If you require access to the private version of this script, please follow the instructions below:
This script will no longer be updated.
Future updates and code access may be provided upon request or via invite-only access.
For more details about TradingView's script visibility policies, please refer to their official documentation.
Thank you.
發行說明
"This script has an error. Sorry."If you want a slightly more natural phrasing depending on context, you could say:
"This script contains errors. Sorry about that."
"There is an error in this script. Apologies."
"This script is erroneous. Sorry."
Let me know if you want a more formal or casual tone!
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。