SimpleCryptoLife

TrailingStops

SimpleCryptoLife Cập nhật   
Library "TrailingStops"
This library contains functions to output trailing stop lines.

f_marketStructureStop(_restartMode, _flipMode, _restartLowIn, _restartHighIn)
  Parameters:
    _restartMode - Defines how the stop lines persist. Allowed values are:
  • "Always On" - The stop lines are always present and they just reset when they're crossed.
  • "Flip" - The stop lines flip when they're crossed.
  • "Manual" - The stop lines turn off when they're crossed, and turn back on again when _restartLowIn or _restartHighIn are passed into the function as true.
    _flipMode - Defines whether the stop lines are broken by wicks or closes. Allowed values are "Wick", and "Close".
    _restartLowIn - If _restartMode is "Manual", passing this parameter as true restarts the Low stop line.
    _restartHighIn - If _restartMode is "Manual", passing this parameter as true restarts the High stop line.
@returns - floats for the Low and High stop line.
Phát hành các Ghi chú:
v2

Updated:
f_marketStructureStop(_restartMode, _flipMode, _restartLowIn, _restartHighIn, _strictMode)
New parameter:
    _strictMode - If false, this library uses Enhanced Simple Highs/Lows from the MarketStructure library. If true, it uses True Highs/Lows.

Also added some explanation about the behaviour of the stop lines if you choose the Flip and Close options. In this case, the stop line that's displayed can regress on a wick, but the underlying value for flipping does not regress. This is by design and is not a bug. The function doesn't know when you might take a position in either direction. If you choose to take a long when the long stop line has been pierced by a wick but not a close, it will display the appropriate value for a stop on that bar, which is the bar's Low.
Phát hành các Ghi chú:
v3
Fixed default value for restartMode
Phát hành các Ghi chú:
v4

New function:
@function f_complexStop - Outputs a stop line using more complex criteria than f_marketStructureStop, but still based on market structure generated by Local Lows and Highs. This is NOT a market structure indicator (for that, I've written a free, open-source indicator, and you could easily construct one yourself using my MarketStructure library). This function gives intuitive, rule-based places to put a stop loss; that's all.
@param float _high - Defaults to the High of the current chart bar. Included for HTF compatibility.
@param float _low - Defaults to the Low of the current chart bar. Included for HTF compatibility.
@param float _close - Defaults to the Close of the current chart bar. Included for HTF compatibility.
@param string _flipMode="Wick" - Defines whether the stop lines are broken by wicks or closes. Allowed values are "Wick", and "Close". If you choose "Close", the stop line that's displayed can regress on a wick, but the underlying value for flipping does not regress. This is by design and is not a bug. The function doesn't know when you might take a position in either direction. If you choose to take a long when the long stop line has been pierced by a wick but not a close, it will display the appropriate value for a stop on that bar, which is the bar's Low.
@param float _lowBuffer - You can add a buffer to the low stop.
@param float _highBuffer - You can add a buffer to the high stop.
@returns - floats for the Low and High stop lines. Bools for whether the lines are active.

Differences between f_complexStop compared to f_marketStructureStop:
It's more complex ;-) It gets stopped out less because it uses the principle that the market goes through three phases : Compression, Expansion, and Trend. The stops do not trail, or trail less, in Compression.
It uses only Enhanced Highs and Lows and there is no option to use Strict Highs and Lows.
It does not flip; the lines are always on. Instead of being set to na, the lines have active and inactive states that are output.
You can add a buffer to the stops, to make it less likely to get stopped out.

Having trouble publishing this update #fingerscrossed

Thư viện Pine

Với tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác từ cộng đồng của chúng tôi có thể sử dụng lại nó. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này một cách riêng tư hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy chung.

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

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng thư viện này?

Sao chép văn bản vào khay nhớ tạm và dán nó vào tập lệnh của bạn.