OPEN-SOURCE SCRIPT

Candle Counter [theEccentricTrader]

Atualizado
█  OVERVIEW


This indicator counts the number of confirmed candle scenarios on any given candlestick chart and displays the statistics in a table, which can be repositioned and resized at the user's discretion.


█  CONCEPTS


Green and Red Candles

  • A green candle is one that closes with a high price equal to or above the price it opened.
  • A red candle is one that closes with a low price that is lower than the price it opened.


Upper Candle Trends

  • A higher high candle is one that closes with a higher high price than the high price of the preceding candle.
  • A lower high candle is one that closes with a lower high price than the high price of the preceding candle.
  • A double-top candle is one that closes with a high price that is equal to the high price of the preceding candle.


Lower Candle Trends

  • A higher low candle is one that closes with a higher low price than the low price of the preceding candle.
  • A lower low candle is one that closes with a lower low price than the low price of the preceding candle.
  • A double-bottom candle is one that closes with a low price that is equal to the low price of the preceding candle.


█  FEATURES


Inputs

  • Start Date
  • End Date
  • Position
  • Text Size
  • Show Sample Period
  • Show Plots


Table

The table is colour coded, consists of three columns and twenty-two rows. Blue cells denote all candle scenarios, green cells denote green candle scenarios and red cells denote red candle scenarios.

The candle scenarios are listed in the first column with their corresponding total counts to the right, in the second column. The last row in column one, row twenty-two, displays the sample period which can be adjusted or hidden via indicator settings.

Rows two and three in the third column of the table display the total green and red candles as percentages of total candles. Rows four to nine in column three, coloured blue, display the corresponding candle scenarios as percentages of total candles. Rows ten to fifteen in column three, coloured green, display the corresponding candle scenarios as percentages of total green candles. And lastly, rows sixteen to twenty-one in column three, coloured red, display the corresponding candle scenarios as percentages of total red candles.

Plots

I have added plots as a visual aid to the various candle scenarios listed in the table. Green up-arrows denote higher high candles when above bar and higher low candles when below bar. Red down-arrows denote lower high candles when above bar and lower low candles when below bar. Similarly, blue diamonds when above bar denote double-top candles and when below bar denote double-bottom candles. These plots can also be hidden via indicator settings.


█  HOW TO USE


This indicator is intended for research purposes and strategy development. I hope it will be useful in helping to gain a better understanding of the underlying dynamics at play on any given market and timeframe. It can, for example, give you an idea of any inherent biases such as a greater proportion of green candles to red. Or a greater proportion of higher low green candles to lower low green candles. Such information can be very useful when conducting top down analysis across multiple timeframes, or considering trailing stop loss methods.

What you do with these statistics and how far you decide to take your research is entirely up to you, the possibilities are endless.

This is just the first and most basic in a series of indicators that can be used to study objective price action scenarios and develop a systematic approach to trading.


█  LIMITATIONS


Some higher timeframe candles on tickers with larger lookbacks such as the DXY, do not actually contain all the open, high, low and close (OHLC) data at the beginning of the chart. Instead, they use the close price for open, high and low prices. So, while we can determine whether the close price is higher or lower than the preceding close price, there is no way of knowing what actually happened intra-bar for these candles. And by default candles that close at the same price as the open price, will be counted as green. You can avoid this problem by utilising the sample period filter.

The green and red candle calculations are based solely on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with. Alternatively, you can replace the scenarios with your own logic to account for the gap anomalies, if you are feeling up to the challenge.

It is also worth noting that the sample size will be limited to your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. If upgrading is currently not an option, you can always keep a rolling tally of the statistics in an excel spreadsheet or something of the like.


Notas de Lançamento
Added group titles to inputs.
Notas de Lançamento
Incorporated library functions and general TLC.
Candlestick Analysiseducationalstatistics

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal