OPEN-SOURCE SCRIPT
How to avoid repainting when using security() - viewing options

How to avoid repainting when using the security() - Edited PineCoders FAQ with more viewing options
This may be of value to a limited few, but I've introduced a set of Boolean inputs to PineCoders' original script because viewing all the various security lines at once was giving me a brain cramp. I wanted to study each behavior one-by-one. This version (also updated to PineScript v6) will allow users to selectively display each, or any combination, of the security plots. Each plot was updated to include a condition tied to its corresponding input, ensuring it only appears when explicitly enabled. The label-rendering logic only displays when its related plot is active; however, I've also added an input that allows you to remove all labels, enabling you to see the price action more clearly (the labels can sometimes obscure what you want to see). Run this script in replay mode to view the nuanced differences between the 12 methods while selecting/deselecting the desired plots (selecting all at once can be overcrowded and confusing).
All thanks and credit to PineCoders--these changes I made only provide more control over what’s shown on the chart without altering the core structure or intent of the original script. It helped me, so I thought I should share it. If I inadvertently messed something up, please let me know, and I will try to fix it.
I set the defaults for viewing monthly security functions on the daily timeframe. Only the first 2 security functions plot with the default settings, so change the settings as needed. Be sure to read the original notes and detailed explanations in the PineCoders posting "How to avoid repainting when using security() - PineCoders FAQ."
Bottom line, you should use one of the two functions: f_secureSecurity or f_security, depending on what you are trying to do. Hopefully, this script will make it a little easier for the visual learner to understand why (use replay mode or watch live price action on a lower timeframe).
This may be of value to a limited few, but I've introduced a set of Boolean inputs to PineCoders' original script because viewing all the various security lines at once was giving me a brain cramp. I wanted to study each behavior one-by-one. This version (also updated to PineScript v6) will allow users to selectively display each, or any combination, of the security plots. Each plot was updated to include a condition tied to its corresponding input, ensuring it only appears when explicitly enabled. The label-rendering logic only displays when its related plot is active; however, I've also added an input that allows you to remove all labels, enabling you to see the price action more clearly (the labels can sometimes obscure what you want to see). Run this script in replay mode to view the nuanced differences between the 12 methods while selecting/deselecting the desired plots (selecting all at once can be overcrowded and confusing).
All thanks and credit to PineCoders--these changes I made only provide more control over what’s shown on the chart without altering the core structure or intent of the original script. It helped me, so I thought I should share it. If I inadvertently messed something up, please let me know, and I will try to fix it.
I set the defaults for viewing monthly security functions on the daily timeframe. Only the first 2 security functions plot with the default settings, so change the settings as needed. Be sure to read the original notes and detailed explanations in the PineCoders posting "How to avoid repainting when using security() - PineCoders FAQ."
Bottom line, you should use one of the two functions: f_secureSecurity or f_security, depending on what you are trying to do. Hopefully, this script will make it a little easier for the visual learner to understand why (use replay mode or watch live price action on a lower timeframe).
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.