SimpleCryptoLife

TrailingStops

SimpleCryptoLife تم تحديثه   
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.
ملاحظات الأخبار:
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.
ملاحظات الأخبار:
v3
Fixed default value for restartMode
ملاحظات الأخبار:
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

مكتبة باين

كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشور تحكمه قواعد الموقع.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذه المكتبة؟

انسخ النص إلى الحافظة وألصقه في النص البرمجي الخاص بك.