OPEN-SOURCE SCRIPT
Virat-Levels

Collect all active levels (value + label + color) into arrays — skipping any that are na or toggled off.
Sort all three arrays together by price using bubble sort, so levels are in order from bottom to top.
walk up the sorted list and if any label's Y is within min_gap of the one below it, push it up by the difference. The min_gap is 1.5% of the 200-bar price range, so it auto-scales — works on a $2 stock and a $500 stock equally.
lines are always drawn at the true price (so the line sits exactly on the level), but labels are drawn at the nudged Y (so they don't stack on top of each other). The line still points accurately to the real price, the label just floats slightly above/below if needed.
Sort all three arrays together by price using bubble sort, so levels are in order from bottom to top.
walk up the sorted list and if any label's Y is within min_gap of the one below it, push it up by the difference. The min_gap is 1.5% of the 200-bar price range, so it auto-scales — works on a $2 stock and a $500 stock equally.
lines are always drawn at the true price (so the line sits exactly on the level), but labels are drawn at the nudged Y (so they don't stack on top of each other). The line still points accurately to the real price, the label just floats slightly above/below if needed.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。