allanster

How To Color Prior Bars

allanster Wizard Güncellendi   
Example how to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function.

Currently when offsets are used in barcolor(), bgcolor(), plot(), plotarrow(), plotchar(), or plotshape(), the offset only works with a simple (static) integer. If series (dynamic) integers are used instead, there is not an error, but the series values are ignored. Because of this limitation of offset being constrained to using only fixed offsets, the normal way to paint 3 Black Crows would be to use 3 barcolor() functions. Since there are a known number of bars to be painted in that scenario, this can be easily accomplished.

If a condition encompassed a variable length of n bars, then the number of barcolor() functions needed to use would be unknown. How to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function? Dual examples below solves issue but requires n "future" bars, because of this it will not paint the most recent condition in realtime and may not be applicable for use in certain realtime situations. It paints similar in behavior to how a pivot does. Special thanks to LucF and RicardoSantos for illumination!

NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Sürüm Notları:
Updated for Pine Script v5.
Sürüm Notları:
Cosmetic.

Telegram: t.me/allanster • Website: www.allanster.com

If you wish to buy me a refreshing beverage :)...

LTC (preferred): LTDaAe7nPzbpBhZVT9o5f9f8M3aZSPa46Y

BTC: 13LhkeXBYrRomVAqbXcoLXHuqMk6Mf7G6N
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?