Penunjuk dan strategi
RedK Compound Ratio Moving Average (CoRa_Wave)
Compound Ratio Weighted Average (CoRa_Wave) is a moving average where the weights increase in a "logarithmically linear" way - from the furthest point in the data to the current point - the formula to calculate these weights work in a similar way to how "compound ratio" works - you start with an initial amount, then add a consistent "ratio of the cumulative prior sum" each period until you reach the end amount. The result is, the "step ratio" between the weights is consistent - This is not the case with linear-weights moving average (WMA), or EMA
- for example, if you consider a Weighted Moving Average (WMA) of length 5, the weights will be (from the furthest point towards the most current) 1, 2, 3, 4, 5 -- we can see that the ratio between these weights are inconsistent. in fact, the ratio between the 2 furthest points is 2:1, but the ratio between the most recent points is 5:4 -- the ratio is inconsistent, and in fact, more recent points are not getting the best weights they should/can get to counter-act the lag effect. Using the Compound ratio approach addresses that point.
a key advantage here is that we can significantly reduce the "tail weight" - which is "relatively" large in other MAs and would be main cause for lag - giving more weights to the most recent data points - and in a way that is consistent, reliable and easy to "code"
- the outcome is, a moving average line that suffers very little lag regardless of the length, and that can be relied on to track the price movements and swings closely.
other features:
===============
- An accelerator, or multiplier, has been added to further increase the "aggressiveness" of the moving average line, giving even more weights to the more recent points - the multiplier will have more effect between 1 and 5, then will have a diminishing effect after that - note that a multiplier of 0 (which effectively causes a comp. ratio of 0 to be applied) will produce a Simple Moving Average line :)
- We also added the ability to use an "automatic smoothing" mechanism, that user can over-ride by manually choosing how much smoothing is used. This gives more flexibility to how we can leverage this Moving Average in our charting.
- User can also select the Resolution and Source price for the CoRa_Wave. by default, they will be set to "same as chart" and hlc3
here are the formulas for our Compound Ratio moving average:
Compound Weight ratio r = (A/P)^1/t - 1
Weight at time t A = P(1 + r)^t
= Start_val * (1 + r) ^ index
index in the above formula is 0 for the furthest point out
Here's how CoRa_Wave compares to other common moving averages all set to the same length (20)
Proposed Usage
- CoRa_Wave can be used for any scenarios where we need a moving average that closely tracks the price, trend, swings with high responsiveness and little lag
- MA Cross-over scenarios - against another CoRa_Wave or any other MA
- below is a quick example scenario for how to utilize 2 CoRa_Wave lines of same length (one for open and one for closing price) to track swings and trends
- get as creative as you need :)
Code is commented - please feel free to leverage or customize further as you need.
👉 if you are interested in other moving averages i posted before, please check out the FiMA and the v_Wave ...
Detrended Rhythm Oscillator (DRO)How to detect the current "market beat" or market cycle?
A common way to capture the current dominant cycle length is to detrend the price and look for common rhythms in the detrended series. A common approach is to use a Detrended Price Oscillator (DPO). This is done in order to identify and isolate short-term cycles.
A basic DPO description can be found here:
www.tradingview.com
Improvements to the standard DPO
The main purpose of the standard DPO is to analyze historical data in order to observe cycle's in a market's movement. DPO can give the technical analyst a better sense of a cycle's typical high/low range as well as its duration. However, you need to manually try to "see" tops and bottoms on the detrended price and measure manually the distance from low-low or high-high in order to derive a possible cycle length.
Therefore, I added the following improvements:
1) Using a DPO to detrend the price
2) Indicate the turns of the detrended price with a ZigZag lines to better see the tops/bottoms
3) Detrend the ZigZag to remove price amplitude between turns to even better see the cyclic turns ("rhythm")
4) Measure the distance from last detrended zigzag pivot (high-high / low-low) and plot the distance in bars above/below the turn
Now, you can clearly see the rhythm of the dataset indicated by the Detrended Rhythm Oscillator including the exact length between the turns. This makes the procedure to "spot" turns and "measure" distance more simple for the trader.
How to use this information
The purpose is to check if there is a common rhythm or beat in the underlying dataset. To check that, look for recurring pattern in the numbers. E.g. if you often see the same measured distance, you can conclude that there is a major dominant cycle in this market. Also watch for harmonic relations between the numbers. So in the example above you see the highlighted cluster of detected length of around 40,80 and 120. There three numbers all have a harmonic relation to 40.
Once you have this cyclic information, you can use this number to optimize or tune technical indicators based on the current dominant cycle length. E.g. set the length parameter of a technical indicator to the detected harmonic length with the DRO indicator.
Example Use-Case
You can use this information to set the input for the following free public open-source script:
Disclaimer
This is not meant to be a technical indicator on its own and the derived cyclic length should not be used to forecast the next turn per se. The indicator should give you an indication of the current market beat or dominant beats which can be use to further optimize other oscillator or trading related settings.
Options & settings
The indicator allows to plot different versions. It allows to plot the original DPO, the DRO with ZigZag lines, the DRO with detrended ZigZag lines and length labels on/off. You can turn on or off these version in the indicator settings. So you can tweak it visually to your own needs.
Logging in Pine ScriptI'm building quite a lot of pretty complicated indicators/strategies in Pine Script. Quite often they don't work from the 1 try so I have to debug them heavily.
In Pine Script there are no fancy debuggers so you have to be creative. You can plot values on your screens, check them in the data window, etc.
If you want to display some textual information, you can plot some info as labels on the screen.
It's not the most convenient way, so with the appearance of tables in Pine Script, I decided to implement a custom logger that will allow me to track some useful information about my indicator over time.
Tables work much better for this kind of thing than labels. They're attached to your screen, you can nicely scale them and you can style them much better.
The idea behind it is very simple. I used few arrays to store the message, bar number, timestamp, and type of the message (you can color messages depend on the type for example).
There is a function log_msg that just append new messages to these arrays.
In the end, for the last bar, I create the table and display the last X messages in it.
In parameters, you can show/hide the entire journal, change the number of messages displayed and choose an offset. With offset, you can basically scroll through the history of messages.
Currently, I implemented 3 types of messages, and I color messages according to these types:
Message - gray
Warning - yellow
Error - red
Of course, it's a pretty simple example, you can create a much fancier way of styling your logs.
What do you think about it? Is it useful for you? What do you use to debug code in Pine Script?
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
Technical Ratings on Multi-frames / Assets█ OVERVIEW
This indicator is a modified version of TECHNICAL RATING v1.0 available in the public library to provide a quick overview of consolidated technical ratings performed on 12 assets in 3 timeframes.The purpose of the indicator is to provide a quick overview of the current status of the custom 12 (24) assets and to help focus on the appropriate asset.
█ MODIFICATIONS
- Markers, visualizations and alerts have been deleted
- Due to the limitation on maximum number of security (40), the results of 12 assets evaluated in 3 different time frames can be shown at the same time.
- An additional 12 assets can be configured in the settings so that you do not have to choose each ticker one by one to facilitate a quick change, but can switch between the 12 -12 assets with a single click on "Second sets?".
- The position, colors and parameters of the table can be widely customized in the settings.
- The 12 assets can be arranged in rows 3, 4, 6 and 12 with Table Rows options, which can also be used to create a simple mobile view.
- The default gradient color setting has been changed to red/yellow/green traffic lights
ORIGINAL DESCRIPTION ABOUT TECHNICAL RATING v1.0
█ OVERVIEW
This indicator calculates TradingView's well-known "Strong Buy", "Buy", "Neutral", "Sell" or "Strong Sell" states using the aggregate biases of 26 different technical indicators.
█ WARNING
This version is similar, but not identical, to our recently published "Technical Ratings" built-in, which reproduces our "Technicals" ratings displayed as a gauge in the right panel of charts, or in the "Rating" indicator available in the TradingView Screener. This is a fork and refactoring of the code base used in the "Technical Ratings" built-in. Its calculations will not always match those of the built-in, but it provides options not available in the built-in. Up to you to decide which one you prefer to use.
█ FEATURES
Differences with the built-in version
• The built-in version produces values matching the states displayed in the "Technicals" ratings gauge; this one does not always.
• A strategy version is also available as a built-in; this script is an indicator—not a strategy.
• This indicator will show a slightly different vertical scale, as it does not use a fixed scale like the built-in.
• This version allows control over repainting of the signal when you do not use a higher timeframe. Higher timeframe (HTF) information from this version does not repaint.
• You can adjust the weight of the Oscillators and MAs components of the rating here.
• You can configure markers on signal breaches of configurable levels, or on advances declines of the signal.
The indicator's settings allow you to:
• Choose the timeframe you want calculations to be made on.
• When not using a HTF, you can select a repainting or non-repainting signal.
• When using both MAs and Oscillators groups to calculate the rating, you can vary the weight of each group in the calculation. The default is 50/50.
Because the MAs group uses longer periods for some of its components, its value is not as jumpy as the Oscillators value.
Increasing the weight of the MAs group will thus have a calming effect on the signal.
• Alerts can be created on the indicator using the conditions configured to control the display of markers.
Display
The calculated rating is displayed as columns, but you can change the style in the inputs. The color of the signal can be one of three colors: bull, bear, or neutral. You can choose from a few presets, or check one and edit its color. The color is determined from the rating's value. Between 0.1 and -0.1 it is in the neutral color. Above/below 0.1/-0.1 it will appear in the bull/bear color. The intensity of the bull/bear color is determined by cumulative advances/declines in the rating. It is capped to 5, so there are five intensities for each of the bull/bear colors.
The "Strong Buy", "Buy", "Neutral", "Sell" or "Strong Sell" state of the last calculated value is displayed to the right of the last bar for each of the three groups: All, MAs and Oscillators. The first value always reflects your selection in the "Rating uses" field and is the one used to display the signal. A "Strong Buy" or "Strong Sell" state appears when the signal is above/below the 0.5/-0.5 level. A "Buy" or "Sell" state appears when the signal is above/below the 0.1/-0.1 level. The "Neutral" state appears when the signal is between 0.1 and -0.1 inclusively.
Five levels are always displayed: 0.5 and 0.1 in the bull color, zero in the neutral color, and -0.1 and - 0.5 in the bull color.
█ CALCULATIONS
The indicator calculates the aggregate value of two groups of indicators: moving averages and oscillators.
The "MAs" group is comprised of 15 different components:
• Six Simple Moving Averages of periods 10, 20, 30, 50, 100 and 200
• Six Exponential Moving Averages of the same periods
• A Hull Moving Average of period 9
• A Volume-weighed Moving Average of period 20
• Ichimoku
The "Oscillators" group includes 11 components:
• RSI
• Stochastic
• CCI
• ADX
• Awesome Oscillator
• Momentum
• MACD
• Stochastic RSI
• Wiliams %R
• Bull Bear Power
• Ultimate Oscillator
3D Wave-PMThe Wave-PM (Whistler Active Volatility Energy - Price Mass) indicator is an oscillator described in Mark Whistler's book 'Volatility Illuminated'.
The Wave-PM was specifically designed to help read cycles of volatility. When visualizing volatility cycles as a heatmap we can get a clear overview of market volatility phases on multiple timeframes, and more importantly as traders give us insight into 'potential' volatility from to pent up energy signaled by the blue and green plumes which invariably give way to big moves signaled by the orange and red plumes.
This indicator can be quite GPU intensive, so simple and also line based visualization methods are included. Also, its free and open source so go ahead and hack it to your hearts content. Enjoy!
Swing High/Low Anchored SpiralFit the estimate of an Archimedean spiral to the price, with a central point determined by swing high/lows.
Users can determine which historical swing high/low to use as the spiral central point and can choose the number of turns it should make.
You can create cool shapes, cool enough to satisfy your apophenia needs.
If you are having issues just hide and unhide the script, or just lower the length/occurrence setting.
Posting is impossible without the support of my Patreons as well as @LuxAlgo, my scripts are dedicated to them.
Quality ScreenAn attempt to show fundamental stats which describes quality of the stock. Following parameters are depicted:
SOLVENCY
DEBT_TO_EQUITY
Very Good : 0 - 1
Good : 1 - 2
High risk : > 2
DEBT_TO_ASSET
Very Good : < 0.4
Good : 0.4 - 0.6
High Risk : > 0.6
LONG_TERM_DEBT_TO_ASSETS
Very Good : < 0.4
Good : 0.4 - 0.6
High Risk : > 0.6
ALTMAN_Z_SCORE
Very good: > 3
Good : 1.8 - 3
High Risk : < 1.8
SPRINGATE_SCORE
High Risk : < 0.862
LIQUIDITY
CURRENT_RATIO
Very Good : 1.2 - 2
Good : 2+ (Too high and Inefficient)
High Risk : < 1
QUICK_RATIO
Very Good : 1 - 2
Good : 2+ (Too high and Inefficient)
High Risk : < 0.9
SLOAN_RATIO
Very Good: -10% to +10%
Good : -25% to -10% or +10% to +25%
High Risk: < -25% or > +25%
PROFITABILITY
RETURN_ON_ASSETS
Healthy : > 5%
Great : > 20%
RETURN_ON_EQUITY
Healthy : 10%
Great : > 40%
RETURN_ON_INVESTED_CAPITAL
Healthy : > 2%
Great : > 10%
Adapting a built-in [PineCoders]█ OVERVIEW
This Pine script shows how it can be quite simple to personalize a built-in indicator for your needs.
█ OUR SCRIPT
Our objective was to add the current values for volume and its moving average in prominent view, and use brighter colors than the built-in.
We started with the source code from the "Volume" built-in indicator. You can access the source code of many built-ins from the Pine Editor by clicking the "Open" button and choosing "New default built-in script..."
We changed the variable names so they conform to our Coding Conventions . Everybody is of course free to code their scripts the way they want; the conventions provide guidelines for those interested in Pine-specific recommendations. We use our conventions to make our code more readable, which helps readers of open-source publications. As Uncle Bob, a.k.a. Robert Cecil Martin, argues in his "Clean Code" book, code that is easier to read is also useful for its first user: you.
We assigned the colors we use to constants because they are used in multiple places in the script. If we decide to change them, we only need to change the constant definitions for the change to trickle down to the rest of the code.
We used the `inline` and `tooltip` parameters of input() to better organize our inputs and provide extra information under an "i" icon when needed.
We wanted to pack more information in the display of the moving average and volume than just the values, so we color-coded their background:
• When the MA is rising, the background of its table cell is in the bull color, otherwise it's in the bear color. The period used for the MA is also displayed in that cell's legend.
• When the current volume's value is higher/lower than its MA, the background of its cell is of bull/bear color.
We use a Pine table to display our values. We use extra cells to provide a configurable margin to the left, and a small space between the two values.
Because we only use constant colors in this script (i.e., values that are known at compile time), users can change the colors in the "Setting/Style" tab's color widgets. Users of the script can also use the tab to change other attributes of the plots.
Look first. Then leap.
WatermarkLook in the lower-left corner of this chart. If you load the script on your chart, you will see how the watermark animates. You can personalize it in the script's "Settings/Inputs" tab to use it in your chart snapshots.
Do keep in mind that if you use it when publishing ideas, videos or scripts, House Rules prohibit advertising on your chart.
For Pine coders
This script uses our new table feature in Pine to position a watermark on the chart, and the new varip type of variable to animate it.
Look first. Then leap.
Chart OscillatorI present you the chart oscillator where an oscillator (Stoch or RSI) is plotted
on the chart itself (instead of below the chart)
It is inspired on an idea of @Kablamicus
Instead of having the lines between 0 and 100, here the '0-100' are
- lowest(low, len)
- highest(high, len)
An overbought/oversold and a middle line is derived from these lines
and the oscillator goes in between.
It resembles very much the 'normal' oscillator, with a few extra's:
- you can see the movement of the candles against the oscillator
- S/R levels of oscillator, 50 line, overbought/oversold line, 0-100 line
Stoch:
RSI:
Also a table is included with the Stoch/RSI values
Cheers!
Performance TableThis indicator is based on the Performance section in the TradingView's sidebar and uses new Pine tables functionality. It compares the current price of the symbol to its past price and calculates the rate of return to make it easier to track the performance of the symbol. Note that the Performance sidebar is not updated in real-time, while this indicator is, so on real-time charts the values between the two can differ (the indicator's values are more recent).
The formula of the calculation is (Current value - Past value) * 100 / Past value , where Past value is:
1W - close 5 daily bars ago
1M - close 21 daily bars ago
3M - close 63 daily bars ago
6M - close 126 daily bars ago
YTD - close of the past year
1Y - close 251 daily bars ago
Realtime Delta Volume Action [LucF]█ OVERVIEW
This indicator displays on-chart, realtime, delta volume and delta ticks information for each bar. It aims to provide traders who trade price action on small timeframes with volume and tick information gathered as updates come in the chart's feed. It builds its own candles, which are optimized to display volume delta information. It only works in realtime.
█ WARNING
This script is intended for traders who can already profitably trade discretionary on small timeframes. The high cost in fees and the excitement of trading at small timeframes have ruined many newcomers to trading. While trading at small timeframes can work magic for adrenaline junkies in search of thrills rather than profits, I DO NOT recommend it to most traders. Only seasoned discretionary traders able to factor in the relatively high cost of such a trading practice can ever hope to take money out of markets in that type of environment, and I would venture they account for an infinitesimal percentage of traders. If you are a newcomer to trading, AVOID THIS TOOL AT ALL COSTS — unless you are interested in experimenting with the interpretation of volume delta combined with price action. No tool currently available on TradingView provides this type of close monitoring of volume delta information, but if you are not already trading small timeframes profitably, please do not let yourself become convinced that it is the missing piece you needed. Avoid becoming a sucker who only contributes by providing liquidity to markets.
The information calculated by the indicator cannot be saved on charts, nor can it be recalculated from historical bars.
If you refresh the chart or restart the script, the accumulated information will be lost.
█ FEATURES
Key values
The script displays the following key values:
• Above the bar: ticks delta (DT), the total ticks for the bar, the percentage of total ticks that DT represents (DT%)
• Below the bar: volume delta (DV), the total volume for the bar, the percentage of total volume that DV represents (DV%).
Candles
Candles are composed of four components:
1. A top shaped like this: ┴, and a bottom shaped like this: ┬ (picture a normal Japanese candle without a body outline; the values used are the same).
2. The candle bodies are filled with the bull/bear color representing the polarity of DV. The intensity of the body's color is determined by the DV% value.
When DV% is 100, the intensity of the fill is brightest. This plays well in interpreting the body colors, as the smaller, less significant DV% values will produce less vivid colors.
3. The bright-colored borders of the candle bodies occur on "strong bars", i.e., bars meeting the criteria selected in the script's inputs, which you can configure.
4. The POC line is a small horizontal line that appears to the left of the candle. It is the volume-weighted average of all price updates during the bar.
Calculations
This script monitors each realtime update of the chart's feed. It first determines if price has moved up or down since the last update. The polarity of the price change, in turn, determines the polarity of the volume and tick for that specific update. If price does not move between consecutive updates, then the last known polarity is used. Using this method, we can calculate a running volume delta and ticks delta for the bar, which becomes the bar's final delta values when the bar closes (you can inspect values of elapsed realtime bars in the Data Window or the indicator's values). Note that these values will all reset if the script re-executes because of a change in inputs or a chart refresh.
While this method of calculating is not perfect, it is by far the most precise way of calculating volume delta available on TradingView at the moment. Calculating more precise results would require scripts to have access to tick data from any chart timeframe. Charts at seconds timeframes do use exchange/broker ticks when the feeds you are using allow for it, and this indicator will run on them, but tick data is not yet available from higher timeframes. Also, note that the method used in this script is far superior to the intrabar inspection technique used on historical bars in my other "Delta Volume" indicators. This is because volume and ticks delta here are calculated from many more realtime updates than the available intrabars in history. Unfortunately, the calculation method used here cannot be used on historical bars, where intrabar inspection remains, in my opinion, the optimal method.
Inputs
The script's inputs provide many ways to personalize all the components: what is displayed, the colors used to display the information, and the marker conditions. Tooltips provide details for many of the inputs; I leave their exploration to you.
Markers
Markers provide a way for you to identify the points of interest of your choice on the chart. You control the set of conditions that trigger each of the five available markers.
You select conditions by entering, in the field for each marker, the number of each condition you want to include, separated by a comma. The conditions are:
1 — The bar's polarity is up/dn.
2 — `close` rises/falls ("rises" means it is higher than its value on the previous bar).
3 — DV's polarity is +/–.
4 — DV% rises (↕).
5 — POC rises/falls.
6 — The quantity of realtime updates rises (↕).
7 — DV > limit (You specify the limit in the inputs. Since DV can be +/–, DV– must be less than `–limit` for a short marker).
8 — DV% > limit (↕).
9 — DV+ rises for a long marker, DV– falls for a short.
10 — Consecutive DV+/DV– on two bars.
11 — Total volume rises (↕).
12 — DT's polarity is +/–.
13 — DT% rises (↕).
14 — DT+ rises for a long marker, DT– falls for a short.
Conditions showing the (↕) symbol do not have symmetrical states; they act more like filters. If you only include condition 4 in a marker's setup, for example, both long and short markers will trigger on bars where DV% rises. To trigger only long or short markers, you must add a condition providing directional differentiation, such as conditions 1 or 2. Accordingly, you would enter "1,4" or "2,4".
For a marker to trigger, ALL the conditions you specified for it must be met. Long markers appear on the chart as "Mx▲" signs under the values displayed below candles. Short markers display "Mx▼" over the number of updates displayed above candles. The marker's number will replace the "x" in "Mx▲". The script loads with five markers that will not trigger because no conditions are associated with them. To activate markers, you will need to select and enter the set of conditions you require for each one.
Alerts
You can configure alerts on this script. They will trigger whenever one of the configured markers triggers. Alerts do not repaint, so they trigger at the bar's close—which is also when the markers will appear.
█ HOW TO USE IT
As a rule, I do not prescribe expected use of my indicators, as traders have proved to be much more creative than me in using them. Additionally, I tend to think that if you expect detailed recommendations from me to be able to use my indicators, it's a sign you are in a precarious situation and should go back to the drawing board and master the necessary basics that will allow you to explore and decide for yourself if my indicators can be useful to you, and how you will use them. I will make an exception for this thing, as it presents fairly novel information. I will use simple logic to surmise potential uses, as contrary to most of my other indicators, I have NOT used this one to actually trade. Markets have a way of throwing wrenches in our seemingly bullet-proof rationalizing, so drive cautiously and please forgive me if the pointers I share here don't pan out.
The first thing to do is to disable your normal bars. You can do this by clicking on the eye icon that appears when you hover over the symbol's name in the upper-left corner of your chart.
The absolute value and polarity of DV mean little without perspective; that's why I include both total volume for the bar and the percentage that DV represents of that total volume. I interpret a low DV% value as indecision. If you share that opinion, you could, let's say, configure one of the markers on "DV% > 80%", for example (to do so you would enter "8" in the condition field of any marker, and "80" in the limit field for condition 8, below the marker conditions).
I also like to analyze price action on the bar with DV%. Small DV% values should often produce small candle bodies. If a small DV% value occurs on a bar with much movement and high volume, I'm thinking "tough battle with potential explosive power when one side wins". Conversely, large bodies with high DV% mean that large volume is breaching through multiple levels, or that nobody is suddenly willing to take the other side of a normal volume of trades.
I find the POC lines really interesting. First, they tell us the price point where the most significant action (taking into account both price occurrences AND volume) during the bar occurred. Second, they can be useful when compared against past values. Third, their color helps us in figuring out which ones are the most significant. Unsurprisingly, bunches of orange POCs tend to appear in consolidation zones, in pauses, and before reversals. It may be useful to often focus more on POC progression than on `close` values. This is not to say that OHLC values are not useful; looking, as is customary, for higher highs or lower lows, or for repeated tests of precise levels can of course still be useful. I do like how POCs add another dimension to chart readings.
What should you do with the ticks delta above bars? Old-time ticker tape readers paid attention to the sounds coming from it (the "ticker" moniker actually comes from the sound they made). They knew activity was picking up when the frequency of the "ticks" increased. My thinking is that the total number of ticks will help you in the same way, since increasing updates usually mean growing interest—and thus perhaps price movement, as increasing volatility or volume would lead us to surmise. Ticks delta can help you figure out when proportionally large, random orders come in from traders with other perspectives than the short-term price action you are typically working with when you use this tool. Just as volume delta, ticks delta are one more informational component that can help you confirm convergence when building your opinions on price action.
What are strong bars? They are an attempt to identify significance. They are like a default marker, except that instead of displaying "Mx▲/▼" below/above the bar, the candle's body is outlined in bright bull/bear color when one is detected. Strong bars require a respectable amount of conditions to be met (you can see and re-configure them in the inputs). Think of them as pushes rather than indications of an upcoming, strong and multi-bar move. Pushes do, for sure, often occur at the beginning of strong trends. You will often see a few strong bars occur at 2-3 bar intervals at the beginning or middle of trends. But they also tend to occur at tops/bottoms, which makes their interpretation problematic. Another pattern that you will see quite frequently is a final strong bar in the direction of the trend, followed a few bars later by another strong bar in the reverse direction. My summary analyses seemed to indicate these were perhaps good points where one could make a bet on an early, risky reversal entry.
The last piece of information displayed by the indicator is the color of the candle bodies. Three possible colors are used. Bull/bear is determined by the polarity of DV, but only when the bar's polarity matches that of DV. When it doesn't, the color is the divergence color (orange, by default). Whichever color is used for the body, its intensity is determined by the DV% value. Maximum intensity occurs when DV%=100, so the more significant DV% values generate more noticeable colors. Body colors can be useful when looking to confirm the convergence of other components. The visual effect this creates hopefully makes it easier to detect patterns on the chart.
One obvious methodology that comes to mind to trade with this tool would be to use another indicator like Technical Ratings at a higher timeframe to identify the larger context's trend, and then use this tool to identify entries for short-term trades in that direction.
█ NOTES AND RAMBLINGS
Instant Calculations
This indicator uses instant values calculated on the bar only. No moving averages or calculations involving historical periods are used. The only exception to this rule is in some of the marker conditions like "Two consecutive DV+ values", where information from the previous bar is used.
Trading Small vs Long Timeframes
I never trade discretionary at the 5sec–5min timeframes this indicator was designed to be used with; I trade discretionary at 1D, 1W and 1M timeframes, and let systems trade at smaller timeframes. The higher the timeframe you trade at, the fewer fees you will pay because you trade less and are not churning trading volume, as is inevitable at smaller timeframes. Trading at higher timeframes is also a good way to gain an instant edge on most of the trading crowd that has its nose to the ground and often tends to forget the big picture. It also makes for a much less demanding trading practice, where you have lots of time to research and build your long-term opinions on potential future outcomes. While the future is always uncertain, I believe trades riding on long-term trends have stronger underlying support from the reality outside markets.
To traders who will ask why I publish an indicator designed for small timeframes, let me say that my main purpose here is to showcase what can be done with Pine. I often see comments by coders who are obviously not aware of what Pine is capable of in 2021. Since its humble beginnings seven years ago, Pine has grown and become a serious programming language. TradingView's growing popularity and its ongoing commitment to keep Pine accessible to newcomers to programming is gradually making Pine more and more of a standard in indicator and strategy programming. The technical barriers to entry for traders interested in owning their trading practice by developing their personal tools to trade have never been so low. I am also publishing this script because I value volume delta information, and I present here what I think is an original way of analyzing it.
Performance
The script puts a heavy load on the Pine runtime and the charting engine. After running the script for a while, you will often notice your chart becoming less responsive, and your chart tab can take longer to activate when you go back to it after using other tabs. That is the reason I encourage you to set the number of historical values displayed on bars to the minimum that meets your needs. When your chart becomes less responsive because the script has been running on it for many hours, refreshing the browser tab will restart everything and bring the chart's speed back up. You will then lose the information displayed on elapsed bars.
Neutral Volume
This script represents a departure from the way I have previously calculated volume delta in my scripts. I used the notion of "neutral volume" when inspecting intrabar timeframes, for bars where price did not move. No longer. While this had little impact when using intrabar inspection because the minimum usable timeframe was 1min (where bars with zero movement are relatively infrequent), a more precise way was required to handle realtime updates, where multiple consecutive prices often have the same value. This will usually happen whenever orders are unable to move across the bid/ask levels, either because of slow action or because a large-volume bid/ask level is taking time to breach. In either case, the proper way to calculate the polarity of volume delta for those updates is to use the last known polarity, which is how I calculate now.
The Order Book
Without access to the order book's levels (the depth of market), we are limited to analyzing transactions that come in the TradingView feed for the chart. That does not mean the volume delta information calculated this way is irrelevant; on the contrary, much of the information calculated here is not available in trading consoles supplied by exchanges/brokers. Yet it's important to realize that without access to the order book, you are forfeiting the valuable information that can be gleaned from it. The order book's levels are always in movement, of course, and some of the information they contain is mere posturing, i.e., attempts to influence the behavior of other players in the market by traders/systems who will often remove their orders when price comes near their order levels. Nonetheless, the order book is an essential tool for serious traders operating at intraday timeframes. It can be used to time entries/exits, to explain the causes of particular price movements, to determine optimal stop levels, to get to know the traders/systems you are betting against (they tend to exhibit behavioral patterns only recognizable through the order book), etc. This tool in no way makes the order book less useful; I encourage all intraday traders to become familiar with it and avoid trading without one.
Indicator PanelHello All,
This script shows Indicator panel in a Table. Table.new() is a new feature and released today! Thanks a lot to Pine Team to add this new great feature! This new feature is a game changer!
The script shows indicator values for each symbol and changes background color of each cell by using current and last values of the indicators for each symbol. if current value is greater than last value then backgroung color is green, if lower than last value then red, if they are equals then gray.
You can choose the indicators to display. Number of columns in the table is dynamic and is changed by number of the indicators.
You can choose 5 different Symbols, 6 Indicators and 2 Simple or Exponential Moving averages, you can set type of moving averages and the lengths. You can also set the lengths for each Indicators.
Indicators:
- RSI
- MACD ( MACD and Signal and Histogram )
- DMI ( +DI and -DI + and ADX )
- CCI
- MFI
- Momentum
- MA with Length 50 (length can be set)
- MA with Length 200 (length can be set)
In this example RSI, MACD and MA 200 were chosen, you can see how table size changes dynamically:
Enjoy!
'Golden ratio' Cubes - 'GoRaC'The difference between 2 points is plotted here using 'Golden ratio' cubes
(working differently than my 'Golden ratio spiral - 'GoRaS')
The 2 points can be 'high/low' or 'max(open/close)/min(open/close)',
with the possibility of higher resolution, the following examples are with 1 week resolution
By extending the lines you can spot support/resistance area's
You can reverse:
or 'mirror':
The 'bars back' can be set to get a previous period
Important:
In the example of a week resolution on a daily chart:
if you set '0', and it is Friday, the week isn't finished yet!
Everything still can change (= repaint)
1 bar back (in this case 7 daily bars back since the res = week!):
2 bars back:
3 bars back:
Here using 'high/low' and lines extended to the left:
or 'max(open/close)/min(open/close)' and lines extended to the left:
Cheers!
Penrose DiagramGreetings Traders! This is my measly 2 dimensional non-curved take on a Penrose Diagram .
What is a Penrose Diagram?
jila.colorado.edu
"A Penrose diagram is a kind of spacetime diagram arranged to make clear the complete causal structure of any given geometry. They are an indispensable map for navigating inside a black hole. Roger Penrose, who invented this kind of diagram in the early 1950s, himself calls them conformal diagrams." - Source: jila.colorado.edu
Penrose Diagrams allow an understanding of an infinite surface by projecting 4D Spheres on 2 Dimension Squares. The 4D shape within the 2D Square has the ability to reference a definable edge on an infinite boundary.
I thought this concept interesting, as I tend to hold a viewpoint of price being infinite in its own nature, and tried to combine the concepts as best I could.
In a true Penrose Diagram, you'd see curvature as you reached the edge of each Diagram Square to represent the curvature of space-time and the distorted boundary. However due to limitations of Pine and perhaps my own abilities, I decided to go the cheap route and opt for straight lines, as well as beginning each new Penrose Diagram on a new Session Start.
Also in this version, you will notice on some instruments that, as an example, two triangles overlap each other when you Extend the Penrose Diagram. The result of this is intentional and is due to the calculation of the first Triangle for the Penrose Diagram. The data points for each triangle are variable upon the average highest/lowest point from Open Price and the Max/Min highest/lowest point from Open Price over a variable amount of days. For typical instruments such as Futures products and Forex, it is common to see differences between the Highest High Breakout & Lowest Low Breakout, and therefore a difference between the true center of the Triangle and the corresponding angles. I prefer to use a 20-Day Average Period for Forex and Futures Products, for Crypto a 30 Day Average Period, all adjustable from the options menu.
Due to the differences between the data points(particularly the difference from the Session Open to the Highest High/ Lowest Low), the initial values for the extended Penrose Diagram will sometimes overlap with the initial triangle for Penrose Diagram creation. However keep in mind, all triangles are exactly the same, just rotated 180°and translated above and below the current Session Open Price. You can confirm this yourself using the handy Triangle Tool in your Drawing Tools directly from your TradingView Chart.
Haven't managed to play around on all instruments yet, so give it a whirl, and any feedback is greatly appreciated. Hope you enjoy!
-@DayTradingOil
Max GainThis indicator is meant to be used for coming up with price targets based on past performances of rallies/selloffs.
It shows how much a trade could have made over a 30-day period (or other length of time) in terms of percentage gain.
It also show how much could have been lost in terms of percentage loss
The green plot shows percentage gain from current high to the low of the previous 30 days.
The red plot shows adjusted percentage loss from current low to the high of the previous 30 days.
The 30 can be adjusted and the chart can be used on any time interval.
Note on max loss adjustment:
Max loss percentage is adjusted to be higher to account for the fact that a percentage loss corresponds to a percentage
gain of a greater amount. For instance, a loss of 25% can only be recovered with a percentage gain of 33%.
A 25% loss looking at the chart from left to right would be a 33% gain looking at the same price
action from right to left. In order to compare apples to apples visually and performance wise, max loss percent needs to be adjusted.
The actual max loss percent is calculated and plottable but is not plotted by default because it is less useful and adds clutter.
There is not a great difference between actual max loss and adjusted max loss under everyday market conditions, but
major selloffs (SPY 2020), short squeezes (GME 2021), or other unusually directional moves will display percentage losses
that, in absolute terms, should be considered to be fairly incorrect. The adjusted percentages are good indicators of
relative performance when comparing the magnitudes to the magnitudes of the max gain percentages and
are more visually meaningful than the actual max loss percentages in every situation, so they are plotted despite having incorrect values.
Note on bear markets:
This indicator was designed for bull markets but should it be used in bear markets the indicators that are and aren't
plotted should be swapped using the plot check boxes in the settings dialogue if there is interest in using the loss percentages
for actual loss amount calculations while maintaining visual/performance adjustment
As can been seen in the example chart a gain of 16.3% to 17.1% appears to be a resistance level. This level was recently broken through and the next resistance is 24.5%.
The target is a 24.5% gain from the anticipated 30-day low at the time when the price can be expected to reach a 25.4% gain at the gain rate observed in recent rallies.
Previous rallies are shown for reference with their 30-day periods and corresponding gain percentages which are plotted below.
A selloff is shown in red for reference as well. It was drawn backward to trick the tool into thinking it was a gain, so as to demonstrate logic behind the adjustment.
In reality, this was closer to a 9.5% loss, not 10.55%.
I am still experimenting with this indicator to see how to best use it. Ultimately, it helps me do what I was already doing with the percentage gain tools
but now I can do those analyses in a more systematic manner and with charting. Please feel free to ask questions.
Technical Ratings█ OVERVIEW
This indicator calculates TradingView's well-known "Strong Buy", "Buy", "Neutral", "Sell" or "Strong Sell" states using the aggregate biases of 26 different technical indicators.
█ FEATURES
Differences with the built-in version
• You can adjust the weight of the Oscillators and MAs components of the rating here.
• The built-in version produces values matching the states displayed in the "Technicals" ratings gauge; this one does not always, where weighting is used.
• A strategy version is also available as a built-in; this script is an indicator—not a strategy.
• This indicator will show a slightly different vertical scale, as it does not use a fixed scale like the built-in.
• This version allows control over repainting of the signal when you do not use a higher timeframe. Higher timeframe (HTF) information from this version does not repaint.
• You can configure markers on signal breaches of configurable levels, or on advances declines of the signal.
The indicator's settings allow you to:
• Choose the timeframe you want calculations to be made on.
• When not using a HTF, you can select a repainting or non-repainting signal.
• When using both MAs and Oscillators groups to calculate the rating, you can vary the weight of each group in the calculation. The default is 50/50.
Because the MAs group uses longer periods for some of its components, its value is not as jumpy as the Oscillators value.
Increasing the weight of the MAs group will thus have a calming effect on the signal.
• Alerts can be created on the indicator using the conditions configured to control the display of markers.
Display
The calculated rating is displayed as columns, but you can change the style in the inputs. The color of the signal can be one of three colors: bull, bear, or neutral. You can choose from a few presets, or check one and edit its color. The color is determined from the rating's value. Between 0.1 and -0.1 it is in the neutral color. Above/below 0.1/-0.1 it will appear in the bull/bear color. The intensity of the bull/bear color is determined by cumulative advances/declines in the rating. It is capped to 5, so there are five intensities for each of the bull/bear colors.
The "Strong Buy", "Buy", "Neutral", "Sell" or "Strong Sell" state of the last calculated value is displayed to the right of the last bar for each of the three groups: All, MAs and Oscillators. The first value always reflects your selection in the "Rating uses" field and is the one used to display the signal. A "Strong Buy" or "Strong Sell" state appears when the signal is above/below the 0.5/-0.5 level. A "Buy" or "Sell" state appears when the signal is above/below the 0.1/-0.1 level. The "Neutral" state appears when the signal is between 0.1 and -0.1 inclusively.
Five levels are always displayed: 0.5 and 0.1 in the bull color, zero in the neutral color, and -0.1 and - 0.5 in the bull color.
The levels that can be used to determine the breaches displaying long/short markers will only be visible when their respective long/short markers are turned on in the "Direction" input. The levels appear as a bright dotted line in bull/bear colors. You can control both levels separately through the "Longs Level" and "Shorts Level" inputs.
If you specify a higher timeframe that is not greater than the chart's timeframe, an error message will appear and the indicator's background will turn red, as it doesn't make sense to use a lower timeframe than the chart's.
Markers
Markers are small triangles that appear at the bottom and top of the indicator's pane. The marker settings define the conditions that will trigger an alert when you configure an alert on the indicator. You can:
• Choose if you want long, short or both long and short markers.
• Determine the signal level and/or the number of cumulative advances/declines in the signal which must be reached for either a long or short marker to appear.
Reminder: the number of advances/declines is also what controls the brightness of the plotted signal.
• Decide if you want to restrict markers to ones that alternate between longs and shorts, if you are displaying both directions.
This helps to minimize the number of markers, e.g., only the first long marker will be displayed, and then no more long markers will appear until a short comes in, then a long, etc.
Alerts
When you create an alert from this indicator, that alert will trigger whenever your marker conditions are confirmed. Before creating your alert, configure the makers so they reflect the conditions you want your alert to trigger on.
The script uses the alert() function, which entails that you select the "Any alert() function call" condition from the "Create Alert" dialog box when creating alerts on the script. The alert messages can be configured in the inputs. You can safely disregard the warning popup that appears when you create alerts from this script. Alerts will not repaint. Markers will appear, and thus alerts will trigger, at the opening of the bar following the confirmation of the marker condition. Markers will never disappear from the bar once they appear.
Repainting
This indicator uses a two-pronged approach to control repainting. The repainting of the displayed signal is controlled through the "Repainting" field in the script's inputs. This only applies when you have "Same as chart" selected in the "Timeframe" field, as higher timeframe data never repaints. Regardless of that setting, markers and thus alerts never repaint.
When using the chart's timeframe, choosing a non-repainting signal makes the signal one bar late, so that it only displays a value once the bar it was calculated has elapsed. When using a higher timeframe, new values are only displayed once the higher timeframe completes.
Because the markers never repaint, their logic adapts to the repainting setting used for the signal. When the signal repaints, markers will only appear at the close of a realtime bar. When the signal does not repaint (or if you use a higher timeframe), alerts will appear at the beginning of the realtime bar, since they are calculated on values that already do not repaint.
█ CALCULATIONS
The indicator calculates the aggregate value of two groups of indicators: moving averages and oscillators.
The "MAs" group is comprised of 15 different components:
• Six Simple Moving Averages of periods 10, 20, 30, 50, 100 and 200
• Six Exponential Moving Averages of the same periods
• A Hull Moving Average of period 9
• A Volume-weighed Moving Average of period 20
• Ichimoku
The "Oscillators" group includes 11 components:
• RSI
• Stochastic
• CCI
• ADX
• Awesome Oscillator
• Momentum
• MACD
• Stochastic RSI
• Wiliams %R
• Bull Bear Power
• Ultimate Oscillator
The state of each group's components is evaluated to a +1/0/-1 value corresponding to its bull/neutral/bear bias. The resulting value for each of the two groups are then averaged to produce the overall value for the indicator, which oscillates between +1 and -1. The complete conditions used in the calculations are documented in the Help Center .
█ NOTES
Accuracy
When comparing values to the other versions of the Rating, make sure you are comparing similar timeframes, as the "Technicals" gauge in the chart's right pane, for example, uses a 1D timeframe by default.
For coders
We use a handy characteristic of array.avg() which, contrary to avg() , does not return na when one of the averaged values is na . It will average only the array elements which are not na . This is useful in the context where the functions used to calculate the bull/neutral/bear bias for each component used in the rating include special checks to return na whenever the dataset does not yet contain enough data to provide reliable values. This way, components gradually kick in the calculations as the script calculates on more and more historical data.
We also use the new `group` and `tooltip` parameters to input() , as well as dynamic color generation of different transparencies from the bull/bear/neutral colors selected by the user.
Our script was written using the PineCoders Coding Conventions for Pine .
The description was formatted using the techniques explained in the How We Write and Format Script Descriptions PineCoders publication.
Bits and pieces were lifted from the PineCoders' MTF Selection Framework .
Look first. Then leap.
Color Gradient Framework [PineCoders]█ OVERVIEW
This indicator shows how you can use the new color functions in Pine to generate color gradients. We provide functions that will help Pine coders generate gradients for multiple use cases using base colors for bull and bear states.
█ CONCEPTS
For coders interested in maximizing the use of color in their scripts, TradingView has added new color functions and new functionality to existing functions. For us coders, this translates in the ability to generate colors on the fly and use dynamic colors ("series color") in more places.
New functions allow us to:
• Generate colors dynamically from calculated RGBA components ("A" is the Alpha channel, known to Pine coders as the "transparency"). See color.rgb() .
• Extract RGBA components from existing colors. See color.r() , color.g() , color.b() and color.t() .
• Generate linear gradients between two colors. See color.from_gradient() .
Improvements to existing color/plotting functions allow more flexible use of color:
• plotcandle() now accepts a "series color" argument for its `wickcolor` and `bordercolor` parameters.
• plotarrow() now accepts a "series color" argument for its `colorup` and `colordown` parameters.
Gradients are not only useful to make script visuals prettier; they can be used to pack more information in your displays. Our gradient #4 goes overboard with the concept by using a different gradient for the source line, its fill, and the background.
█ OUR SCRIPT
The script presents four functions to generate gradients:
f_c_gradientRelative(_source, _min, _max, _c_bear, _c_bull)
f_c_gradientRelativePro(_source, _min, _max, _c_bearWeak, _c_bearStrong, _c_bullWeak, _c_bullStrong)
f_c_gradientAdvDec(_source, _center, _c_bear, _c_bull)
f_c_gradientAdvDecPro(_source, _center, _steps, _c_bearWeak, _c_bearStrong, _c_bullWeak, _c_bullStrong)
The relative gradient functions are useful to generate gradients on a source that oscillates between known upper/lower limits. They use the relative position of the source between the `_min` and `_max` levels to generate the color. A centerline is derived from the `_min` and `_max` levels. The source's position above/below that centerline determines if the bull/bear color is used, and the relative position of the source between the centerline and the max/min level determines the gradient of the bull/bear color.
The advance/decline gradient functions are useful to generate gradients on a source for which min/max levels are unknown. These functions use source advances and declines to determine a gradient level. The `f_c_gradientAdvDec()` version uses the historical maximum of advances/declines to determine how many correspond to the strongest bull/bear colors, making its gradients adaptive. The `f_c_gradientAdvDecPro()` version requires the explicit number of advances/declines that correspond to the strongest bull/bear colors. This is useful when coloring chart bars, for example, where too many gradient levels are difficult to distinguish. Using the Pro version of the function allows you to limit the number of gradient levels to 5, for example, so that transitions are fewer, but more obvious. The `_center` parameter of the advance/decline functions allows them to determine which of the bull/bear colors to use.
Note that the custom `f_colorNew(_color, _transp)` function we use in our script should soon no longer be necessary, as changes are under way to allow color.new() to accept series arguments.
Inputs
The script's inputs demonstrate one way you can allow users to choose base bull/bear colors. Because users can modify any of the colors, only two are technically needed: one for bull, one for bear, as we do for the configuration of the bull/bear colors for the background in the gradient #4 configuration. Providing a few presets from which users can choose can be useful for color-challenged script users, but that type of inputs has the disadvantage of not rendering optimally in all OS/Browser environments.
You can use the inputs to select one of eight gradient demonstrations to display.
█ THANKS
Thanks to the PineCoders team for validating the code and description of this publication.
Thanks also to the many TradingView devs from multiple teams who made these improvements to Pine colors possible.
Look first. Then leap.