GoodGains

Price-Action Candles

GoodGains Aktualisiert   
What is a swing high or swing low?
Swing highs and lows are price extremes. For example say we set our swing length to 5. A candle that is a swing high with a swing length of 5 will have 5 bars to the left that are lower and 5 bars to the right that are lower. A candle that is a swing low with a swing length of 5 will have 5 bars to the left that are higher and 5 bars to the right that are higher.



How are the trend candles calculated?
The trend candles are calculated by storing and comparing historical swing lows and swing highs.
The pinescript code goes as follows:
The pinescript code goes as follows:
    var int trend = na
    trend := ((hh and high >= psh) or close > csh) ? 1 : ((ll and low <= psl) or close < csl) ? -1 : lh or hl ? 0 : trend[1]

What does that gibberish mean?
-Candle can be GREEN IF
- We have a higher high (current swing high is greater than the previous swing high) and the high is greater than the previous swing high
- OR The current close is greater than the current swing high

-Candle can be RED IF
- We have a lower low (current swing low is less than the previous swing low) and the low is less than the previous swing low
- OR The current close is less than the current swing low

-Candle can be YELLOW IF
- We have a new swing high and the new swing high is less than the previous swing high
- OR We have a new swing low and the new swing low is greater than the previous swing low

If none of the conditions above are true then we continue with whatever color the previous bar was.



What is repainting?
Repainting is "script behavior causing historical vs realtime calculations or plots to behave differently." That definition comes directly from Tradingview. If you want to read the full explanation you can visit it here https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html#future-leak-with-request-security . The price-action candles use swing highs and swing lows which need bars to the left (past) and bars to the right ("future") in order to confirm the swing level. Because of the need to wait for confirmation to for swing levels the plot style can be repainting. With the price-action candles indicator the only repainting part of the indicator is the labels. The price-action candles themselves WILL NOT REPAINT. The labels however can be set to repaint or not depending on the user preference. If the user opts to use repainting then the label location is shifted back by the length of the price-action. So if the "Price-Action Length" input is set to 10, and the user wants repainting, the swing high/low label will be shifted back 10 bars. If the user opts for no repainting, the label will not be shifted and instead show on the exact bar the swing level was confirmed.
Examples Below.


Repaint
Here the labels are shifted back the price-action length.


Non-Repaint
Here the labels are not shifted back because the input setting is set to not repaint.



Multi-timeframe Analysis
The users can view the trend from multiple different timeframes at once with a table displayed at the bottom of their charts. The timeframe can be lower or higher than the chart timeframe.



More examples


Be on the lookout for the Price Action Candles (Lower) indicator where you can view the multi-timeframe labels on a lower price grid in order to see the history over time!
Versionshinweise:
Update main image.
Versionshinweise:
update license
Versionshinweise:
Only load MTF data if "barstate.islast"

This should fix " This study references too many candles in history" error for certain membership tiers. Tradingview limits how much data you can load based on your membership type.
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?