OPEN-SOURCE SCRIPT

Multiple Swing High/Low with SL

Explanation:
Swing Highs and Lows:

The script detects swing highs and swing lows using ta.pivothigh() and ta.pivotlow() on a 3-minute basis.
Each swing high is drawn with a green line, and each swing low is drawn with a red line.
Stop-Loss (SL) Lines:

For each swing high, a stop-loss line is drawn 15 points below the swing high.
For each swing low, a stop-loss line is drawn 15 points above the swing low.
The SL line for swing highs is drawn in red, and the SL line for swing lows is drawn in blue.
Labels for Swing High/Low and SL:

Labels with text like "Swing High" or "Swing Low" are added at the swing points, and SL labels are added at the stop-loss levels.
These labels can be toggled on/off using the showSwingTags input.
Line Extension:

The line.set_x2() function ensures that the swing lines and SL lines are extended to the current bar as price moves.
Key Changes:
Removed Arrays: Instead of using arrays to store lines and labels, we now handle each line and label individually. This avoids the issue where complex types (line and label) were being stored in arrays, which Pine Script doesn't support directly.
Dynamic Creation: New lines and labels are dynamically created as new swings occur, and they stay on the chart until the script is removed or the chart is reloaded.
Bill Williams IndicatorsBreadth IndicatorsCandlestick analysisswingswinghighswingsetupswing-tradingswingtrading

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss