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

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan