Bitcoin Block Height (Total Blocks)Bitcoin Block Height by RagingRocketBull 2020
Version 1.0
Differences between versions are listed below:
ver 1.0: compare QUANDL Difficulty vs Blockchain Difficulty sources, get total error estimate
ver 2.0: compare QUANDL Hash Rate vs Blockchain Hash Rate sources, get total error estimate
ver 3.0: Total Blocks estimate using different methods
--------------------------------
This indicator estimates Bitcoin Block Height (Total Blocks) using Difficulty and Hash Rate in the most accurate way possible, since
QUANDL doesn't provide a direct source for Bitcoin Block Height (neither QUANDL:BCHAIN, nor QUANDL:BITCOINWATCH/MINING).
Bitcoin Block Height can be used in other calculations, for instance, to estimate the next date of Bitcoin Halving.
Using this indicator I demonstrate:
- that QUANDL data is not accurate and differ from Blockchain source data (industry standard), but still can be used in calculations
- how to plot a series of data points from an external csv source and compare it with another source
- how to accurately estimate Bitcoin Block Height
Features:
- compare QUANDL Difficulty source (EOD, D1) with external Blockchain Difficulty csv source (EOD, D1, embedded)
- show/hide Quandl/Blockchain Difficulty curves
- show/hide Blockchain Difficulty candles
- show/hide differences (aqua vertical lines)
- show/hide time gaps (green vertical lines)
- count source differences within data range only or for the whole history
- multiply both sources by alpha to match before comparing
- floor/round both matched sources when comparing
- Blockchain Difficulty offset to align sequences, bars > 0
- count time gaps and missing bars (as result of time gaps)
WARNING:
- This indicator hits the max 1000 vars limit, adding more plots/vars/data points is not possible
- Both QUANDL/Blockchain provide daily EOD data and must be plotted on a daily D1 chart otherwise results will be incorrect
- current chart must not have any time gaps inside the range (time gaps outside the range don't affect the calculation). Time gaps check is provided.
Otherwise hardcoded Blockchain series will be shifted forward on gaps and the whole sequence become truncated at the end => data comparison/total blocks estimate will be incorrect
Examples of valid charts that can run this indicator: COINBASE:BTCUSD,D1 (has 8 time gaps, 34 missing bars outside the range), QUANDL:BCHAIN/DIFF,D1 (has no gaps)
Usage:
- Description of output plot values from left to right:
- c_shifted - 4x blockchain plotcandles ohlc, green/black (default na)
- diff - QUANDL Difficulty
- c_shifted - Blockchain Difficulty with offset
- QUANDL Difficulty multiplied by alpha and rounded
- Blockchain Difficulty multiplied by alpha and rounded
- is_different, bool - cur bar's source values are different (1) or not (0)
- count, number of differences
- bars, total number of bars/data points in the range
- QUANDL daily blocks
- Blockchain daily blocks
- QUANDL total blocks
- Blockchain total blocks
- total_error - difference between total_blocks estimated using both sources as of cur bar, blocks
- number_of_gaps - number of time gaps on a chart
- missing_bars - number of missing bars as result of time gaps on a chart
- Color coding:
- Blue - QUANDL data
- Red - Blockchain data
- Black - Is Different
- Aqua - number of differences
- Green - number of time gaps
- by default the indicator will show lots of vertical aqua lines, 138 differences, 928 bars, total error -370 blocks
- to compare the best match of the 2 sources shift Blockchain source 1 bar into the future by setting Blockchain Difficulty offset = 1, leave alpha = 0.01 =>
this results in no vertical aqua lines, 0 differences, total_error = 0 blocks
if you move the mouse inside the range some bars will show total_error = 1 blocks => total_error <= 1 blocks
- now uncheck Round Difficulty Values flag => some filled aqua areas, 218 differences.
- now set alpha = 1 (use raw source values) instead of 0.01 => lots of filled aqua areas, 871 differences.
although there are many differences this still doesn't affect the total_blocks estimate provided Difficulty offset = 1
Methodology:
To estimate Bitcoin Block Height we need 3 steps, each step has its own version:
- Step 1: Compare QUANDL Difficulty vs Blockchain Difficulty sources and estimate error based on differences
- Step 2: Compare QUANDL Hash Rate vs Blockchain Hash Rate sources and estimate error based on differences
- Step 3: Estimate Bitcoin Block Height (Total Blocks) using different methods in the most accurate way possible
QUANDL doesn't provide block time data, but we can calculate it using the Hash Rate approximation formula:
estimated Hash rate/sec H = 2^32 * D / T, where D - Difficulty, T - block time, sec
1. block time (T) can be derived from the formula, since we already know Difficulty (D) and Hash Rate (H) from QUANDL
2. using block time (T) we can estimate daily blocks as daily time / block time
3. block height (total blocks) = cumulative sum of daily blocks of all bars on the chart (that's why having no gaps is important)
Notes:
- This code uses Pinescript v3 compatibility framework
- hash rate is in THash/s, although QUANDL falsely states in description GHash/s! THash = 1000 GHash
- you can't read files, can only embed/hardcode raw data in script
- both QUANDL and Blockchain sources have no gaps
- QUANDL and Blockchain series are different in the following ways:
- all QUANDL data is already shifted 1 bar into the future, i.e. prev day's value is shown as cur day's value => Blockchain data must be shifted 1 bar forward to match
- all QUANDL diff data > 1 bn (10^12) are truncated and have last 1-2 digits as zeros, unlike Blockchain data => must multiply both values by 0.01 and floor/round the results
- QUANDL sometimes rounds, other times truncates those 1-2 last zero digits to get the 3rd last digit => must use both floor/round
- you can only shift sequences forward into the future (right), not back into the past (left) using positive offset => only Blockchain source can be shifted
- since total_blocks is already a cumulative sum of all prev values on each bar, total_error must be simple delta, can't be also int(cum()) or incremental
- all Blockchain values and total_error are na outside the range - move you mouse cursor on the last bar/inside the range to see them
TLDR, ver 1.0 Conclusion:
QUANDL/Blockchain Difficulty source differences don't affect total blocks estimate, total error <= 1 block with avg 150 blocks/day is negligible
Both QUANDL/Blockchain Difficulty sources are equally valid and can be used in calculations. QUANDL is a relatively good stand in for Blockchain industry standard data.
Links:
QUANDL difficulty source: www.quandl.com
QUANDL hash rate source: www.quandl.com
Blockchain difficulty source (export data as csv): www.blockchain.com
Formacje świecowe
RK's 03 - Candlestick PatternThis code is just a combination of all TradingView's Candlestick Pattern.
I mix all the TV Candlestick Patterns Indicator from the TradingView in Indicator.
Candlestick Patterns by Dipak V2I am really excited to publish my work, I know its at the beginning but there is a lot to come in the future. I am writing a script to identify the candlestick patterns. In this version, I have added Hammer and Hanging Man Pattern in the first version, I know its less but its a beginning, I will keep adding the new information in my script in upcoming versions.
This script is for only learning purpose and not for treading realtime. In this script, it only identifies the pattern and does not check for its confirmation or does not provide any stop-loss, Also it does not check the prior trend before the pattern. These things really matter in the live trade. But in future, I am planning to add these things.
If you like my work, please like or comment your ideas I will try to include those in upcoming versions.
Hanging Man:
Hanging man is a bearish reversal candlestick pattern that signals about the uptrend or advancing phase are over and bulls have lost their control. Color of the candle is not important.
Identity:
1) Comes after a significant up rally or uptrend or advancing phase.
2) Small real body at the top.
3) Long lower shadow at least twice the real body.
4) Very small or no upper shadow.
Confirmation:
Immediate next candle’s close should be below the hanging man’s real body.
StopLoss:
There is a potential resistance level above the top of the hanging man. Stoploss should be above the resistance area or at the high of the hanging man.
Hammer:
Hammer is a bullish reversal candlestick pattern that signals about the downtrend or declining phase are over and bears have lost their control. Color of the candle is not important.
Identity:
1) Comes after significant down rally or downtrend or declining phase.
2) Small real body at the top.
3) Long lower shadow at least twice the real body.
4) Very small or no upper shadow.
Confirmation:
Immediate next candle’s close should be above the hammer’s low.
StopLoss:
There is a potential support level below the low of the hammer. Stoploss should be below the support area or at the low of the hammer.
Note: The candle is the same for Hanging Man and Hammer , Difference is where they appear in the uptrend or in the downtrend that makes the real difference.
NRD Sessions Basic FunctionsThis script is an extension and modification of a popular BackGround color script.
Added
1. Style and programming standards to make is easier to read and modify
2. broke out Asia to Sydney and Tokyo Sessions
3. added override to show ICT Kill zones for London and New York
4. Made all this configurable via settings Menu
Enjoy
watch this space as I intend to do more complex session scripts to allow for High and Lows and Mondays too :-)
Candlestick Pattern IdentifierMy script builds upon another user-submitted script by rebuilding the logic used to identify candlestick patterns. The logic in my script is a mix of strict and lax guidelines to mitigate false flags and present valid buy and sell signals.
-To use this indicator, simply add it to any chart. It will identify trends on any time frame although the lower you go, the more signals you'll see and the higher probability of those signals being false flags. You can also disable any candlestick patterns that you feel are not as useful.
- This indicator works best with Stocks and also with Forex markets to a lesser extent.
- This indicator works the best on the Daily chart and also works (with varying degrees of success) on any timeframe at or above 1 hour. I've found that this indicator works the best when used in tandem with the Daily and Hourly charts with the Hourly chart being used to determine an entry point while the Daily chart is used for long term trend analysis.
Forex Market OpenThis script is to highlight the first candle of weekly forex market open. Only works at UTC-4 Exchange.
Crypto Trader X Candelstick PatternsCrypto Trader X Candelstick Patterns
this andicator contain all candelstick patterns
Bullish & Berash Engulf Candel, Doji & Dragonfly Doji Candel, Hammer Candel, Hanging Man Candel
inverted Hammer Candel, Shooting Star Candel, Marabuzo black & White Candel, Spinning top black & White candel
Abandoned Baby Bearish, Abandoned Baby Bullish, Gravestone Doji Candel, Harami Bearish Candel, Harami Bullish Candel
Kicking Bearish Candel, Kicking Bullish Candel, Long Lower Shadow Bullish Candel, Long Lower Shadow Bearish Candel
Morning Star, Three White Soldiers, Three Black Crows, Tri-Star Bearish & Bullish, Engulf bar color, Reversal bar , bar color
Bollinger Band Reversal StudyThis strategy was inspired by ParallaxFX.
This strategy attempts to predict when a price reversal will happen. It uses bollinger bands, stochastics and candle formations.
The idea is that when an indecision candle, such as a doji, crosses outside the bollinger bands, then is followed by another candle that pushed sharply back inside the bands, you have a setup.
These setups are marked with green arrows to go long and red arrows to go short. Wait until the next candle begins before acting. The arrow may come and go as the price fluctuates, so wait until the candle closes.
Another play is when the same setup occurs, but on the middle bollinger band instead of the outer band.
These setups are marked with blue arrows to go long and yellow arrows to go short. Wait until the next candle begins before acting. The arrow may come and go as the price fluctuates, so wait until the candle closes.
Closing can happen a number of ways. You can use a predetermined risk-reward or look to sell when the price reaches another band.
In summary.
Go long when a green or blue arrow appears.
Go Short when a red or yellow arrow appears.
Green arrows show signs of reversal from lower BB.
Blue arrows show signs of reversal from middle BB.
Red arrows show signs of reversal from upper BB.
Yellow arrows show signs of reversal from middle BB.
Wait for candle with arrow to close before taking trade.
SOT INDICATOR for VSARussian language
SOT бар для VSA (Volume spread analysis)
Индикатор обозначает бары указывающие на остановку цены и возможный разворот.
Индикатор в первую очередь написан для таймфреймов от одного часа. На таймфреймах менее 1 часа сигнал будет приводить к неверным результатам, поскольку вечерние объемы существенно ниже дневных.
условие 1: закрытие текущего бара близко к закрытию предыдущего (достигается путём сравнения среднего диапазона последних 5 баров)
sma(high-close,5) - это средний диапазон за 5 баров
итого получается разница между закрытиями меньше 1/2 среднего диапазона за последние 5 баров.
Условие 2: должен быть хвост продаж или покупок (критерий - составляет не менее 2/3 от всего диапазона бара)
Условие 3: объемы должны быть увеличивающиеся (я взял, что текущей объем должен быть больше среднего за последние 5 баров)
Индикатор следует использовать совместно с теорией VSA.
English language (Google Translate)
SOT bar for VSA
The indicator indicates bars indicating a stop of the price and a possible reversal.
The indicator is primarily written for time frames from one hour. On time frames of less than 1 hour, the signal will lead to incorrect results, since evening volumes are significantly lower than daily volumes.
Condition 1: closing the current bar is close to closing the previous one (achieved by comparing the average range of the last 5 bars)
sma (high-close, 5) is the average range for 5 bars
total, the difference between closures is less than 1/2 of the average range for the last 5 bars.
Condition 2: there must be a tail of sales or purchases (the criterion is at least 2/3 of the entire range of the bar)
Condition 3: volumes must be increasing (I took that the current volume should be more than the average for the last 5 bars)
The indicator should be used in conjunction with VSA theory.
Demo Price Action in RSI Overbought/Oversold zoneCatch Pinbar/Fakey in RSI Overbought/Oversold zone.
Candlestick Patterns - BisayaTCThe script displays a label when a candle stick pattern is detected based on Trends. This is related to the latest Candlestick patterns released in TradingView. I've created this to have all candlestick patterns in one indicator.
Candlestick Patterns can be one of confirmation of a trend you're following or a reversal.
DISCLAIMER: For educational purposes only. Nothing in this content should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment including all types of crypto. DYOR
Combined Candlestick PatternsI combined all the build-in candlestick patterns scripts into one single script so anyone who does not have a Pro plan can display all the patterns in the same chart.
Leave a comment for any feedback!
Candlestick indicators combinationWith the inclusion of the candlestick identifiers added to trading view today, I have compiled my favourite identifiers and put them together here. This way, you can see the following together instead of separately:
Bearish Engulfing
Bullish Engulfing
The Morning Star
The Three White Soldiers
The Hammer
The Inverted Hammer
See Investopedia for more on these indicators.
In addition, I have made the indicators to show green if indicating a bullish trend, red if indicating a bearish trend, and blue if indicating something else. Please validate these indicators with other factors like EMA before proceeding to make a trade.
Please let me know if there are other indicators you would like me to compile to this list.
Best wishes, and happy trading!
Pinbar识别器This is a Pinbar Monitor which design for Chinese.
这是一个Pinbar识别器。
本脚本的目的在于帮助使用中文的人了解该指标,特别是其用法。同时将该指标代码添加完整的中文注释,方便使用中文的人学习Pine语言。
Pinbar概念来自于Price Action,基本类似于国内K线分析中的十字星,锤子线。该指标的主要功用在于帮助识别盘面出现的Pinbar,分为牛市Pinbar和熊市Pinbar。
对Pinbar的量化定义
熊市Pinbar
1 前一根K线,必须为阳线;
2 K线实体必须小于前一根K线;
3 下影线高度至少大于0.5倍实体高度;
4 上影线高度至少是2倍实体高度。
牛市Pinbar
1 前一根K线,必须为阴线;
2 K线实体必须小于前一根K线;
3 上影线高度至少大于0.5倍实体高度;
4 下影线高度至少是2倍实体高度。
指标局限性
因为Pinbar出现的概率比较高,所以切勿直接按信号交易,应考虑其他的分析方法,综合考虑再决定是否交易。
K线组合识别器(Candlestick Pattern Monitor)This is a Candlestick Pattern Monitor which design for Chinese.
这是一个K线组合的识别器。
本脚本的目的在于帮助使用中文的人了解该指标,特别是其用法。同时将该指标代码添加完整的中文注释,方便使用中文的人学习Pine语言。
K线组合是国内技术分析里最常见的分析方式之一。K线组合种类丰富,各类证券类书籍中均有总结,本识别器选取其中几种传播度最高几个K线组合,将其量化,使用机器辅助识别K线组合。
射击之星
射击之星,在股价运行的高位,一根中阳或者大阳线之后出现长上影K线,往往是较为强烈的看空信号,K线的实体部分很小或者为十字线,上影线一般为实体K线的两倍以上。
量化要点:
1 上一根K线须是一根实体高度必须大于最近10根K线实体平均值1.5倍;
2 上影线至少是实体的2倍;
3 下影线不大于实体的0.5倍。
乌云盖顶
乌云盖顶组合,第一根K线为大阳线或者中阳线,第二天跳空高开,第二根K线的开盘价远高于第一根K线的最高价,但是收盘却跌入第一根K线的实体部分,第二根K线收盘价越底,则拐点的信号越明确。
量化要点:
1 跳开,即当前K线开盘价大于上一根收盘价;
2 上一根K线须是一根实体高度必须大于最近10根K线实体平均值1.5倍;
3 当前K线收于前一根K线实体下半部分。
三只乌鸦
三只乌鸦组合的构成,股价上涨的高位区域,一根大阳线之后连续出现三根小阴线,每一根阴线都是跳空高开,但是收在当日最低附近。
量化要点:
1 连续三根阴线;
2 三根阴线的实体都小于最近十根K线实体的平均值。
下跌三部曲
下跌三部曲的构成,一根大阴线或者中阴线之后,随后的交易日连续三根价量逐日萎缩的小阳线,三根小阳线的最高价未能击破前面阴线的开盘价,随即股价重回下跌趋势,并再报收大阴线或者中阴线。
量化要点:
1 组合第一根K线为阴线;
2 组合的第二至第四根K线都为阳线;
3 第四根K线收盘价不高于第一根K线开盘价;
4 第五根K线为阴线,且收盘价低于第二根K线开盘价。
早晨之星
早晨之星由三根K线组合成,第一根是中阴线或者大阴线,第二根是小阳线或者小阴线,第三根为中阳线或者大阳线,如果第二根是十字线,也成为早晨之星,第三根阳线实体切入第一根阴线的实体之内,切入的幅度越大,信号越明确。
量化要点:
1 第一根K线为阴线,且实体高度大于最近十根K线实体的平均值的1.5倍;
2 第二根K线实体高度小于最近十根K线实体的平均值,且上影线小于实体的0.5倍,下影线大于实体的2倍;
3 第三根K线为阳线,且收盘价大于第一根K线开盘价。
红三兵
红三兵构成,三根上涨的小阳K线,如果出现在大跌之后的底部区域或者盘整区域,再配合成交量,往往成为上涨行情的先兆。
量化要点:
1 三根K线均为阳线;
2 三根K线的实体均小于最近十根K线实体的平均值。
指标局限性
因K线组合出现的频次均较高,所以K线组合需结合其他分析方式一起考虑。
Shark-32 Pattern for Candle sticks AnalysisThis script is the perfect strategy for the all mighty shark-32 pattern.
It shows the power tussle between demand and supply before either of them finally gives up.
Hide Active BarWe are not supposed to make trading decisions based on active bars (bars that have not closed), right? Well sometimes my trigger finger gets a little twitchy when I'm awaiting an entry and an active candle starts to pull away or I'm in a trade and an active candle pushes against me.
Therefore, I made a VERY simple indicator that ghosts the active bar. You can see the outline but the body is transparent to emphasize that you should await its close before deciding what to do...
Very simple script but hopefully it will help me (and others) to remain a little calmer in the moment.
In case the bar recolour does not show in the main image - here it is below.
HTF Candlestick Patterns [TradingView] vX by DGTCandlesticks are graphical representations of price movements for a given period of time. They are commonly formed by the opening, high, low, and closing prices of a financial instrument. They have their origins in the centuries-old Japanese rice trade and have made their way into modern day price charting.
It’s important to note that candlestick patterns aren’t necessarily a buy or sell signal by themselves. They are instead a way to look at market structure and a potential indication of an upcoming opportunity. It is always useful to look at candlestick patterns in context like any other market analysis tool and candlestick patterns are most useful when used in combination with other techniques. There are countless candlestick patterns that traders can use to identify areas of interest on a chart, where some candlestick patterns may provide insights into the balance between buyers and sellers, others may indicate a reversal, continuation, or indecision.
Reversal patterns are quite useful when used in context. Reversal patterns should form at the bottom of a downtrend or at the top of an uptrend. Otherwise, they are not a reversal patterns, but continuation patterns. Most reversal patterns require confirmation such as price move in the direction of reversal accompanied by appropriate trading volume. The reversal patterns can further be confirmed through other means of traditional technical analysis—like trend lines, momentum, oscillators, or volume indicators—to reaffirm buying or selling pressure. The patterns themselves do not guarantee that the trend will reverse. Investors should always confirm reversal by the subsequent price action before initiating a trade.
This study implements some of the most commonly used candlestick patterns in a context with directional movement indicator. On request users can adjust the strong trend threshold from dialog box, eighter can disabled correlation with directional movement indicator. To add additional sight to analysis the simple moving averages of 20, 50, 100 and 200 periods are added (configurable)
You may add additional indicators of your choice. Colored DMI, BB Cloud or Price Distance to its MAs may help
Enjoy it!
Disclaimer: The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd tradingview user liable for any possible claim for damages arising from any decision you make based on use of the script
Hull Candles [BigBitsIO]This script is for custom candles based on an HMA calculation with a default period of 10 as well as an SMA of the close price, defaulted to 1 period to only show the current price. The purpose of the custom candles is to try and reduce noise from candles and help identify trends. These custom candles somewhat resemble Heikin-Ashi candles in their appearance.
Explained:
- Open, High, Low and Close (o, h, l, and c) are all calculated using an HMA calculation based on a user input length/period, defaulted at 10.
- Candle colors are determined by using the same HMA calculation on the ohcl4 and comparing it to the previous candle. Green candles have an ohlc4 greater than the previous candle, all other candles are red.
- The current price is plotted with the default blue line with an SMA calculation with 1 period to allow customization of smoothing if necessary to identify trends.
DISCLAIMER: For educational and entertainment purposes only. Nothing in this content should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment including all types of crypto. DYOR, TYOB.
Engulfing Signal Considering Three Bars BeforeIts a simple analysis using Candle Pattern Technique, Engulfing. The script will find the engulf candle by considering three bars before. For Bullish Engulfing it will be colored by yellow, and for Bearish will be white. I reccomend you for using this script in Daily Time Frame.
Enjoyyyy!!!
Trend following 3 EMA & Bullish Engulfing indicator for ForexHello world,
I now took the time and puzzled through my own indicator.
The idea:
Main "strategy" uses 3 EMAs (8, 13 and 21) to attain trend-relevant information.
Then we look for bullish & bearing engulfing candles which indicate and pullback into trend direction and a gain in momentum.
Trading purpose:
One could now enter with next open. SL at low/high of engulfing candle. TP at e.g. 1.25 of that candles size.
Security:
There are two security functions build in.
We check for higher timeframe confirmation.
This is done by checking if current trend is in accordance with the EMA of the next higher timframe.
Standard-deviation is 3 on default. Can be changed in the inputs.
Alerts:
Until now there is just one alertcondition programmed.
It alerts for every engulfing candle (bullish and bearish).
More will follow in further versions.
Inputs:
I build in multiple inputs.
- switch on/off the security EMA's
- define security trend backcheck
- define the higher timeframe (15min/1h, 1h/240, 4h/D, D/W)
Happy to take feedback or contr.
All the best,
c4ss10p314
Heikin-Ashi Source Function HTFHigher TimeFrame using custom source function for toggling traditional Candle sources or Heikin-Ashi sources on a traditional Candles chart.
Thanks to PineCoders for rounding method: www.pinecoders.com
Thanks to @LucF and @RicardoSantos for their advice and enlightenment as always.
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!