lib_logLibrary "lib_log"
library for logging and debugging pine scripts
method init(this)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger)
method debug(this, message, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger to add the entry to
โโโโ message (string) : The Message to add
โโโโ condition (bool) : optional flag to enable disable logging of this entry dynamically (default: true)
method info(this, message, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger to add the entry to
โโโโ message (string) : The Message to add
โโโโ condition (bool) : optional flag to enable disable logging of this entry dynamically (default: true)
method success(this, message, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger to add the entry to
โโโโ message (string) : The Message to add
โโโโ condition (bool) : optional flag to enable disable logging of this entry dynamically (default: true)
method warning(this, message, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger to add the entry to
โโโโ message (string) : The Message to add
โโโโ condition (bool) : optional flag to enable disable logging of this entry dynamically (default: true)
method error(this, message, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger to add the entry to
โโโโ message (string) : The Message to add
โโโโ condition (bool) : optional flag to enable disable logging of this entry dynamically (default: true)
method debug_bar(this, message, bar, y, y_offset, last_only, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger object to check global min level condition
โโโโ message (string) : The string to print
โโโโ bar (int) : The bar to print the label at (default: bar_index)
โโโโ y (float) : The price value to print at (default: high)
โโโโ y_offset (float) : A price offset from y if you want to print multiple labels at the same spot
โโโโ last_only (bool)
โโโโ condition (bool)
method info_bar(this, message, bar, y, y_offset, last_only, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger object to check global min level condition
โโโโ message (string) : The string to print
โโโโ bar (int) : The bar to print the label at (default: bar_index)
โโโโ y (float) : The price value to print at (default: high)
โโโโ y_offset (float) : A price offset from y if you want to print multiple labels at the same spot
โโโโ last_only (bool)
โโโโ condition (bool)
method success_bar(this, message, bar, y, y_offset, last_only, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger object to check global min level condition
โโโโ message (string) : The string to print
โโโโ bar (int) : The bar to print the label at (default: bar_index)
โโโโ y (float) : The price value to print at (default: high)
โโโโ y_offset (float) : A price offset from y if you want to print multiple labels at the same spot
โโโโ last_only (bool)
โโโโ condition (bool)
method warning_bar(this, message, bar, y, y_offset, last_only, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger object to check global min level condition
โโโโ message (string) : The string to print
โโโโ bar (int) : The bar to print the label at (default: bar_index)
โโโโ y (float) : The price value to print at (default: high)
โโโโ y_offset (float) : A price offset from y if you want to print multiple labels at the same spot
โโโโ last_only (bool)
โโโโ condition (bool)
method error_bar(this, message, bar, y, y_offset, last_only, condition)
โโNamespace types: Logger
โโParameters:
โโโโ this (Logger) : Logger object to check global min level condition
โโโโ message (string) : The string to print
โโโโ bar (int) : The bar to print the label at (default: bar_index)
โโโโ y (float) : The price value to print at (default: high)
โโโโ y_offset (float) : A price offset from y if you want to print multiple labels at the same spot
โโโโ last_only (bool)
โโโโ condition (bool)
LogEntry
โโFields:
โโโโ timestamp (series__integer)
โโโโ bar (series__integer)
โโโโ level (series__integer)
โโโโ message (series__string)
Logger
โโFields:
โโโโ min_level (series__integer)
โโโโ color_logs (series__bool)
โโโโ max_lines (series__integer)
โโโโ line_idx (series__integer)
โโโโ table_pos (series__string)
โโโโ display (series__table)
โโโโ log (array__|LogEntry|#OBJ)
Buscar en scripts para "bar"
Paradigm Trades_VPA Swing IndicatorThe indicator is designed to identify specific patterns in price and volume movements that can signal potential trading opportunities. It does this by calculating several conditions based on the current bar's price and volume movements.
The code defines five conditions: Narrow Spread Up Bar, Wide Spread Down Bar, No Demand Bar, No Selling Bar, and Churning. These conditions are then plotted on the chart using specific shapes and colors. The code also includes alert conditions for each of the signals, which can be used to generate alerts for traders when a particular pattern is identified.
The VPA Swing Indicator can be used as part of a swing trading strategy to identify potential buy or sell signals. For example, a Narrow Spread Up Bar may indicate bullish momentum, while a Wide Spread Down Bar may indicate bearish momentum. Traders can use these signals to make informed trading decisions and manage their risk accordingly.
Legend:
Spread Up Bar: This is a bullish bar with a small spread, indicating a lack of selling pressure and strong buying activity.
Wide Spread Down Bar: This is a bearish bar with a large spread, indicating strong selling pressure and weak buying activity.
No Demand Bar: This is a bearish bar with a small spread and low volume, indicating a lack of buying interest and the smart money selling off their positions.
No Selling Bar: This is a bullish bar with a small spread and low volume, indicating a lack of selling interest and the smart money buying up positions.
Churning: This is a sideways market with narrow spread bars and low volume, indicating the smart money is distributing shares to the retail traders.
KernelFunctionsLibrary "KernelFunctions"
This library provides non-repainting kernel functions for Nadaraya-Watson estimator implementations. This allows for easy substitution/comparison of different kernel functions for one another in indicators. Furthermore, kernels can easily be combined with other kernels to create newer, more customized kernels. Compared to Moving Averages (which are really just simple kernels themselves), these kernel functions are more adaptive and afford the user an unprecedented degree of customization and flexibility.
rationalQuadratic(_src, _lookback, _relativeWeight, _startAtBar)
โโRational Quadratic Kernel - An infinite sum of Gaussian Kernels of different length scales.
โโParameters:
โโโโ _src : The source series.
โโโโ _lookback : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
โโโโ _relativeWeight : Relative weighting of time frames. Smaller values result in a more stretched-out curve, and larger values will result in a more wiggly curve. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel.
โโโโ _startAtBar : Bar index on which to start regression. The first bars of a chart are often highly volatile, and omitting these initial bars often leads to a better overall fit.
โโReturns: yhat The estimated values according to the Rational Quadratic Kernel.
gaussian(_src, _lookback, _startAtBar)
โโGaussian Kernel - A weighted average of the source series. The weights are determined by the Radial Basis Function (RBF).
โโParameters:
โโโโ _src : The source series.
โโโโ _lookback : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
โโโโ _startAtBar : Bar index on which to start regression. The first bars of a chart are often highly volatile, and omitting these initial bars often leads to a better overall fit.
โโReturns: yhat The estimated values according to the Gaussian Kernel.
periodic(_src, _lookback, _period, _startAtBar)
โโPeriodic Kernel - The periodic kernel (derived by David Mackay) allows one to model functions that repeat themselves exactly.
โโParameters:
โโโโ _src : The source series.
โโโโ _lookback : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
โโโโ _period : The distance between repititions of the function.
โโโโ _startAtBar : Bar index on which to start regression. The first bars of a chart are often highly volatile, and omitting these initial bars often leads to a better overall fit.
โโReturns: yhat The estimated values according to the Periodic Kernel.
locallyPeriodic(_src, _lookback, _period, _startAtBar)
โโLocally Periodic Kernel - The locally periodic kernel is a periodic function that slowly varies with time. It is the product of the Periodic Kernel and the Gaussian Kernel.
โโParameters:
โโโโ _src : The source series.
โโโโ _lookback : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
โโโโ _period : The distance between repititions of the function.
โโโโ _startAtBar : Bar index on which to start regression. The first bars of a chart are often highly volatile, and omitting these initial bars often leads to a better overall fit.
โโReturns: yhat The estimated values according to the Locally Periodic Kernel.
Realtime FootprintThe purpose of this script is to gain a better understanding of the order flow by the footprint. To that end, i have added unusual features in addition to the standard features.
I use "Real Time 5D Profile by LucF" main engine to create basic footprint(profile type) and added some popular features and my favorites.
This script can only be used in realtime, because tradingview doesn't provide historical Bid/Ask date.
Bid/Ask date used this script are up/down ticks.
This script can only be used by time based chart (1m, 5m , 60m and daily etc)
This script use many labels and these are limited max 500, so you can't display many bars.
If you want to display foot print bars longer, turn off the unused sub-display function.
Default setting is footprint is 25 labels, IB count is 1, COT high and Ratio high is 1, COT low and Ratio low is 1 and Delta Box Ratio Volume is 1 , total 29.
plus UA , IB stripes , ladder fading mark use several labels.
///////// General Setting ///////////
Resets on Volume / Range bar
: If you want to use simple time based Resets on, please set Total Volume is 0.
Your timeframe is always the first condition. So if you set Total Volume is 1000, both conditions(Volume >= 1000 and your timeframe start next bar) must be met. (that is, new footprint bar doesn't start at when total volume = exactly 1000).
Ticks per row and Maximum row of Bar
: 1 is minimum size(tick). "Maximum row of Bar" decide the number of rows used in one footprint. 1 row is created from 1 label, so you need to reduce this number to display many footprints (Max label is 500).
Volume Filter and For Calculation and Display
: "Volume Filter" decide minimum size of using volume for this script.
"For Calculation and Display" is used to convert volume to an integer.
This script only use integer to make profile look better (I contained Bid number and Ask number in one row( one label) to saving labels. This require to make no difference in width by the number of digits and this script corresponds integers from 0 to 3 digits).
ex) Symbol average volume size is from 0.0001 to 0.001. You decide only use Volume >= 0.0005 by "Volume Filter".
Next, you convert volume to integer, by setting "For Calculation and Display" is 1000 (0.0005 * 1000 = 5).
If 0.00052 โ 5.2 โ 5, 0.00058 โ 5.8 โ 6 (Decimal numbers are rounded off)
This integer is used to all calculation in this script.
//////// Main Display ///////
Footprint, Total, Row Delta, Diagonal Delta and Profile
: "Footprint" display Ask and Bid per row. "Total" display Ask + Bid per row.
"Row Delta" display Ask - Bid per row. "Diagonal Delta" display Ask(row N) - Bid(row N -1) per row.
Profile display Total Volume(Ask + Bid) per row by using Block. Profile Block coloring are decided by Row Delta value(default: positive Row Delta (Ask > Bid) is greenish colors and negative Row Delta (Ask < Bid) is reddish colors.)
Volume per Profile Block, Row Imbalance Ratio and Delta Bull/Bear/Neutral Colors
: "Volume per Profile Block" decide one block contain how many total volume.
ex) When you set 20, Total volume 70 display 3 block.
The maximum number of blocks that can be used per low is 20.
So if you set 20, Total volume 400 is 20 blocks. total volume 800 is 20 blocks too.
"Row Imbalance Ratio" decide block coloring. The row imbalance is that the difference between Ask and Bid (row delta) is large.
default is x3, x2 and x1. The larger the difference, the brighter the color.
ex) Ask 30 Bid 10 is light green. Ask 20 Bid 10 is green. Ask 11 Bid 10 is dark green.
Ask 0 Bid 1 is light red. Ask 1 Bid 2 is red. ask 30 Bid 59 is dark green.
Ask 10 Bid 10 is neutral color(gray)
profile coloring is reflected same row's other elements(Ask, Bid, Total and Delta) too.
It's because one label can only use one text color.
/////// Sub Display ///////
Delta, total and Commitment of Traders
: "Delta" is total Ask - total Bid in one footprint bar. Total is total Ask + total Bid in one footprint bar.
"Commitment of traders" is variation of "Delta". COT High is reset to 0 when current highest is touched. COT Low is opposite.
Basic concept of Delta is to compare price with Delta. Ordinary, when price move up, delta is positive. Price move down is negative delta.
This is because market orders move price and market orders are counted by Delta (although this description is not exactly correct).
But, sometimes prices do not move even though many market orders are putting pressure on price , or conversely, price move strongly without many market orders.
This is key point. Big player absorb market orders by iceberg order(Subdivide large orders and pretend to be small limit orders.
Small limit orders look weak in the order book, but they are added each time you fill, so they are more powerful than they look.), so price don't move.
On the other hand, when the price is moving easily, smart players may be aiming to attract and counterattack to a better price for them.
It's more of a sport than science, and there's always no right response. Pay attention to the relationship between price, volume and delta.
ex) If COT Low is large negative value, it means many sell market orders is coming, but iceberg order is absorbing their attack at limit order.
you should not do buy entry, only this clue. but this is one of the hints.
"Delta, Box Ratio and Total texts is contained same label and its color are "Delta" coloring. Positive Delta is Delta Bull color(green),Negative Delta is Delta Bear Color
and Delta = 0 is Neutral Color(gray). When Delta direction and price direction are opposite is Delta Divergence Color(yellow).
I didn't add the cumulative volume delta because I prefer to display the CVD line on the price chart rather than the number.
Box Ratio , Box Ratio Divisor and Heavy Box Ratio Ratio
: This is not ordinary footprint features, but I like this concept so I added.
Box Ratio by Richard W. Arms is simple but useful tool. calculation is "total volume (one bar) divided by Bar range (highest - lowest)."
When Bull and bear are fighting fiercely this number become large, and then important price move happen.
I made average BR from something like 5 SMA and if current BR exceeds average BR x (Heavy Box Ratio Ratio), BR box mark will be filled.
Box Ratio Divisor is used to good looking display(BR multiplied by Box Ratio Divisor is rounded off and displayed as an integer)
Diagonal Imbalance Count , D IB Mark and D IB Stripes
: Diagonal Imbalance is defined by "Diagonal Imbalance Ratio".
ex) You set 2. When Ask(row N) 30 Bid(row N -1)10, it's 30 > 10*2, so positive Diagonal Imbalance.
When Ask(row N) 4 Bid(row N -1)9, it's 4*2 < 9, so negative Diagonal Imbalance.
This calculation does not use equals to avoid Ask(row N) 0 Bid(row N -1)0 became Diagonal Imbalance.
Ask(row N) 0 Bid(row N -1)0, it's 0 = 0*2, not Diagonal Imbalance. Ask(row N) 10 Bid(row N -1)5, it's 10 = 5*2, not Diagonal Imbalance.
"D IB Mark" emphasize Ask or Bid number which is dominant side(Winner of Diagonal Imbalance calculation), by under line.
"Diagonal Imbalance Count" compare Ask side D IB Mark to Bid side D IB Mark in one footprint.
Coloring depend on which is more aggressive side (it has many IB Mark) and When Aggressive direction and price direction are opposite is Delta Divergence Color(yellow).
"D IB Stripes" is a function that further emphasizes with an arrow Mark, when a DIB mark is added on the same side for three consecutive row. Three consecutive arrow is added at third row.
Unfinished Auction, Ratio Bounds and Ladder fading Mark
: "Unfinished Auction" emphasize highest or lowest row which has both Ask and Bid, by Delta Divergence Color(yellow) XXXXXX mark.
Unfinished Auction sometimes has magnet effect, price may touch and breakout at UA side in the future.
This concept is famous as profit taking target than entry decision.
But, I'm interested in the case that Big player make fake breakout at UA side and trapped retail traders, and then do reversal with retail traders stop-loss hunt.
Anyway, it's not stand alone signal.
"Ratio Bounds" gauge decrease of pressure at extreme price. Ratio Bounds High is number which second highest ask is divided by highest ask.
Ratio Bounds Low is number which second lowest bid is divided by lowest bid. The larger the number, the less momentum the price has.
ex)first footprint bar has Ratio Bounds Low 2, second footprint bar has RBL 4, third footprint bar has RBL 20.
This indicates that the bear's power is gradually diminishing.
"Ladder fading mark" emphasizes the decrease of the value in 3 consecutive row at extreme price. I added two type Marks.
Ask/Bid type(triangle Mark) is Ask/Bid values are decreasing of three consecutive row at extreme price.
Row Imbalance type(Diamond Mark) are row Imbalance values are decreasing of three consecutive row at extreme price.
ex)Third lowest Bid 40, second lowest Bid 10 and lowest Bid 5 have triangle up Mark. That is bear's power is gradually diminishing.
(This Mark only check Bid value at lowest price and Ask value at highest price).
Third highest row delta + 60, second highest row delta + 5, highest delta - 20 have diamond Mark. That is Bull's power is gradually diminishing.
Sub display use Delta colors at bottom of Sub display section.
////// Candle & POC /////////
candle and POC
: Ordinary, "POC" Point of Control is row of largest total volume, but this script'POC is volume weighted average.
This is because the regular POC was visually displayed by the profile ,and I was influenced LucF's ideas.
POC coloring is decided in relation to the previous POC. When current POC is higher than previous POC, color is UP Bar Color(green).
In the opposite case, Down Bar color is used.
POC Divergence Color is used when Current POC is up but current bar close is lower than open (Down price Bar),or in the opposite case.
POC coloring has option also highlight background by Delta Divergence Color(yellow). but bg color is displayed at your time frame current price bar not current footprint bar.
The basic explanation is over.
I add some image to promote understanding basic ideas.
Entanglement Penscript name: Entanglement Pen
For left traders, how to accurately find the bottom and top is very important, and there are various methods. I have shared the bottom type script composed of three bars before, but this type of bottom type is effective in a small range. So, this script is sharing " Entanglement Pen ", which can help us determine bottoms and tops on a global scale.
However, this script uses an approximate reduction method rather than the orthodox solution of entanglement.
After roughly finding the bottom and top, how to determine that these are the bottom and top that meet the definition of entanglement theory?
The main 2 methods of "approximate reduction" are:
(1) The price difference between the top and the bottom is large enough, that is: the lowest price at the top > the highest price at the bottom.
(2) The stock price before the top has continued to rise, that is: both the highest point and the lowest point are rising. In the same way, the stock price before the bottom has a continuous decline, that is: both the high and the low point are falling.
A big disadvantage of this script is that it needs to use future data. This is because:
When multiple bars meet the top definition in a short period of time, only the last bar is used, which is defined as a big top. So, when you see a top appear, you don't know it's not a real top, because it might be followed by a bar that also matches the definition of the top.
When displayed on the graph, bars that meet the top definition have a gray label, which is the small top. Each small top is a big top (with a blue label) at the beginning, and when another small top appears after it, it becomes a gray small top.
Regarding the limit on the number of bars by TradingView:
The logic of calculating the small top and the small bottom is relatively simple, it does not need to use future data, and the amount of calculation is small, so it is the default TradingView limit. (The limit is 2000 in the script, but in practice TradingView won't let us use such many bars)
The calculation logic of the big top and the big bottom is more complicated, and it needs to use future data. The calculation amount is very large, and only the most recent 150 bars can be calculated. The user can try to enter a larger value, but TradingView may report an error. If an error occurs, please enter a lower value. When loading for the first time, it takes a long time, which is indeed not common in general TradingView scripts, but please be patient.
The next version may add the alert function, that is: when the top and bottom appear, the alert function is called. But this only applies to small tops and bottoms, because when the alert is sent,, none of us know what data will be in the future.
โ
Introduction in Chinese:
่ๆฌๅ็งฐ๏ผ็ผ ่ฎบ็ฌ
ๅฏนไบๅทฆไพงไบคๆ่
ๆฅ่ฏด๏ผๅฆไฝๅ็กฎๅฐๆพๅฐๅบ้จๅ้กถ้จๆฏ้ๅธธ้่ฆ็๏ผๆนๆณไนๆฏๅคๆ ท็๏ผไนๅๅทฒ็ปๅไบซไบไธๆ นbar็ปๆ็ๅบๅๅ่ๆฌ๏ผไฝ่ฟ็งๅบๅๅ็ๆ็่ๅด่พๅฐ๏ผ็ผบไนๅ
จๅฑ่ง้ใๆไปฅ๏ผ่ฟๆฌก็่ๆฌๅไบซ็ๆฏโ็ผ ่ฎบ็ฌโ๏ผๅฎ่ฝๅธฎๆไปฌๅจๅ
จๅฑๅฐบๅบฆๅ
็กฎๅฎๅบ้จๅ้กถ้จใ
ไธ่ฟ๏ผๆญค่ๆฌไฝฟ็จ็ๆฏ่ฟไผผ่ฟๅ็ๆนๆณ๏ผ่้็ผ ่ฎบ็ๆญฃ็ป่งฃๆณใ
็ฒ็ฅๆพๅฐๅบๅ้กถไนๅ๏ผๅฆไฝ็กฎๅฎ่ฟๅฐฑๆฏ็ฌฆๅ็ผ ่ฎบๅฎไน็ๅบๅ้กถๅข๏ผ
โ่ฟไผผ่ฟๅโ็ไธป่ฆ2ไธชๆนๆณๆฏ๏ผ
๏ผ1๏ผ้กถ้จไธๅบ้จ็ไปทๅทฎ่ถณๅคๅคง๏ผๅณ๏ผ้กถ้จ็ๆไฝไปท>ๅบ้จ็ๆ้ซไปทใ
๏ผ2๏ผ้กถ้จไนๅ็่กไปทๆๆ็ปญ็ไธๆถจ๏ผๅณ๏ผๆ้ซ็นๅๆไฝ็น้ฝๅจไธๆถจใๅ็๏ผๅบ้จไนๅ็่กไปทๆๆ็ปญ็ไธ่ท๏ผๅณ๏ผๆ้ซ็นๅๆไฝ็น้ฝๅจไธ่ทใ
่ฟไธช่ๆฌ็ไธๅคง็ผบ็นๆฏ๏ผ้่ฆไฝฟ็จๅฐๆฅ็ๆฐๆฎใ่ฟๆฏๅ ไธบ๏ผ
ๅฝ็ญๆๅ
ๆๅคไธชbar้ฝ็ฌฆๅ้กถ้จๅฎไนๆถ๏ผๅชไฝฟ็จๆๅไธไธชbar๏ผๅฎไนไธบๅคง้กถใๆไปฅ๏ผๅฝไฝ ็ๅฐไธไธช้กถ้จๅบ็ฐๆถ๏ผไฝ ไธ็ฅ้่ฟไธๆฏ็็้กถ้จ๏ผๅ ไธบๅฎไนๅๅฏ่ฝ่ฟไผๅบ็ฐ็ฌฆๅ้กถ้จๅฎไน็barใ
ๅจๅพไธๆพ็คบๆถ๏ผ็ฌฆๅ้กถ้จๅฎไน็barๆ็ฐ่ฒ็label๏ผ่ฟๆฏๅฐ้กถใๆฏไธไธชๅฐ้กถ๏ผๅๅผๅงๆถ้ฝๆฏๅคง้กถ๏ผๆ่่ฒ็label๏ผ๏ผ็ดๅฐๅฎไนๅๅๆๅฐ้กถๅบ็ฐๆถ๏ผๅฎๅฐฑๅๆไบ็ฐ่ฒ็ๅฐ้กถใ
ๅ
ณไบTradingViewๅฏนbarๆฐ็้ๅถ๏ผ
่ฎก็ฎๅฐ้กถๅๅฐๅบ็้ป่พๆฏ่พ็ฎๅ๏ผไธ้่ฆไฝฟ็จๅฐๆฅ็ๆฐๆฎ๏ผ่ฎก็ฎ้่พๅฐ๏ผๆไปฅๆฏ้ป่ฎค็TradingView้ๅถใ๏ผ่ๆฌไธญ้ๅถไธบ2000๏ผไฝๅฎ้
ไธTradingViewไธไผ่ฎฉๆไปฌไฝฟ็จ้ฃไนๅคbar๏ผ
ๅคง้กถๅๅคงๅบ็่ฎก็ฎ้ป่พๆฏ่พๅคๆ๏ผ้่ฆไฝฟ็จๅฐๆฅ็ๆฐๆฎ๏ผ่ฎก็ฎ้้ๅธธๅคง๏ผๅคง็บฆๅช่ฝ่ฎก็ฎๆ่ฟ150ๆ นbarใ็จๆทๅฏไปฅๅฐ่ฏ่พๅ
ฅๆดๅคง็ๆฐๅผ๏ผไฝTradingViewๅฏ่ฝไผๆฅ้ใ่ฅ้ๆฅ้๏ผๅ่ฏท่พๅ
ฅๆดไฝ็ๆฐๅผใๅๆฌกๅ ่ฝฝๆถ๏ผ้่ฆ็ญๅพ
่พ้ฟๆถ้ด๏ผ่ฟ็กฎๅฎๅจไธ่ฌ็TradingView่ๆฌไธญๅนถไธๅธธ่ง๏ผไฝ่ฟๆฏ่ฏทๅคไบ่ๅฟใ
ไธไธ็ๅฏ่ฝไผๅขๅ alertๅ่ฝ๏ผๅณ๏ผๅฝ้กถ้จๅๅบ้จๅบ็ฐๆถ๏ผ่ฐ็จalertๅฝๆฐใไฝ่ฟๅช้็จไบๅฐ้กถๅๅฐๅบ๏ผๅ ไธบ่ญฆๆฅๅๅบๆถ๏ผๆไปฌ่ฐไนไธ็ฅ้ๅฐๆฅ็ๆฐๆฎใ
Trading Made Easy ATR BandsAs always, this is not financial advice and use at your own risk. Trading is risky and can cost you significant sums of money if you are not careful. Make sure you always have a proper entry and exit plan that includes defining your risk before you enter a trade.
Background:
This is my take on two relatively famous indicators that paint the colour of your candles in order to help identify trend direction and smooth out market noise. The Elder Impulse System was designed by Dr . Alexander Elder in his book Come Into My Trading Room and attempts to identify the change of trends and when these trends speed up and slow down (school.stockcharts.com). The system used a 13 period EMA and a MACD histogram, and compared each of these indicators to the previous period. In short, when both the histogram and the EMA were rising, the trend was accelerating to the upside and when both were falling, accelerating to the downside. Conversely, when the indicators were not in alignment, say the MACD falling but the EMA rising, it signaled a slowing down of momentum. The downside of this indicator is that it be can rather jumpy, focusing on a short period EMA for 50% of its calculation, leaving a trader to potentially sit on the sidelines during opportune pull backs to enter winning positions, or exit early when there is still a lot of gas left in the tank.
A similar concept has been employed by John Carter and his organization, SimplerTrading, with the 10X bars indicator. However, here they use the famous Directional Movement Index (DMI) created by J. Welles Wilder as the basis for their bars (www.simplertrading.com). John Carter states that the use of this indicator can lead to getting in earlier on more, bigger, and faster setups. The downside of this indicator is the reliance on the ADX calculations to keep you out of rangebound trades. Anyone who is familiar with the DMI system understands it has unparalleled ability to identify longer term trends, but it is also quite slow, leaving the trader to miss a good portion of the initial runup due to this ADX portion that is very slow to get moving and also slow to signal exits.
In short, both of these systems are designed with one thing in mind: keeping the trader on the right side of the move --- but both suffer from the same issue but on opposite sides of the spectrum. One is too fast and the other is too slow. Ultimately, leaving profits on the table for the trader when such a situation could be avoided.
Here I present my own take on these and have made the โTrading Made Easy ATR Bandsโ. I name it this because trading is much easier when you trade with the prevailing trend, and this system identifies these periods quite effectively while doing a better job of handling the speed flux of most markets. The base formula uses the DMI as its main calculation and the relationship between the DMI+ and DMI- lines, respectively, like the 10X bars. While the trader can investigate these on their own to understand these more intimately, essentially the DMI+ and DMI- lines are calculating the highs and lows respectively of each bar compared to a period in the past and smoothed with the true range, a measurement of volatility . What this ultimately presents is a picture of uptrends and downtrends, where price is making consistently more highs or more lows over a period of time. Where I have modified this relative to the 10X bars is I have ignored the ADX calculations. Further, values over 25 have been discussed as โstrongโ momentum, in my calculations, I have sped this up to 20 to get a trader into the move earlier. Second, I have added an additional calculation based around the 21-period exponential moving average calculated against its previous output. This then, like the Elder Impulse System, has two forms of market momentum as its calculation to smooth out noise, but has the benefit of being less jumpy, like the original 10X bar system. I have added a series of exponential moving averages following the Fibonacci sequence from 8-144 as a system of dynamic support and resistance showing the sentiment of both the shorter and longer term market participants. Last, I have added a series of Keltner Channels , from 1X-4X, that encompass the 21 period EMA as a base line. The 21 EMA is a stable in all of John Carterโs work and I do believe he is correct that the market is mostly structured around this line, since it roughly approximates one month of trading data. It is not uncommon to see price expand and contract back to this line over and over again.
Trade Signals:
Strong Bullish Momentum โ The system will generate a green bar when the DMI+ line is over the DMI- line, the DMI+ line is equal or greater than 20 and the 21 EMA has increased relative to its last close.
Weak Bullish Momentum โ The system will generate a blue bar in several scenarios. First, when the DMI+ line is over the DMI- line but the DMI+ line is not over 20 and the EMA is equal or less than the previous close. It will also print a blue bar if either the DMI or the EMA are not aligned, such as the DMI+ is over the DMI- but not over 20 but the EMA has risen compared to the last bar. Last, it will also print a blue bar if the DMI- is over the DMI+ but the EMA is rising.
Strong Bearish Momentum โ The system will generate a red bar when the DMI- line is over the DMI+ line, the DMI- line is equal or greater than 20, and the 21 EMA has fallen relative to its last close.
Weak Bearish Momentum โ The system will generate an orange bar in several scenarios. First when the DMI- line is over the DMI+ line but the DMI- line is not over 20 and the EMA is equal or greater than the last bar. It will also print an orange bar if either the DMI or the EMA are not aligned, such as the DMI- is over the DMI+ but not over 20 but the EMA has fallen. Lastly, it will also print an orange bar if the DMI+ line is over the DMI- and the EMA has fallen relative to the last bar.
Uses:
1) Like the Elder Impulse System and 10X Bar systems, these should be used as trade filters only.. It is in the traderโs best interest to trade with the trends and these bars identify these periods but may not always generate the most opportune time to enter a market. For instance, trying to short a market when the market is in a phase of Strong Bullish Momentum would not be wise, and vice versa with trying to open long positions when the market is exhibiting Strong Bearish Momentum. Use multiple forms of evidence to confirm the signals shown before entering any trade and to not take these signals on their without confluence of ideas. A viable system could use the Elder Triple Screen System (for reference, see this decent write up --- www.dailyforex.com) with the Trading Made Easy Bands as your โTideโ or longer term filter, and a further trading plan to establish an entry on a short time frame pull back.
2) Interim Trend Exhaustion โ Keltner channels work as moving standard deviations from the 21 EMA . 3X multipliers will encompass 99.7% of price and 4X will encompass 99.9% of price away from the 21 EMA . During a trend it would be a good idea to lock in partial profits when price reaches these outer extrema as it is very highly probable that a retracement back to the mean is approaching. While not part of the system, and not recommended to be used by this system, a mean reversion trader could in theory look for reversals at these extrema points and trade a mean reversion strategy back to the 21EMA, but is a much riskier trade with lower probability of success. A trend trader should look to enter trades when a signal is given within the 1ATR or 2ATR zone as this is when price has not really started accelerating yet and is likely to see continued momentum in that direction.
logLibrary "log"
A Library to log and display messages in a table, with different colours.
The log consists of 3 columns:
Bar Index / Message / Log
Credits
QuantNomad - for his idea on logging messages as Error/Warnings and displaying the color based on the type of the message
setHeader(_t, _location, _header1, _header2, _header3, _halign, _valign, _size) Sets the header for the table to be used for displaying the logs.
โโParameters:
โโโโ _t : table, table to be used for printing
โโโโ _location : string, Location of the table.
โโโโ _header1 : string, the name to put into the Index Queue Header. Default is 'Bar #'
โโโโ _header2 : string, the name to put into the Message Queue Header. Default is 'Message'
โโโโ _header3 : string, the name to put into the Log Queue Header. Default is 'Log'
โโโโ _halign : string, the horizontal alignment of header. Options - Left/Right/Center
โโโโ _valign : string, the vertical alignment of header. Options - Top/Bottom/Center
โโโโ _size : string, the size of text of header. Options - Tiny/Small/Normal/Large/Huge/Auto
โโReturns: Void
initHeader(_location, _rows, _header1, _header2, _header3, _halign, _valign, _size, _frameBorder, _cellBorder) Creates the table for logging.
3 columns will be displayed.
Bar Index Q / Message Q / Log Q
โโParameters:
โโโโ _location : string, Location of the table.
โโโโ _rows : int, table size, excluding the header. Default value is 40.
โโโโ _header1 : string, the name to put into the Index Queue Header. Default is 'Bar #'
โโโโ _header2 : string, the name to put into the Message Queue Header. Default is 'Message'
โโโโ _header3 : string, the name to put into the Log Queue Header. Default is 'Log'
โโโโ _halign : string, the horizontal alignment of header. Options - Left/Right/Center
โโโโ _valign : string, the vertical alignment of header. Options - Top/Bottom/Center
โโโโ _size : string, the size of text of header. Options - Tiny/Small/Normal/Large/Huge/Auto
โโโโ _frameBorder : int, table Frame BorderWidth. Default value is 1.
โโโโ _cellBorder : int, table Cell Borders Width, Default value is 2.
โโReturns: table
init(_rows) Initiate array variables for logging.
โโParameters:
โโโโ _rows : int, table size, excluding the header. Default value is 40.
โโReturns: tuple, arrays - > error code Q, bar_index Q, Message Q, Log Q
log(_ec, _idx, _1, _2, _m1, _m2, _code, _prefix, _suffix) logs a message to logging queue.
โโParameters:
โโโโ _ec : int , Error/Codes (1-7) for colouring.
Default Colour Code is 1 - Gray, 2 - Orange, 3 - Red, 4 - Blue, 5 - Green, 6 - Cream, 7 - Offwhite
โโโโ _idx : int , bar index Q. The index of current bar is logged automatically
you can add before and after this index value, whatever you choose to, via the _prefix and _suffix variables.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ _m1 : string, message needed to be logged to Message Q
โโโโ _m2 : string, detailed log needed to be logged to Log Q
โโโโ _code : int, Error/Code to be assigned. Default code is 1.
โโโโ _prefix : string, prefix to Bar State Q message
โโโโ _suffix : string, suffix to Bar State Q message
Order of logging would be Bar Index Q / Message Q / Log Q
โโReturns: void
resize(_ec, _idx, _1, _2, _rows) Resizes the all messaging queues.
a resize will delete the existing table, so a new header/table has to be initiated after the resize.
This is because pine doesnt allow changing the table dimensions once they have been recreated.
If size is decreased then removes the oldest messages
โโParameters:
โโโโ _ec : int , Error/Codes (1-7) for colouring.
โโโโ _idx : int , bar index Q.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ _rows : int, the new size needed for the queue. Default value is 40.
โโReturns: void
print(_t, _ec, _idx, _1, _2, halign, halign, _size) Prints Bar Index Q / Message Q / Log Q
โโParameters:
โโโโ _t : table, table to be used for printing
โโโโ _ec : int , Error/Codes (1-7) for colouring.
Default Colour Code is 1 - Gray, 2 - Orange, 3 - Red, 4 - Blue, 5 - Green, 6 - Cream, 7 - Offwhite
โโโโ _idx : int , for bar index Q.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ halign : string, the horizontal alignment of all message column. Options - Left/Right/Center
โโโโ halign : string, the vertical alignment of all message column. Options - Top/Bottom/Center
โโโโ _size : string, the size of text across the table, excepr the headers. Options - Tiny/Small/Normal/Large/Huge/Auto
โโReturns: void
printx(_t, _idx, _1, _2, _ec, _fg, _bg, _halign, _valign, _size) Prints Bar Index Q / Message Q / Log Q, but with custom options to format the table and colours
โโParameters:
โโโโ _t : table, table to be used for printing
โโโโ _idx : int , for bar index Q.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ _ec : int , Error/Codes (1-7) for colouring.
โโโโ _fg : color , Color array specifying colours for foreground. Maximum length is seven. Need not provide all seven, but atleast one. If not enough provided then last colour in the array is used for missing codes
โโโโ _bg : color , Same as fg.
โโโโ _halign : string, the horizontal alignment of all message column. Options - Left/Right/Center
โโโโ _valign : string, the vertical alignment of all message column. Options - Top/Bottom/Center
โโโโ _size : string, the size of text across the table, excepr the headers. Options - Tiny/Small/Normal/Large/Huge/Auto
โโReturns: void
flush(_t, _idx, _1, _2, _ec) Clears queues of existing messages, filling with blanks and 0
โโParameters:
โโโโ _t : table, table to be flushed
โโโโ _idx : int , for bar index Q.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ _ec : int , Error/Codes (1-7) for colouring.
โโReturns: void.
erase(_idx, _1, _2, _ec) Deletes message queue and the table used for displaying the queue
โโParameters:
โโโโ _idx : int , for bar index Q.
โโโโ _1 : string , Message Q.
โโโโ _2 : string , Log Q
โโโโ _ec : int , Error/Codes (1-7) for colouring.
โโReturns: void
Elder Impulse System + ATR BandsDisregard the above chart, I am not sure why it isn't showing the one I want, which is linked below:
This is as far as I can tell the closest representation to Dr. Alexander Elder's updated "Elder Impulse System" that has added ATR-volatility bands up to 3x deviations from price. I got the idea from watching this recent video (www.youtube.com) of Dr. Elder reviewing some recent trades and noticed he had updated his system from his original books. The Impulse System colour coding was inspired by AstralLoverFlow and LazyBear. ATR Bands are pre-programmed Keltner Channels with some modifications such as filing in the ATR Zones with user-selected colour bands and modifying the ATR value to better suit the volatility of the market being traded.
The script has several components, which I will detail below:
Exponential Moving Averages:
1) A 13-period EMA that is used as a staple in all of Dr. Elder's technical analysis. He uses this EMA as the basis for all of his indicators and why it is included here.
2) A 26-period EMA which can be used as a base-line of sorts to filter when to go long or when to go short. For instance, price over the 26-EMA, price is strong and the rally upwards is likely to continue, underneath it, price is weak and likely to continue downwards for a time.
Volatility Bands:
By definition these are nothing more than 3 separate Keltner Channels of a 13-period EMA each set to one additional multiplier from the moving average. This gives us a 1x, 2x, and 3x multiplier of average volatility from the 13-period EMA based on a 14-period Average True Range (ATR) reading. The ATR was chosen as it accommodates price gaps and also is the standard formula calculation in TradingView. The values of the bands cannot be adjusted but the colour coding of them can be.
Elder Impulse System:
These colour-coded bars show you the strength and direction of the current chart resolution, calculated by the slope of a 13-period EMA and the slope of a MACD histogram. These are used not as a buying or selling recommendation alone but as trend filters, as per Dr. Elder's own description of them.
Green Bars = The 13-period EMA is sloping positively and the MACD histogram is rising compared to previous bars. The trader should only consider buying/long opportunities when a green bar is most recent.
Red Bars = The 13-period EMA is sloping negatively and the MACD histogram is falling compared to previous bars. The trader should only consider selling/short opportunities when a red bar is most recent.
Blue Bars = The 13-period EMA and the MACD histogram are not aligned. One of the indicators is sloping opposite to the other indicator. These are known as indecision bars and are typically seen near the end of a previously established trend. The trader can choose to wait for either a green or red bar to shape their trading bias if they are more risk-averse while a counter-trend trader may decide to try opening a position against the currently-established trend.
How To Trade the System:
This system is unique in that it is so versatile and will fit the styles of many traders, be it trend following traders (generally the original Elder Impulse System design) or mean-reversion/counter-trend trading (the original Keltner Channel design). None of the examples below or in the chart above are financial advice and are just there for demonstration purposes only.
1) The most basic signal given would be the moving average cross up or down. A cross of the 13-EMA over the 26-EMA signals upward trend strength and the trader could look for buying opportunities. Conversely, the 13-EMA under the 26-EMA shows downward trend strength and the trader could look for selling opportunities.
2) Following the Elder Impulse system in conjunction with the EMAs. Look for long opportunities when a green bar is printed and price is over both of the 13- and 26-period EMAs. Look for short opportunities when a red bar is printed and price is below both of the 13- and 26-period EMAs. Keep in mind this does not necessarily need a moving average cross to be viable, a green or red bar over both EMAs is a valid signal in this system, usually. Examine price more closely for better entry signals when a blue bar is printed and price is either above or below both EMAs if you are a trend trader. This is how Dr. Elder originally intended the system to be used in conjunction with his famous Triple Screen Trading System. I am not going into detail here as it is a deep subject but I would suggest an interested trader to examine this Triple Screen System further as it is widely accepted as a strong strategy.
3) Mean Reversion and Counter-Trend Trading. Dr. Elder mentions that the zone between the two EMAs is called the Value Zone. A mean reversion trader could look for buying opportunities if price has generally been in an uptrend and falls back to value, conversely, they could look for shorting opportunities if price has generally been in a downtrend and rises back to value. These are your very basic pull backs found in trends that create your higher lows in an uptrend or your lower highs in a downtrend. A mean reversion/scalper trader may also look to use the upper and lower most ATR bands as an indication of price being overbought or oversold and could look to enter a counter-trend trade here once a blue indecision bar is printed and to ride that move back down to the Value Zone.
Taking Profits and Risk Management
This system again is very versatile and will fit a wide range of trading styles. It has built in take profit levels and risk management depending on your style of trading.
1a) In original Triple Screen Trading (and the original Elder Impulse system), a trader was to place a buy order one tick above a newly printed green bar with a stop loss one tick below the most recent 2-day low, and vice-versa for red bars on short selling. as long as other criteria were met, that I will not go into. It is all over YouTube and in his books and on Investopedia if you want more information. The general idea is to continue the trend in the direction if price is strong and you are bought into that move with a close stop, or if price falls back a little bit, you can get in at a better price. This would be a system typically better suited to a scalper.
1b) The updated risk management according to the above video is to place a stop loss at least 2ATR away from price. These bands already have calculated these values so a trader can place a stop one tick below the 2 or even 3ATR zones depending on their risk appetite. This is assuming you have already received a strong buy signal based on the system you follow. This would be a system typically better suited to a trend-trader.
2a) Taking profits if you are a trend trader has several possibilities. The first, as Dr. Elder suggests, is to place a price target 2ATR values away from your entry giving you approximately a 1:1 risk-reward ratio.
2b) The second possibility if the trade is successful is to ride the trend upwards until a blue bar is printed, suggesting indecision in the market. A modified version of this that could let a winning trade run longer is to wait for the price to close under the 13-EMA in fast markets, or close under the 26-EMA in slightly slower markets to maximize potential winnings.
2c) A scalper trader may wish to have a target at either the value zone if they are playing an extended buy/short back to the mean, or if they are being at the mean, to sell or cover when price extends back out to the 2x or 3x zone.
3) Trend traders can additionally use the ATR zones as a sort of safety guidelines for entering a trade. Anything within the 1ATR zone is typically a safer entry as the market is less volatile at this time. Entering when price has gone into the 2ATR zone is signaled as a strong momentum move and can signal a stronger move in the direction of the current closing bar. While not always the case, it is suggested by Dr. Elder to not enter trend trades at the 3ATR zone as this is where you will be likely looking for a counter-trend retracement back to value and a trader entering here in the direction of the trade has a higher chance of being stopped out or not getting in at the best possible price.
Joseph Nemeth Heiken Ashi Renko MTF StrategyFor Educational Purposes. Results can differ on different markets and can fail at any time. Profit is not guaranteed. This only works in a few markets and in certain situations. Changing the settings can give better or worse results for other markets.
Nemeth is a forex trader that came up with a multi-time frame heiken ashi based strategy that he showed to an older audience crowd on a speaking event video. He seems to boast about his strategy having high success results and makes an astonishing claim that looking at heiken ashi bars instead of regular candlestick bar charts can show the direction of the trend better and simpler than many other slower non-price based indicators. He says pretty much every indicator is about the same and the most important indicator is price itself. He is pessimistic about the markets and seems to think it is rigged and there is a sort of cabal that created rules to favor themselves, such as the inability of traders to hedge in one broker account, and that to win you have to take advantage of the statistics involved in the game. He believes fundamentals, chart patterns such as cup and handle and head and shoulders, and fibonacci numbers don't matter, only price matters. The foundation of his trading strategy is based around heiken ashi bars because they show a statistical pattern that can supposedly be taken advantage of by them repeating around seventy or so percent of the time, and then combines this idea with others based on the lower time frames involved.
The first step he uses is to identify the trend direction in the higher time frame(daily or 4 hourly) using the color of the heiken ashi bar itself. If it is green then take only long position after the bar completes, if it is red then take only short position. Next, on a lower time frame(1 hour or 30 minutes) look for the slope of the 20 exponential moving average to be sloping upward if going long or the slope of the ema to be sloping downward if going short(the price being above the moving average can work too if it's too hard to visualize the slope). Then look for the last heiken ashi bar, similarly to the first step, if it is green take long position, if it is red take short position. Finally the entry indicator itself will decide the entry on the lowest time frame. Nemeth recommends using MACD or CCI or possibly combine the two indicators on a 5 min or 15 min or so time frame if one does not have access to renko or range bars. If renko bars are available, then he recommends a 5 or 10 tick bar for the size(although I'm not sure if it's really possible to remove the time frame from renko bars or if 5 or 10 ticks is universal enough for everything). The idea is that renko bars paint a bar when there is price movement and it's important to have movement in the market, plus it's a simple indicator to use visually. The exit strategy is when the renko or the lowest time frame indicator used gives off an exit signal or if the above conditions of the higher time frames are not being met(he was a bit vague on this). Enter trades with only one-fifth of your capital because the other fifths will be used in case the trades go against you by applying a hedging technique he calls "zero zone recovery". He is somewhat vague about the full workings(perhaps because he uses his own software to automate his strategy) but the idea is that the second fifth will be used to hedge a trade that isn't going well after following the above, and the other fifths will be used to enter on another entry condition or if the other hedges fail also. Supposedly this helps the trader always come out with a profit in a sort of bushido-like trading tactic of never accepting defeat. Some critics argue that this is simply a ploy by software automation to boost their trade wins or to sell their product. The other argument against this strategy is that trading while the heiken ashi bar has not completed yet can jack up the backtest results, but when it comes to trading in real time, the strategy can end up repainting, so who knows if Nemeth isn't involving repainting or not, however he does mention the trades are upon completion of the bar(it came from an audience member's question). Lastly, the 3 time frames in ascending or descending fashion seem to be spaced out by about factors of 4 if you want to trade other time frames other than 5/15min,30min/1hour, or 4hour/daily(he mentioned the higher time frame should be atleast a dozen times higher than the lower time frame).
Personally I have not had luck getting the seventy+ percent accuracy that he talks about, whether in forex or other things. I made the default on renko bars to an ATR size 1 setting because it looks like the most universal option if the traditional mode box size is too hard to guess, and I made it so that you can switch between ATR and Traditional mode just in case. I don't think the strategy repaints because I think TV set a default on the multi-time frame aspects of their code to not re-paint, but I could be wrong so you might want to watch out for that. The zero zone recovery technique is included in the code but I commented it out and/or remove it because TV does not let you apply hedging properly, as far as I know. If you do use a proper hedging strategy with this, you'll find a very interesting bushido type of trading style involved with the Japanese bars that can boost profits and win rates of around possibly atleast seventy percent on every trade but unfortunately I was not able to test this part out properly because of the limitation on hedging here, and who knows if the hedging part isn't just a plot to sell his product. If his strategy does involve the repainting feature of the heiken ashi bars then it's possible he might have been preaching fools-gold but it's hard to say because he did mention it is upon completion of the bars. If you find out if this strategy works or doesn't work or find out a good setting that I somehow didn't catch, please feel free to let me know, will gladly appreciate it. We are all here to make some money!
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
Price Action and 3 EMAs Momentum plus Sessions FilterThis indicator plots on the chart the parameters and signals of the Price Action and 3 EMAs Momentum plus Sessions Filter Algorithmic Strategy. The strategy trades based on time-series (absolute) and relative momentum of price close, highs, lows and 3 EMAs.
I am still learning PS and therefore I have only been able to write the indicator up to the Signal generation. I plan to expand the indicator to Entry Signals as well as the full Strategy.
The strategy works best on EURUSD in the 15 minutes TF during London and New York sessions with 1 to 1 TP and SL of 30 pips with lots resulting in 3% risk of the account per trade. I have already written the full strategy in another language and platform and back tested it for ten years and it was profitable for 7 of the 10 years with average profit of 15% p.a which can be easily increased by increasing risk per trade. I have been trading it live in that platform for over two years and it is profitable.
Contributions from experienced PS coders in completing the Indicator as well as writing the Strategy and back testing it on Trading View will be appreciated.
STRATEGY AND INDICATOR PARAMETERS
Three periods of 12, 48 and 96 in the 15 min TF which are equivalent to 3, 12 and 24 hours i.e (15 min * period / 60 min) are the foundational inputs for all the parameters of the PA & 3 EMAs Momentum + SF Algo Strategy and its Indicator.
3 EMAs momentum parameters and conditions
โข FastEMA = ema of 12 periods
โข MedEMA = ema of 48 periods
โข SlowEMA = ema of 96 periods
โข All the EMAs analyse price close for up to 96 (15 min periods) equivalent to 24 hours
โข Thereโs Upward EMA momentum if price close > FastEMA and FastEMA > MedEMA and MedEMA > SlowEMA
โข Thereโs Downward EMA momentum if price close < FastEMA and FastEMA < MedEMA and MedEMA < SlowEMA
PA momentum parameters and conditions
โข HH = Highest High of 48 periods from 1st closed bar before current bar
โข LL = Lowest Low of 48 periods from 1st closed bar from current bar
โข Previous HH = Highest High of 84 periods from 12th closed bar before current bar
โข Previous LL = Lowest Low of 84 periods from 12th closed bar before current bar
โข All the HH & LL and prevHH & prevLL are within the 96 periods from the 1st closed bar before current bar and therefore indicative of momentum during the past 24 hours
โข Thereโs Upward PA momentum if price close > HH and HH > prevHH and LL > prevLL
โข Thereโs Downward PA momentum if price close < LL and LL < prevLL and HH < prevHH
Signal conditions and Status (BuySignal, SellSignal or Neutral)
โข The strategy generates Buy or Sell Signals if both 3 EMAs and PA momentum conditions are met for each direction and these occur during the London and New York sessions
โข BuySignal if price close > FastEMA and FastEMA > MedEMA and MedEMA > SlowEMA and price close > HH and HH > prevHH and LL > prevLL and timeinrange (LDN&NY) else Neutral
โข SellSignal if price close < FastEMA and FastEMA < MedEMA and MedEMA < SlowEMA and price close < LL and LL < prevLL and HH < prevHH and timeinrange (LDN&NY) else Neutral
Entry conditions and Status (EnterBuy, EnterSell or Neutral)(NOT CODED YET)
โข ENTRY IS NOT AT THE SIGNAL BAR but at the current bar tick price retracement to FastEMA after the signal
โข EnterBuy if current bar tick price <= FastEMA and current bar tick price > prevHH at the time of the Buy Signal
โข EnterSell if current bar tick price >= FastEMA and current bar tick price > prevLL at the time of the Sell Signal
Gamma of Gamma - AnticipationGamma of Gamma โ Anticipation Engine
What if you could detect market inflections before they become obvious? Not react to momentum โ anticipate the momentum itself.
"Gamma here refers to mathematical acceleration (2nd derivative), NOT options Gamma"
Gamma of Gamma (GoG) operates one abstraction layer above conventional indicators. While RSI tells you what momentum did , GoG tells you what momentum is about to do . This is the difference between chasing price and positioning ahead of it.
Core Innovation: Traditional indicators measure first-order effects (price change) or second-order effects (momentum/acceleration). This system measures the third derivative โ the rate of change of acceleration itself. When Gamma-of-Gamma reaches extremes, it signals that pressure dynamics are about to flip โ often 2-5 bars before price visibly reacts.
Target Users: Discretionary traders, scalpers, and swing traders who want early positioning signals with statistical rigor. Effective on stocks, crypto, forex, and futures with meaningful volume data.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WHY THIRD-DERIVATIVE ANALYSIS?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The Hierarchy of Market Information
Most traders operate at the wrong level of abstraction:
โข Price โ What happened (lagging)
โข Momentum โ How fast it happened (still lagging)
โข Gamma (2nd Derivative) โ How momentum is changing (coincident)
โข Gamma of Gamma (3rd Derivative) โ How FAST that change is changing ( leading )
The third derivative captures inflection acceleration โ the mathematical signature of regime transition. When GoG reaches extreme values, the market is telegraphing that current pressure dynamics are unsustainable.
Why This Beats RSI
RSI measures momentum magnitude. GoG measures momentum trajectory .
Consider this scenario: RSI reads 70 (overbought). Is the move exhausted or just getting started? RSI cannot tell you. GoG can โ because it measures whether buying pressure is accelerating into the high RSI reading (continuation likely) or decelerating despite high RSI (reversal imminent).
RSI answers: "How strong was the move?"
GoG answers: "Is the move strengthening or weakening right now ?"
The first is historical. The second is predictive.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MATHEMATICAL FOUNDATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Layer 1: Cumulative Volume Delta (CVD)
The foundation is order flow approximation:
โข Up bar (close > prior close): Volume classified as buying pressure
โข Down bar (close < prior close): Volume classified as selling pressure
โข CVD = Running sum of signed volume
Interpretation: Rising CVD indicates net aggressive buying. Falling CVD indicates net aggressive selling. CVD divergence from price often precedes reversals.
Layer 2: Gamma (Second Derivative)
Gamma measures acceleration of order flow:
Formula: Gamma = CVD - 2รCVD + CVD
This is the discrete second derivative โ the rate of change of the rate of change. When Gamma spikes positive, buying pressure is accelerating . When Gamma spikes negative, selling pressure is accelerating.
Layer 3: Gamma of Gamma (Third Derivative)
GoG measures jerk โ the acceleration of acceleration:
Formula: GoG = Gamma - 2รGamma + Gamma
Critical insight: Extreme GoG readings indicate that current pressure dynamics are reaching an inflection point. The system is "overextended" in its current trajectory and will likely revert or reverse.
Layer 4: Z-Score Normalization
Raw GoG values are normalized against their 50-period distribution:
Formula: GoG_Z = (GoG - Mean_50) / StdDev_50
Benefit: Z-scores are regime-adaptive. A "2.0" reading always means "2 standard deviations from normal" regardless of whether you're trading a penny stock or ES futures. This makes thresholds consistent across instruments and timeframes.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SIGNAL GENERATION LOGIC
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Long Signal (Bullish Anticipation)
Triggers when:
โข GoG Z-score < -Threshold (default -2.0)
โข Volume > Average Volume ร Minimum Multiple (default 1.2ร)
Interpretation: Selling pressure acceleration has reached an extreme negative reading. The selling is "exhausting itself" โ acceleration is peaking and will soon decelerate. Buyers are likely to step in.
Short Signal (Bearish Anticipation)
Triggers when:
โข GoG Z-score > +Threshold (default +2.0)
โข Volume > Average Volume ร Minimum Multiple (default 1.2ร)
Interpretation: Buying pressure acceleration has reached an extreme positive reading. The buying is "exhausting itself" โ often occurs at blow-off tops, failed breakouts, or momentum climaxes.
Why Volume Confirmation?
Gamma acceleration in thin liquidity is meaningless noise. The volume filter ensures signals occur only when meaningful participation backs the pressure dynamics. This dramatically reduces false signals during low-activity periods.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CONFIDENCE ENGINE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Not all signals are equal. The Confidence Engine quantifies signal strength:
Confidence Calculation:
Confidence = 50 + ((|Z-Score| - Threshold) / Threshold) ร 100
Capped at 100%
Visual Representation:
โข Small orb = Low confidence (50-65%)
โข Normal orb = Medium confidence (65-80%)
โข Large orb = High confidence (80-100%)
Orb transparency also adjusts โ high-confidence signals appear brighter and more prominent. This creates intuitive visual hierarchy where stronger signals demand more attention.
Practical Use:
โข High confidence (>80%): Consider larger position size, tighter stops
โข Medium confidence (50-80%): Standard position size
โข Low confidence (<50%): Reduced size or wait for confirmation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
INTEGRATED BACKTESTER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Every signal system needs accountability. The onboard backtester provides real-time performance tracking:
Core Metrics:
โข Total Trades
โข Win Rate
โข Profit Factor
โข Expectancy (average P&L per trade)
โข Net P&L
โข Max Drawdown
โข Average Win / Average Loss
Methodology:
โข Positions held for configurable bar count (default 10 bars)
โข Forces objective evaluation independent of discretionary exits
โข Updates in real-time as new trades complete
Optimizer Mode:
Enable for parameter tuning research:
โข Stability Score (0-100 points): Composite evaluation of parameter robustness
โข Trade Density : Signals per 1000 bars โ monitors over/under-trading
โข Parameter Display : Current settings for documentation
โข Robustness Rating : ROBUST / STABLE / FRAGILE / OVERFIT
Stability Scoring Breakdown:
โข Win Rate โฅ55%: +25 points | โฅ50%: +15 points | โฅ45%: +5 points
โข Expectancy >0.5%: +25 points | >0.1%: +15 points | >0%: +5 points
โข Total Trades โฅ30: +25 points | โฅ20: +15 points | โฅ10: +5 points
โข Profit Factor โฅ1.5: +25 points | โฅ1.2: +15 points | โฅ1.0: +5 points
Target: 60+ points indicates stable parameters. Below 40 suggests overfitting risk.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CHART EXECUTION SIGNALS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Unique feature: Entry and exit markers display directly on the price chart via force_overlay, even though the indicator runs in a separate pane.
Visual Markers:
โข โฒ Green Triangle (below bar): Long entry at exact price level
โข โผ Red Triangle (above bar): Short entry at exact price level
โข โ Gold X-Cross : Position exit after hold period
Benefit: Immediate visual correlation between GoG signals and price action. Review historical trades without switching between panes.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
DUAL DASHBOARD SYSTEM
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Main Dashboard โ Real-Time State
Displays:
โข Current GoG regime (EXTREME HIGH / EXTREME LOW / NEUTRAL)
โข GoG Z-Score (numerical)
โข Raw GoG value
โข Gamma value
โข CVD (Cumulative Volume Delta)
โข Volume status (Active/Low with ratio)
โข Signal state (Scanning / Long Signal / Short Signal / In Position)
โข Confidence meter with visual bar
โข Entry price when in position
Backtest Dashboard โ Performance Metrics
Displays all backtester metrics in compact format. Switches to Optimizer view when Optimizer Mode enabled.
Both dashboards feature:
โข Configurable position (6 locations including Middle Left/Right)
โข Adjustable text size (Tiny/Small/Normal/Large)
โข Transparency control for visual integration
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PARAMETER GUIDE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Calculation Settings
โข GoG Extreme Threshold (default 2.0): Z-score level for signal generation. Higher = fewer but stronger signals. Range: 0.5-5.0
โข Gamma Smoothing (default 3): SMA period for Gamma. Lower = more responsive, more noise. Higher = smoother, more lag. Range: 1-20
โข GoG Smoothing (default 5): SMA period for GoG. Filters micro-spikes while preserving structural inflections. Range: 1-20
โข Min Volume Multiple (default 1.2): Volume must exceed this multiple of 20-period average. Ensures signals have participation backing. Range: 0.5-3.0
Backtester Settings
โข Backtest Hold Bars (default 10): Forced holding period for backtester evaluation. Adjust based on timeframe and trading style.
โข Parameter Optimizer Mode : Enables extended metrics for tuning research.
Tuning by Timeframe
Scalping (1-5 min):
Threshold: 1.5-2.0 | Gamma Smooth: 2-3 | GoG Smooth: 3-4 | Hold: 5-8 bars
Day Trading (15-60 min):
Threshold: 2.0-2.5 | Gamma Smooth: 3-5 | GoG Smooth: 5-7 | Hold: 8-12 bars
Swing Trading (4H-Daily):
Threshold: 2.5-3.0 | Gamma Smooth: 5-7 | GoG Smooth: 7-10 | Hold: 10-15 bars
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
HOW TO USE: PRACTICAL WORKFLOW
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Step 1: Identify Regime
Watch the GoG Z-score line. Most of the time it oscillates within the neutral zone (between thresholds). This is "scanning" mode โ no actionable signal.
Step 2: Wait for Extreme
When Z-score crosses threshold AND volume confirms, a signal fires. The orb appears in the indicator pane; the triangle appears on price chart.
Step 3: Assess Confidence
Check orb size and dashboard confidence reading:
โข Large bright orb + 80%+ confidence = High conviction setup
โข Small faint orb + <60% confidence = Requires additional confirmation
Step 4: Execute with Context
GoG signals anticipate โ they don't confirm. Use price structure (support/resistance), higher timeframe trend, or other confirmation before entry.
Step 5: Manage Position
Exit markers show backtester exits. For live trading, consider:
โข Time-based exit (signal's hold period)
โข Opposite signal exit
โข Fixed R:R targets
Step 6: Review Performance
Check Backtest Dashboard regularly. If Win Rate drops below 45% or Expectancy goes negative, reassess parameters or market conditions.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WHAT THIS INDICATOR IS โ AND ISN'T
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This Indicator IS:
โ
State-transition detector (balance โ imbalance)
โ
Early warning system for momentum shifts
โ
Anticipation tool for pre-positioning
โ
Statistical framework with built-in accountability
This Indicator IS NOT:
โ Mechanical buy/sell system (requires discretion)
โ Trend-following indicator
โ Reversal-only indicator
โ Replacement for risk management
Best Use Cases:
โข Detecting early reversals before obvious confirmation
โข Anticipating breakouts during volatility compression
โข Timing pullback entries in established trends
โข Identifying exhaustion at momentum climaxes
Challenging Conditions:
โข Extremely low volume environments
โข News-driven gaps (no order flow to measure)
โข Instruments with unreliable volume data
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ORIGINALITY STATEMENT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Innovation 1: Third-Derivative Order Flow Analysis
While first and second derivatives are common, applying third-derivative (jerk) analysis to cumulative volume delta is novel. This captures inflection points that lower-order analysis misses entirely.
Innovation 2: Z-Score Adaptive Thresholds
Rather than fixed thresholds that require per-instrument tuning, z-score normalization creates self-adapting signal levels that work consistently across any liquid instrument.
Innovation 3: Confidence-Weighted Visual System
Dynamic orb sizing and transparency based on signal strength provides intuitive visual hierarchy. Stronger signals literally appear larger and brighter.
Innovation 4: Integrated Accountability
Built-in backtester with optimizer mode enables parameter validation directly on chart. No external tools or spreadsheets required.
Innovation 5: Dual-Pane Execution Visualization
Force-overlay chart signals bridge the gap between indicator pane and price action, enabling immediate visual trade review.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LIMITATIONS & DISCLAIMERS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Technical Limitations
โข Volume classification uses bar direction (close vs prior close), not tick-level aggressor data. Precision loss estimated 10-15% vs institutional-grade data.
โข CVD approximation assumes volume follows price direction. Works well in trending conditions; less precise in choppy markets.
โข Backtester uses fixed hold period, not optimal exit logic. Real performance may vary with proper trade management.
Market Limitations
โข Requires meaningful volume data. Avoid instruments with reported volume issues.
โข Signals may cluster during high-volatility events. Not every signal should be traded.
โข Anticipation signals appear early by design. Patience required โ price may continue against signal briefly before reversing.
Risk Disclosure
โข Trading involves risk of loss. Past performance does not guarantee future results.
โข This indicator provides analysis tools, not financial advice.
โข Always use proper position sizing and risk management.
โข Backtest results are hypothetical and do not include slippage, commissions, or fees.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
RECOMMENDED SETTINGS BY MARKET
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Crypto (BTC, ETH, SOL)
Threshold: 1.8-2.2 | Gamma: 3 | GoG: 5 | Volume: 1.3x | TF: 15min-4H
Notes: Higher volatility produces more signals. Consider higher threshold to filter.
Forex Majors (EURUSD, GBPUSD)
Threshold: 2.0-2.5 | Gamma: 4 | GoG: 6 | Volume: 1.2x | TF: 5min-1H
Notes: Lower volatility requires patience. Volume proxy via tick volume works adequately.
Stocks (Large Cap)
Threshold: 2.0-2.5 | Gamma: 3-4 | GoG: 5-6 | Volume: 1.2x | TF: 15min-Daily
Notes: Real volume data provides cleanest signals. Watch for opening/closing auction distortions.
Futures (ES, NQ, CL)
Threshold: 2.0-2.3 | Gamma: 3 | GoG: 5 | Volume: 1.2x | TF: 5min-1H
Notes: Excellent volume data. Session boundaries may produce false signals โ consider RTH only.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CONCLUSION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Gamma of Gamma represents a fundamental shift in signal philosophy: from reacting to momentum to anticipating momentum.
By operating at the third derivative of order flow, this system detects the mathematical signatures of regime transition โ the moments when current pressure dynamics become unsustainable and reversal becomes probable.
This is not another oscillator telling you what already happened. This is an anticipation engine positioning you for what's about to happen.
Stop chasing. Start anticipating.
RSI tells you where momentum was. GoG tells you where it's going.
Taking you to school. - Dskyz , Trade with probability. Trade with anticipation. Trade with GoG
Combo Detector (The Strat)Description:
The Combo Detector (The Strat) identifies sequences of bar types on a higher timeframe (HTF) according to a user-defined combo pattern. Bar types are classified as:
1 (Inside bar): High โค previous high and Low โฅ previous low
2 (Directional bar): Neither inside nor outside
3 (Outside bar): High > previous high and Low < previous low
The indicator matches the combo pattern from most recent bar backward and highlights occurrences with optional labels.
For combos ending in 2-2, the indicator can further classify the pattern as:
Reversal: First and third bars exceed the second bar in the same direction (highs or lows)
Continuation: The second barโs high or low is between the extremes of the first and third bars
Inputs:
Detection Timeframe: Choose the higher timeframe to analyze (e.g., 60, 240, 4H, 12H)
Strat Combo: Define a pattern of bar types (e.g., 3-2-2, 322, 122). Hyphens are optional; labels always display hyphenated.
Include Forming Candle: If enabled, the currently forming bar is included in detection; otherwise only confirmed bars are used.
Show Labels: Toggle to display labels on chart (turn OFF for clean charts).
Pattern Option for 22: Choose "All", "Reversal", or "Continuation" for Strat combos ending in 2-2.
Usage Notes:
Intended as a research and pattern-detection tool; not a trading signal.
Labels and colors are customizable for visual reference.
An optional alert condition is provided for informational awareness only and is not intended as a trading signal.
The bar classification framework aligns with the widely known โThe Stratโ methodology popularized by Rob Smith; this indicator is an independent, unaffiliated research tool.
Al Brooks_BarCount_Start from Opening๐น Key Features
Counts from the RTH open every trading day
Stocks: 09:30โ16:00 (New York Time)
Futures: 08:30โ15:15 (Chicago Time)
Automatically detects stocks vs futures
Always displays the first bar of the session
Optional display every N bars to reduce chart clutter
Custom highlight rules
Highlight specific bar numbers (e.g. bar 18)
Highlight bar multiples (e.g. every 12 bars)
Fully customizable label size and colors
๐น Why count from the open?
In Al Brooksโ Price Action framework:
The first 30โ60 bars after the open often define the dayโs structure
Trends, failed breakouts, and trading ranges frequently align with specific bar counts
Counting across overnight or pre-market sessions can distort intraday analysis
๐ This indicator resets precisely at the RTH open, keeping the count aligned with real trading decisions.
๐น Inputs Overview
Display at every X bars
Show bar numbers at fixed intervals (bar 1 is always shown)
Count From RTH Open (Session Filter)
Limits counting strictly to regular trading hours (recommended ON)
Special Color Multiple
Highlights every N-th bar
Special Number 1 / 2
Highlights specific bar numbers
Label Size / Colors
Visual customization options
๐น Markets Supported
โ
US index futures (ES, MES, NQ, MNQ, GC, CL โ RTH)
โ
US stocks and indices (NYSE / NASDAQ)
โ Not intended for 24h markets (e.g. crypto)
๐น Usage Tips (Al Brooks Style)
Observe price behavior around early session bars (5โ10)
Watch key counts like 12, 18, 24 for acceleration or failure
Combine with EMAs, trend lines, and trading-range highs/lows
Timeframe-Independent Anchored VWAPAn anchored VWAP (Volume Weighted Average Price) that produces identical values (down to the tick!) across different timeframes (unlike, for example, TradingView's built-in Anchored VWAP).
Advantages
This indicator calculates identical values whether you view it on 1m, 5m, 15m, or any other timeframe within reasonable ranges. Even challenging non-integer timeframe ratios like calculating on 2m while viewing on 3m are handled perfectly. In High or Low mode, VWAP will anchor precisely at the selected candle's high/low. As usual for AVWAP, up to 3 standard deviation bands are supported.
How to Use
Setting the Anchor: When the indicator is added, select your anchor time. This is typically placed at a significant swing high/low or session open.
Source Selection: Choose whether to anchor from High, Low, or Close price.
Calculation Timeframe: Select the timeframe used for VWAP calculation.
For intraday trading (1m-1H charts): Just keep the default setting (1m)
For swing trading (4H-D charts): Use 5m or 15m calculation timeframe
For position trading (D-W charts): Use 1H calculation timeframe
Important: Lower calculation timeframes provide more precise data but may hit Pine Script's bar limit on very long timeframes
Standard Deviation Bands: Enable additional band sets as needed for your trading style.
Technical Implementation
The indicator achieves timeframe independence through the following algorithm:
Lower Timeframe Sampling: Uses Pine Script's request.security_lower_tf() to retrieve bar data at the specified calculation timeframe, regardless of the viewing timeframe. This provides consistent data resolution across all chart timeframes.
Anchor Detection: Scans the lower timeframe data to identify the exact bar containing the selected anchor price. The algorithm handles both simple cases (where anchor falls on a complete bar) and complex cases (where anchor falls within a split bar in non-integer timeframe ratios like calculating on 2m while viewing on 3m).
FIFO Buffer Management: Maintains a First-In-First-Out buffer of lower timeframe bars. On each chart bar:
Adds new lower timeframe bars to the buffer
Processes exactly one period worth of bars (matching the viewing timeframe)
Removes processed bars from the buffer
This approach ensures consistent calculation regardless of viewing timeframe.
First Bar Initialization: On the anchor bar, processes only the single anchor bar to ensure the VWAP starts exactly at the anchor price. Subsequent bars process the full period, maintaining mathematical accuracy.
VWAP Calculation: Applies the standard volume-weighted average price formula:
VWAP = ฮฃ(Price ร Volume) / ฮฃ(Volume)
StdDev = โ(ฮฃ(Priceยฒ ร Volume) / ฮฃ(Volume) - VWAPยฒ)
All calculations accumulate from the anchor point forward.
Visual Continuity: For edge cases where the anchor falls in an incomplete bar (e.g., calculating on 2m while viewing on 3m), displays the anchor price as a visual placeholder until the actual calculation begins on the next bar. This ensures the line always starts visually at the anchor point.
Red Bull Wings [JOAT]RED BULL WINGS - Bullish-Only Institutional Overlay
Introduction and Purpose
RED BULL WINGS is an open-source overlay indicator that combines five distinct bullish detection methods into a single composite scoring system. The core problem this indicator solves is that individual bullish signals (patterns, volume, zones, trendlines) often disagree or fire in isolation. A bullish engulfing pattern means little if volume is weak and price is far from support. Traders need confluence across multiple dimensions to identify high-probability setups.
This indicator addresses that by scoring each bullish component separately, then combining them into a weighted WINGS score (0-100) that reflects overall bullish conviction. When multiple components align, the score rises; when they disagree, the score stays low.
Why These Five Modules Work Together
Each module measures a different aspect of bullish market structure:
1. Module A - Bullish Candlestick Engine - Detects classic reversal patterns (engulfing, marubozu, hammer, 3-bar cluster). These patterns identify WHERE buyers are stepping in.
2. Module B - PVSRA Volume Climax - Measures spread x volume to detect institutional participation. This tells you WHETHER smart money is involved.
3. Module C - Demand Zone Detection - Identifies and tracks order block zones where buyers previously overwhelmed sellers. This shows you WHERE institutional support exists.
4. Module D - Trendline Channel - Builds dynamic support/resistance from pivot points. This reveals the STRUCTURE of the current trend.
5. Module E - Ichimoku Assist - Optional filter using Tenkan/Kijun cross, cloud position, and Chikou confirmation. This provides TREND PERMISSION context.
The combination works because:
Patterns alone can fail without volume confirmation
Volume alone means nothing without price structure context
Zones alone are static without pattern/volume triggers
Trendlines alone miss the micro-level entry timing
When 3+ modules agree, the probability of a valid bullish setup increases significantly
How the Calculations Work
Module A - Pattern Detection:
Bullish Engulfing - Current bullish bar completely engulfs prior bearish bar:
bool engulfingCond = isBullish() and
isBearish() and
open <= close and
close >= open and
bodySize() > bodySize()
Marubozu - Strong body with minimal wicks (body >= 1.8x average, wick ratio < 20%):
float wickRatio = candleRange() > 0 ? (upperWick() + lowerWick()) / candleRange() : 0
bool marubozuCond = isBullish() and
bodySize() >= bodySizeAvg * i_maruMult and
wickRatio < i_wickRatioMax
Hammer - Long lower wick (>= 2.5x body), close in upper third, volume confirmation:
bool hammerWick = lowerWick() >= i_hammerWickMult * bodySize()
bool hammerClose = close >= low + (candleRange() * 0.66)
bool hammerVol = volume >= i_pvsraRisingMult * volAvg
3-Bar Cluster - Three consecutive bullish closes with increasing prices and volume spike:
bool threeBarBullish = isBullish() and isBullish() and isBullish()
bool increasingCloses = close > close and close > close
bool volSpike3Bar = volume >= i_pvsraRisingMult * volAvg or
volume >= i_pvsraRisingMult * volAvg
Module B - PVSRA Volume Analysis:
Uses spread x volume to detect climax conditions:
float spreadVol = candleRange() * volume
float maxSpreadVol = ta.highest(spreadVol, ADJ_PVSRA_LOOKBACK)
bool volClimax = volume >= i_pvsraClimaxMult * volAvg or spreadVol >= maxSpreadVol
bool volRising = volume >= i_pvsraRisingMult * volAvg and volume < i_pvsraClimaxMult * volAvg
Volume only scores when the candle is bullish, preventing false signals on bearish volume spikes.
Module C - Demand Zone Detection:
Identifies zones using a two-candle structure:
// Small bearish candle A followed by larger bullish candle B
bool candleA_bearish = isBearish()
bool candleB_bullish = isBullish()
bool newZoneCond = candleA_bearish and candleB_bullish and
candleB_size >= i_zoneSizeMult * candleA_size
Zones are drawn as rectangles and tracked for retests. Score increases when price is near or inside an active zone, with bonus points for rejection candles.
Module D - Trendline Channel:
Builds dynamic channel from confirmed pivot points:
float ph = ta.pivothigh(high, i_pivotLeft, i_pivotRight)
float pl = ta.pivotlow(low, i_pivotLeft, i_pivotRight)
Pivots are stored and connected to form upper/lower channel lines. The indicator detects breakouts when price closes beyond the channel with volume confirmation.
Module E - Ichimoku Assist:
Standard Ichimoku calculations with bullish scoring:
float tenkan = (ta.highest(high, i_tenkanLen) + ta.lowest(low, i_tenkanLen)) / 2
float kijun = (ta.highest(high, i_kijunLen) + ta.lowest(low, i_kijunLen)) / 2
bool tkCross = ta.crossover(tenkan, kijun)
bool priceAboveCloud = close > cloudTop
bool chikouAbovePrice = chikou > close
Module F - WINGS Composite Score:
All module scores are combined using adjustable weights:
float WINGS_score = 100 * (nW_pattern * S_pattern +
nW_volume * S_vol +
nW_zone * S_zone +
nW_trend * S_trend +
nW_ichi * S_ichi)
Default weights: Pattern 30%, Volume 25%, Zone 20%, Trend 15%, Ichimoku 10%.
Signal Thresholds
WATCH (30-49) - Interesting bullish context forming, not yet actionable
MOMENTUM (50-74) - Strong bullish conditions, multiple modules agreeing
LIFT-OFF (75+) - High-confidence bullish confluence across most modules
WINGS Badge (Dashboard)
The right-side panel displays:
WINGS Score - Current composite score (0-100)
Pattern - Active pattern name and strength, or neutral placeholder
Volume - Normal / Rising / CLIMAX status
Zone - ACTIVE if price is near a demand zone
Trend - Channel position or BREAK status
Ichimoku - OFF / Weak / Bullish / STRONG
Status - Overall signal level (Neutral / WATCH / MOMENTUM / LIFT-OFF)
Input Parameters
Module Toggles:
Enable Bullish Patterns (true) - Toggle pattern detection
Enable PVSRA Volume (true) - Toggle volume analysis
Enable Order Blocks (true) - Toggle demand zone detection
Enable Trendlines (true) - Toggle pivot channel
Enable Ichimoku Assist (false) - Toggle Ichimoku filter (off by default for performance)
Enable Visual Effects (false) - Toggle labels, trails, and visual elements
LIVE MODE (false) - Enable intrabar signals (WARNING: signals may repaint)
Pattern Engine:
Pattern Lookback (5) - Bars for body size averaging
Marubozu Body Multiplier (1.8) - Minimum body size vs average
Hammer Wick Multiplier (2.5) - Minimum lower wick vs body
Max Wick Ratio (0.2) - Maximum wick percentage for marubozu
Volume / PVSRA:
PVSRA Lookback (10) - Period for volume averaging
Climax Multiplier (2.0) - Volume threshold for climax detection
Rising Volume Multiplier (1.5) - Volume threshold for rising detection
Order Blocks:
Zone Size Multiplier (2.0) - Minimum bullish candle size vs bearish
Zone Extend Bars (200) - How far zones project forward
Max Zones (12) - Maximum active zones displayed
Remove Zone on Close Below (true) - Delete broken zones
Trendlines:
Pivot Left/Right Bars (3/3) - Pivot detection sensitivity
Min Slope % (0.25) - Minimum trendline angle
Max Trendlines (5) - Maximum pivot points stored
Trendline Projection Bars (60) - Forward projection distance
Ichimoku:
Tenkan Length (9) - Conversion line period
Kijun Length (26) - Base line period
Senkou B Length (52) - Leading span B period
Displacement (26) - Cloud displacement
WINGS Score:
Weight: Pattern (0.30) - Pattern contribution to score
Weight: Volume (0.25) - Volume contribution to score
Weight: Zone (0.20) - Zone contribution to score
Weight: Trend (0.15) - Trendline contribution to score
Weight: Ichimoku (0.10) - Ichimoku contribution to score
Lift-Off Threshold (75) - Score required for LIFT-OFF signal
Momentum Watch Threshold (50) - Score required for MOMENTUM signal
Visuals:
Signal Cooldown (8) - Minimum bars between labels
Show WINGS Score Badge (true) - Toggle dashboard
Show Wing Combos (true) - Show DOUBLE/MEGA WINGS streaks
Red Background Wash (true) - Tint chart background
Show Lift-Off Trails (false) - Toggle golden trail visuals
How to Use This Indicator
For Bullish Entry Identification:
1. Monitor the WINGS badge for score changes
2. Wait for MOMENTUM (50+) or LIFT-OFF (75+) signals
3. Check which modules are contributing (Pattern + Volume + Zone = stronger)
4. Use demand zones and trendlines as structural reference for entries
For Confluence Confirmation:
1. Use alongside your existing analysis
2. LIFT-OFF signals indicate multiple bullish factors aligning
3. Low scores (< 30) suggest weak bullish context even if one factor looks good
For Zone-Based Trading:
1. Watch for price approaching active demand zones
2. Look for pattern + volume confirmation at zone retests
3. Zone score increases with successful retests
For Trendline Analysis:
1. Monitor the pivot-based channel for trend structure
2. Breakouts with volume confirmation trigger TREND BREAK alerts
3. Price inside channel with bullish patterns = trend continuation setup
1M and lower timeframes:
Alerts Available
LIFT-OFF - High-confidence bullish confluence
MOMENTUM - Strong bullish conditions
Zone Retest - Bullish rejection from demand zone
Trendline Break - Breakout with volume confirmation
Individual patterns (Engulfing, Marubozu, Hammer, 3-Bar Cluster)
Volume Climax - Institutional volume spike
DOUBLE WINGS / MEGA WINGS - Consecutive lift-off signals
Repainting Behavior
By default, the indicator uses confirmed bars only (barstate.isconfirmed), meaning signals appear after the bar closes and do not repaint. However:
LIVE MODE - When enabled, signals can appear intrabar but may disappear if conditions change before bar close. A warning label displays when LIVE MODE is active.
Trendlines - Pivot detection requires lookback bars, so the most recent trendline segments may adjust as new pivots confirm. This is inherent to pivot-based analysis.
Demand Zones - Zones are created on confirmed bars and do not repaint, but they can be removed if price closes below the zone bottom (configurable).
Live Mode with 'Enable Visual Effect' turned off in settings:
Limitations
This is a bullish-only indicator. It does not detect bearish setups or provide short signals.
The WINGS score is a confluence measure, not a prediction. High scores indicate favorable conditions, not guaranteed outcomes.
Pattern detection uses simplified logic. Not all candlestick nuances are captured.
Volume analysis requires reliable volume data. Results may vary on instruments with inconsistent volume reporting.
Ichimoku calculations add processing overhead. Disable if not needed.
Demand zones are based on a specific two-candle structure. Other valid zones may not be detected.
Trendlines use linear regression between pivots. Curved or complex channels are not supported.
Timeframe Recommendations
15m-1H: More frequent signals, useful for intraday analysis. Higher noise.
4H-Daily: Best balance of signal quality and frequency for swing trading.
Weekly: Fewer but more significant signals for position trading.
Adjust lookback periods and thresholds based on your timeframe. Shorter timeframes may benefit from shorter lookbacks.
Open-Source and Disclaimer
This script is published as open-source under the Mozilla Public License 2.0 for educational purposes. The source code is fully visible and can be studied to understand how each module works.
This indicator does not constitute financial advice. The WINGS score and signals do not guarantee profitable trades. Past performance does not guarantee future results. Always use proper risk management, position sizing, and stop-losses. Test thoroughly on your preferred instruments and timeframes before using in live trading.
- Made with passion by officialjackofalltrades















