QuarterCandlesChanges candle color when close is within the top 25% or bottom 25% of candle range (High - Low) on the last candle update.
Due to limitations of barcolor command, I'd suggest that you turn OFF the candle borders (chart settings--> right click on chart --> settings -->symbol and uncheck the border option) to ensure that the bar color is easily identifiable.
Stats
Price and Indicator CorrelationFIRST, CHANGE SOURCE OF INDICATOR FROM CLOSE TO WHATEVER INDICATOR YOU ARE COMPARING TO PRICE!!!!
Confirming Indicator Validity: By calculating the correlation coefficient between the price and a specific indicator, you can assess the degree to which the indicator and price move together. If there is a high positive correlation, it suggests that the indicator tends to move in the same direction as the price, increasing confidence in the indicator's validity. On the other hand, a low or negative correlation may indicate a weaker relationship between the indicator and price, signaling caution in relying solely on that indicator for trading decisions.
Identifying Divergence: Divergence occurs when the price and the indicator move in opposite directions. By monitoring the correlation coefficient, you can identify periods of divergence between the price and the selected indicator. Divergence may signal a potential reversal or significant price move, providing an opportunity to enter or exit trades.
Enhancing Trading Strategies: The correlation coefficient can be used to enhance trading strategies by incorporating the relationship between the price and the indicator. For example, if the correlation coefficient consistently shows a strong positive correlation, you may use the indicator as a confirmation tool for price-based trading signals. Conversely, if the correlation is consistently negative, it may indicate an inverse relationship that could be used for contrarian trading strategies.
Indicator Optimization : The correlation coefficient can help traders compare the effectiveness of different indicators. By calculating the correlation coefficient for multiple indicators against the price, you can identify which indicators have a stronger or weaker relationship with price movements. This information can guide the selection and optimization of indicators in your trading strategy.
Example:
Divergence Backtester - V2Further attempts to study divergence impact on price in shorter terms.
Previous study can be found here:
In this script, we are trying to gather the stats based on last two pivot state together. For example, Individual table of Pivot High Projection is as explained below:
But, by looking at the bigger picture, we can further estimate following things regarding the current unconfirmed pivot and the new pivot which is yet to be formed.
Volume PanelDisplays volume data in panel on bottom right of screen. Shows current bar, change from last bar and average of last 20 bars. This number can be changed in settings if you wish to have the average calculated on a different amount of bars.
Daily GAP StatsI did not write the script from scratch but rather started editing code of an existing one. The original code came from a script called GAP DETECTOR by @Asch-
First up: I am a trader, not a programmer and therefore my code most likely is inefficient. If someone with more expertise would like to help and optimize it - feel free to get in touch, I am always happy to learn some new tricks. :)
This script does 2 things:
- It shows daily gaps stats based on user inputs
- It shows color coded labels on gap days with additional information in tooltips ( important: make sure to read 'known issues/limitations' at the end )
User Inputs
==========
Although the input dialog is pretty straight forward, I do a quick rundown:
- Length: max lookback time
- Gap Direction: self explanatory
- Show All Gaps | Cont Only | Reversal Only | Off:
This refers to the way labels are displayed on gap days (again: make sure to read known issues/limitations!)
- Show All Gaps: does what it says
- Cont Only: only shows gaps where price continued in the gap direction. If you filter for gap ups and chose 'Cont only' you will only see labels on gap days where price closed above the open (and vice versa if you scan for gap downs).
- Reversal Only: you will only see labels for closes below the open on gap up days (and the opposite on gap down days)
- Off: self explanatory
- Gap Measure in ATR/PCT: self explanatory, ATR is calculated over a 10d period
- Gap Size (Abs Values): no negative values allowed here. If you filter for gap downs and enter 3 it means it will show gaps where the stock fell more than 3 ATR/PCT on the open.
- RVOL Factor: along with significant gaps should come significant volume. RVOL = volume of the gap day / 20d average volume
- Viewing Options: Placing the stats label in the window is a bit tricky (see knonw issues/limitations) and I was not sure which way I liked better. See for yourself what works best for you.
Known Isusses/Limitations:
=======================
- Positioning of the stats table:
As to my knowledge, Tradingview only allows label positioning relative to price and not relative to the chart window. I tried to always display the gap stats table in the upper right corner, using 52wk high as y-coordinate. This works ok most of the time, but is not pretty. If anybody has some fancy way to tag the label in a fixed position, please get in touch.
- Max number of labels per script:
TradingView has a limitation that allows a maxium of ~50 labels per script. If there are more labels, TradingView will automatically cut the oldest ones, without any notification. I have found this behaviour to be rather inconsistent - sometimes it'll dump labels even if there are a lot fewer than 50. Hopefully TradingView will drop this limitation at one point in the future.
Important: The inconsistent display of the gap day labels has NO INFLUENCE on the calculations in the gap stats table - the count and the calculations are complete and correct!
Alpha Performance of PeriodAlpha Performance of Period (PoP) produces a visualization of returns (gains and losses) over a quarterly, monthly, or annual period. It also displays the total % gain and loss over any length of days, months, and years as defined by the user.
Performance of Period (PoP) can be used to understand the performance of an asset over multiple periods using a single chart layout, and to compare the performance of different assets by using a multi-chart layout.
This can, for example, be used to compare the NASDAQ, S&P, and DJI over the past 20 years to create a dow vs. nasdaq vs. s&p performance chart. This can help you understand a comparison of historical returns by showing which performs the best month-over-month, quarter-to-quarter, year-to-year, throughout any custom period of days/months/years.
The ability to get a visualization of the % gain/loss can help to better understand how markets have performed over time and which markets have historically performed the best.
Check out the up and coming Educational Idea we will be releasing soon after this is live to see an example of how we use this tool.
Current Period Label
-----
Current Period : This label shows the current period's performance only when you hover over it.
(This label is located to the left of the current period's open candle and at the current candles close price)
TICKER "Time Period" Performance Label
-----
Total Period Gain : The total of all % gain periods from the start to end date.
Largest Period Gain : The biggest % gain period from the start to end date.
Total Period Loss : The total of all % loss periods from the start to end date.
Largest Period Loss : The biggest % loss period from the start to end date.
Total period Performance : The total % performance, the difference between the total gain and total loss.
NOTE : The "Current Period" performance is excluded from ALL five of the above-mentioned figures. This was done to avoid giving inaccurate comparison figures due to the period not being finished yet.
Inputs
-----
Current Script Version + Info : A drop-down list of instructions for the user to refer to.
Dark Mode Labels : Toggle on for Dark Mode. This is done since Labels text and background color can not be adjusted separately within the visual inputs so this is the best fit solution.
Time Period of Returns : Pick the period of performance you would like to emulate monthly/quarterly/annual.
Start Date : The day to start tracking performance.
Start Month : The month to start tracking performance.
Start Year : The year to start tracking performance.
End Date : The day to stop tracking performance.
End Month : The month to stop tracking performance.
End Year : The year to stop tracking performance.
As always if you have any feedback let us know in the comments and leave a like if you enjoy this tool :)
Buy The Dip - Does It Work?Buying the dip has become a meme in crypto, but does it actually work?
Using this script you can find out.
The dip is defined here as the average true range multiplied by a number of your choosing (dipness input) and subtracted from the low.
When price crosses under the dip level, a long is initiated. The long is then closed using a timestop (default value 20 bars), no fancy exits here.
A general rule for buying the dip should be to be more passive in a bull market and aggressive in a bear market.
Same goes for all counter trend trading.
Heres a few other examples of dip buying statistics using the H4 timeframe:
50% profitable, 1.692 Profit Factor
BINANCE:PIVXBTC
56.52% profitable, 1.254 Profit Factor
BINANCE:KMDBTC
27.27% Profitable, 0.257 Profit Factor... yikes!
BINANCE:BTSBTC
73.33% Profitable, 13.627 Profit Factor... o.O
BINANCE:MANABTC
Interquartile Range BandsInterquartile Range Bands script.
This indicator was originally developed by Alex Orekhov at his home.
The idea based on the interquartile range en.wikipedia.org
If price breaks out from the bands then it is `outlier` price.
After breakouts price always returns to its median.
Watch squeeze/expansion periods.
Anyway use it as a supplement to the other indicators.
I will glad to get your feedback.