OPEN-SOURCE SCRIPT

Limit Order + ATR Stop-Loss [TANHEF]

Cập nhật
This indicator enables interactive placement of limit or stop-limit orders with a trailing ATR stop-loss and optional profit target (with alerts). Refer to the images below for further clarification.

Why use a trailing stop-loss?
A trailing stop-loss serves as an exit strategy when price moves against you, while also allowing you to adjust the exit point further into profit when price moves favorably. The ATR (Average True Range), a reliable measure of volatility, acts as an effective risk management tool, functioning as a trailing stop-loss.

Indicator Explanation
  • Initial indicator placement: Select Long Limit or Long-Stop Limit order.
  • Change Entry Type: Switch between Long and Short within settings.
  • Modify entry price: Drag circle, adjust in settings, or re-add indicator to chart.
  • Optional Profit Target: Use Risk/Reward ratio or specify price.
  • Entry anticipation: Estimated ATR stop-loss and profit target as blue circles (fluctuates with volatility changes).
  • Entry triggered: Actual ATR stop-loss and profit target plotted.
  • Exit conditions: Stop-loss or profit target hit, exit entry.
  • Update Frequency: Continuously, Bar Open, or Bar Open on entry then continuously.
  • ATR Overlap: no entry occurs if the ATR overlaps with price (stop-loss 'hit' already on entry bar)
  • Table: Displays input settings selected.
  • Show Only On Ticker: Ability to hide indicator on other tickers.



Long Limit
ảnh chụp nhanh

Long Stop-Limit
ảnh chụp nhanh

Short Limit
ảnh chụp nhanh

Short Stop-Limit
ảnh chụp nhanh


Alerts
1. 'Check' alerts to use within indicator settings (entry, trailing stop hit, profit target hit, and failed entry).
2. Select 'Create Alert'
3. Set the condition to 'Limit Order + ATR Stop-Loss''
4. Select create.

Additional details can be added to the alert message using these words in between Curly (Brace) Brackets:
  • {{trail}} = ATR trailing stop-loss (price)
  • {{target}} = Price target (price)
  • {{type}} = Long or Short stop-loss (word)
  • {{traildistance}} = Trailing Distance (%)
  • {{targetdistance}} = Target Distance (%)
  • {{starttime}} = Start time of position (day:hr:min)
  • {{maxdrawdown}} = max loss
  • {{maxprofit}} = max profit
  • {{update}} = stoploss update frequency
  • {{entrysource}} = entry as 1st bar source (yes/no)
  • {{triggerentry}} = Wick/Close Trigger entry input
  • {{triggerexit}} = Wick/Close Trigger exit input
  • {{triggertarget}} = Wick/Close Trigger target input
  • {{atrlength}} = ATR length input
  • {{atrmultiplier}} = ATR multiplier input
  • {{atrtype}} = ATR type input
  • {{ticker}} = Ticker of chart (word)
  • {{exchange}} = Exchange of chart (word)
  • {{description}} = Description of ticker (words)
  • {{close}} = Bar close (price)
  • {{open}} = Bar open (price)
  • {{high}} = Bar high (price)
  • {{low}} = Bar low (price)
  • {{hl2}} = Bar HL2 (price)
  • {{volume}} = Bar volume (value)
  • {{time}} = Current time (day:hr:min)
  • {{interval}} = Chart timeframe
  • {{newline}} = New line for text
Phát hành các Ghi chú
Fixed label issue during active entry.
Phát hành các Ghi chú
Removed unnecessary moving average inputs.
Phát hành các Ghi chú
Alerts now function as intended.

Update Stop-Loss Frequency:
  • Always = update continuously. (Trailing)
  • Bar Open = update bar from prior close. (Trailing)
  • Entry Bar Open, then Always = update bar from prior close for entry bar, then every bar after updates continuously. (Trailing)
  • Never = static, not updated after entry open. (Non-Trailing)
ATRAverage True Range (ATR)interactivelimitlimitorderPortfolio managementpositionstoplimitstoplosstrailingtrailingstoplosswilder

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


tanhef.com/

Scripts and content from TanHef are solely for information and education. Past performance does not guarantee of future results.
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm