Rsi/W%R/Stoch/Mfi: HTF overlay mini-plotsOverlay mini-plots for various indicators. Shows current timeframe; and option to plot 2x higher timeframes (i.e. 15min and 60min on the 5min chart above).
The idea is to de-clutter chart when you just want real-time snippets for an indicator.
Useful for gauging overbought/oversold, across timeframes, at a glance.
~~Indicators~~
~RSI: Relative strength index
~W%R: Williams percent range
~Stochastic
~MFI: Money flow index
~~Inputs~~
~indicator length (NB default is set to 12, NOT the standard 14)
~choose 2x HTFs, show/hide HTF plots
~choose number of bars to show (current timeframe only; HTF plots show only 6 bars)
~horizontal position: offset (bars); shift plots right or left. Can be negative
~vertical position: top/middle/bottom
~other formatting options (color, line thickness, show/hide labels, 70/30 lines, 80/20 lines)
~~tips~~
~should be relatively easy to add further indicators, so long as they are 0-100 based; by editing lines 9 and 11
~change the vertical compression of the plots by playing around with the numbers (+100, -400, etc) in lines 24 and 25
HTF
switches [experimental / tools]This scripts shows a tool which enables switching between settings without opening the settings
In this case you can switch between a RSI of 3 different tickers, 3 different higher timeframes, and 4 different lengths.
How does it work?
The position of a 'time line' is compared with the position of a box.
Changing the position of the line changes the settings.
The settings need to be set upfront though,
if you want to switch between length 7, 10, 14, 21 they need to be set first.
Example:
One wants to switch between RSI of SOLUSDT, ADAUSDT and FILUSDT
First set your tickers
-> Settings -> Set 1 -> Ticker
Then tap/click and move the line
And there you go!
The same with Timeframe and Length
Important:
It is not possible to automatically set the boxes/line at current time,
so these (settings -> date at Box, Line) need to be set in the beginning
Cheers!
[BM] HTF Candle Evolution█ OVERVIEW
This script shows how a higher timeframe candle evolves over time.
It was created as a visual aid to #TheStrat and provides a new way of looking at Timeframe Continuity.
█ FEATURES
General
HTF: Higher Timeframe selection with dropdown and ability to manually input a timeframe that is not present in the dropdown.
Label: Show a label with the selected higher timeframe.
Marker: Shows a marker symbol at the start of each new higher timeframe.
Align: Aligns the candles around a selected center line.
The Strat
Multi-timeframe analysis is used extensively in #TheStrat (created by Rob Smith), so the ability to add #TheStrat coloring has been made available.
Scenario: Define the colors for the strat scenario's.
Coloring of: Choose which part of the candles you want the selected strat scenario colors to be applied to.
Band: Display a band that shows the active strat scenario color of the selected higher timeframe.
All features are completely customizable.
HTF Candle Boxes for LTF Charts
This indicator allows you to show an outline of a Higher Time Frame (HTF) candle on a Lower Time Frame (LTF) chart. Options include selecting the HTF interval, and an option to either show a single shaded Box for the candle (High to Low), or a shaded box for the body (Open to Close) with the High to Low shown in an unshaded box. The purpose is to easily visualise what the previous HTF candles look like as you are working on the lower charts, for example was yesterday's candle Bullish, Bearsish, indecision, a Doji etc.
HighTimeframeSamplingLibrary "HighTimeframeSampling"
Library for sampling high timeframe (HTF) data. Returns an array of historical values, an arbitrary historical value, or the highest/lowest value in a range, spending a single security() call.
An optional pass-through for the chart timeframe is included. Other than that case, the data is fixed and does not alter over the course of the HTF bar. It behaves consistently on historical and elapsed realtime bars.
The first version returns floating-point numbers only. I might extend it if there's interest.
🙏 Credits: This library is (yet another) attempt at a solution of the problems in using HTF data that were laid out by Pinecoders - to whom, especially to Luc F, many thanks are due - in "security() revisited" - which I recommend you consult first. Go ahead, I'll wait.
All code is my own.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHAT'S THE PROBLEM? OR, WHY NOT JUST USE SECURITY()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many difficulties with using HTF data, and many potential solutions. It's not really possible to convey it only in words: you need to see it on a chart.
Before using this library, please refer to my other HTF library, HighTimeframeTiming: which explains it extensively, compares many different solutions, and demonstrates (what I think are) the advantages of using this very library, namely, that it's stable, accurate, versatile and inexpensive. Then if you agree, come back here and choose your function.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MOAR EXPLANATION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🧹 Housekeeping: To see which plot is which, turn line labels on: Settings > Scales > Indicator Name Label. Vertical lines at the top of the chart show the open of a HTF bar: grey for historical and white for real-time bars.
‼ LIMITATIONS: To avoid strange behaviour, use this library on liquid assets and at chart timeframes high enough to reliably produce updates at least once per bar period.
A more conventional and universal limitation is that the library does not offer an unlimited view of historical bars. You need to define upfront how many HTF bars you want to store. Very large numbers might conceivably run into data or performance issues.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BRING ON THE FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@function f_HTF_Value(string _HTF, float _source, int _arrayLength, int _HTF_Offset, bool _useLiveDataOnChartTF=false)
Returns a floating-point number from a higher timeframe, with a historical operator within an abitrary (but limited) number of bars.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't go back further in history than this number of bars (minus one, because the current/most recent available bar is also stored).
@param int _HTF_Offset is the historical operator for the value you want to return. E.g., if you want the most recent fixed close, _source=close and _HTF_Offset = 0. If you want the one before that, _HTF_Offset=1, etc.
The number of HTF bars to look back must be zero or more, and must be one less than the number of bars stored.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches the raw source values from security(){0}.
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@returns a floating-point value that you requested from the higher timeframe.
@function f_HTF_Array(string _HTF, float _source, int _arrayLength, bool _useLiveDataOnChartTF=false, int _startIn, int _endIn)
Returns an array of historical values from a higher timeframe, starting with the current bar. Optionally, returns a slice of the array. The array is in reverse chronological order, i.e., index 0 contains the most recent value.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to keep in the array.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param int _startIn is the array index to begin taking a slice. Must be at least one less than the length of the array; if out of bounds it is corrected to 0.
@param int _endIn is the array index BEFORE WHICH to end the slice. If the ending index of the array slice would take the slice past the end of the array, it is corrected to the end of the array. The ending index of the array slice must be greater than or equal to the starting index. If the end is less than the start, the whole array is returned. If the starting index is the same as the ending index, an empty array is returned. If either the starting or ending index is negative, the entire array is returned (which is the default behaviour; this is effectively a switch to bypass the slicing without taking up an extra parameter).
@returns an array of HTF values.
@function f_HTF_Highest(string _HTF="", float _source, int _arrayLength, bool _useLiveDataOnChartTF=true, int _rangeIn)
Returns the highest value within a range consisting of a given number of bars back from the most recent bar.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't have a range greater than this number.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param _rangeIn is the number of bars to include in the range of bars from which we want to find the highest value. It is NOT the historical operator of the last bar in the range. The range always starts at the current bar. A value of 1 doesn't make much sense but the function will generously return the only value it can anyway. A value less than 1 doesn't make sense and will return an error. A value that is higher than the number of stored values will be corrected to equal the number of stored values.
@returns a floating-point number representing the highest value in the range.
@function f_HTF_Lowest(string _HTF="", float _source, int _arrayLength, bool _useLiveDataOnChartTF=true, int _rangeIn)
Returns the lowest value within a range consisting of a given number of bars back from the most recent bar.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't go back further in history than this number of bars (minus one, because the current/most recent available bar is also stored).
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param _rangeIn is the number of bars to include in the range of bars from which we want to find the highest value. It is NOT the historical operator of the last bar in the range. The range always starts at the current bar. A value of 1 doesn't make much sense but the function will generously return the only value it can anyway. A value less than 1 doesn't make sense and will return an error. A value that is higher than the number of stored values will be corrected to equal the number of stored values.
@returns a floating-point number representing the lowest value in the range.
HighTimeframeTimingLibrary "HighTimeframeTiming"
@description Library for sampling high timeframe (HTF) historical data at an arbitrary number of HTF bars back, using a single security() call.
The data is fixed and does not alter over the course of the HTF bar. It also behaves consistently on historical and elapsed realtime bars.
‼ LIMITATIONS: This library function depends on there being a consistent number of chart timeframe bars within the HTF bar. This is almost always true in 24/7 markets like crypto.
This might not be true if the chart doesn't produce an update when expected, for example because the asset is thinly traded and there is no volume or price update from the feed at that time.
To mitigate this risk, use this function on liquid assets and at chart timeframes high enough to reliably produce updates at least once per bar period.
The consistent ratio of bars might also break down in markets with irregular sessions and hours. I'm not sure if or how one could mitigate this.
Another limitation is that because we're accessing a multiplied number of chart bars, you will run out of chart bars faster than you would HTF bars. This is only a problem if you use a large historical operator.
If you call a function from this library, you should probably reproduce these limitations in your script description.
However, all of this doesn't mean that this function might not still be the best available solution, depending what your needs are.
If a single chart bar is skipped, for example, the calculation will be off by 1 until the next HTF bar opens. This is certainly inconsistent, but potentially still usable.
@function f_offset_synch(float _HTF_X, int _HTF_H, int _openChartBarsIn, bool _updateEarly)
Returns the number of chart bars that you need to go back in order to get a stable HTF value from a given number of HTF bars ago.
@param float _HTF_X is the timeframe multiplier, i.e. how much bigger the selected timeframe is than the chart timeframe. The script shows a way to calculate this using another of my libraries without using up a security() call.
@param int _HTF_H is the historical operator on the HTF, i.e. how many bars back you want to go on the higher timeframe. If omitted, defaults to zero.
@param int _openChartBarsIn is how many chart bars have been opened within the current HTF bar. An example of calculating this is given below.
@param bool _updateEarly defines whether you want to update the value at the closing calculation of the last chart bar in the HTF bar or at the open of the first one.
@returns an integer that you can use as a historical operator to retrieve the value for the appropriate HTF bar.
🙏 Credits: This library is an attempt at a solution of the problems in using HTF data that were laid out by Pinecoders in "security() revisited" -
Thanks are due to the authors of that work for an understanding of HTF issues. In addition, the current script also includes some of its code.
Specifically, this script reuses the main function recommended in "security() revisited", for the purposes of comparison. And it extends that function to access historical data, again just for comparison.
All the rest of the code, and in particular all of the code in the exported function, is my own.
Special thanks to LucF for pointing out the limitations of my approach.
~~~~~~~~~~~~~~~~|
EXPLANATION
~~~~~~~~~~~~~~~~|
Problems with live HTF data: Many problems with using live HTF data from security() have been clearly explained by Pinecoders in "security() revisited"
In short, its behaviour is inconsistent between historical and elapsed realtime bars, and it changes in realtime, which can cause calculations and alerts to misbehave.
Various unsatisfactory solutions are discussed in "security() revisited", and understanding that script is a prerequisite to understanding this library.
PineCoders give their own solution, which is to fix the data by essentially using the previous HTF bar's data. Importantly, that solution is consistent between historical and realtime bars.
This library is an attempt to provide an alternative to that solution.
Problems with historical HTF data: In addition to the problems with live HTF data, there are different issues when trying to access historical HTF data.
Why use historical HTF data? Maybe you want to do custom calculations that involve previous HTF bars. Or to use HTF data in a function that has mutable variables and so can't be done in a security() call.
Most obviously, using the historical operator (in this description, represented using { } because the square brackets don't render) on variables already retrieved from a security() call, e.g. HTF_Close{1}, is not very useful:
it retrieves the value from the previous *chart* bar, not the previous HTF bar.
Using {1} directly in the security() call instead does get data from the previous HTF bar, but it behaves inconsistently, as we shall see.
This library addresses these concerns as well.
Housekeeping: To follow what's going on with the example and comparisons, turn line labels on: Settings > Scales > Indicator Name Label.
The following explanation assumes "close" as the source, but you can change it if you want.
To quickly see the difference between historical and realtime bars, set the HTF to something like 3 minutes on a 15s chart.
The bars at the top of the screen show the status. Historical bars are grey, elapsed realtime bars are red, and the realtime bar is green. A white vertical line shows the open of a HTF bar.
A: This library function f_offset_synch(): When supplied with an input offset of 0, it plots a stable value of the close of the *previous* HTF bar. This value is thus safe to use for calculations and alerts.
For a historical operator of {1}, it gives the close of the *last-but-one* bar. Sounds simple enough. Let's look at the other options to see its advantages.
B: Live HTF data: Represented on the line label as "security(){0}". Note: this is the source that f_offset_synch() samples.
The raw HTF data is very different on historical and realtime bars:
+ On historical bars, it uses a flat value from the end of the previous HTF bar. It updates at the close of the HTF bar.
+ On realtime bars, it varies between and within each chart bar.
There might be occasions where you want to use live data, in full knowledge of its drawbacks described above. For example, to show simple live conditions that are reversible after a chart bar close.
This library transforms live data to get the fixed data, thus giving you access to both live and fixed data with only one security() call.
C: Historical data using security(){H}: To see how this behaves, set the {H} value in the settings to 1 and show options A, B, and C.
+ On historical bars, this option matches option A, this library function, exactly. It behaves just like security(){0} but one HTF bar behind, as you would expect.
+ On realtime bars, this option takes the value of security(){0} at the end of a HTF bar, but it takes it from the previous *chart* bar, and then persists that.
The easiest way to see this inconsistency is on the first realtime bar (marked red at the top of the screen). This option suddenly jumps, even if it's in the middle of a HTF bar.
Contrast this with option A, which is always constant, until it updates, once per HTF bar.
D: PineCoders' original function: To see how this behaves, show options A, B, and D. Set the {H} value in the settings to 0, then 1.
The PineCoders' original function (D) and extended function (E) do not have the same limitations as this library, described in the Limitations section.
This option has all of the same advantages that this library function, option A, does, with the following differences:
+ It cannot access historical data. The {H} setting makes no difference.
+ It always updates at the open of the first chart bar in a new HTF bar.
By contrast, this library function, option A, is configured by default to update at the close of the last chart bar in a HTF bar.
This little frontrunning is only a few seconds but could be significant in trading. E.g. on a 1D HTF with a 4H chart, an alert that involves a HTF change set to trigger ON CLOSE would trigger 4 hours later using this method -
but use exactly the same value. It depends on the market and timeframe as to whether you could actually trade this. E.g. at the very end of a tradfi day your order won't get executed.
This behaviour mimics how security() itself updates, as is easy to see on the chart. If you don't want it, just set in_updateEarly to false. Then it matches option D exactly.
E: PineCoders' function, extended to get history: To see how this behaves, show options A and E. Set the {H} value in the settings to 0, then 1.
I modified the original function to be able to get historical values. In all other respects it is the same.
Apart from not having the option to update earlier, the only disadvantage of this method vs this library function is that it requires one security() call for each historical operator.
For example, if you wanted live data, and fixed data, and fixed data one bar back, you would need 3 security() calls. My library function requires just one.
This is the essential tradeoff: extra complexity and less robustness in certain circumstances (the PineCoders function is simple and universal by comparison) for more flexibility with fewer security() calls.
Candles HTF on Heikin Ashi ChartThis script enables calling and/or plotting of traditional Candles sources while loaded on Heikin Ashi charts.
Thanks to @PineCoders for rounding method: www.pinecoders.com
Thanks to @BeeHolder for method to regex normalize syminfo.tickerid.
NOTICE: While this script is meant to be utilized on Heikin Ashi charts it does NOT enable ability to backtest!
NOTICE: For more info on why non standard charts cannot be reliably backtested please see:
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
HTF Candles & PivotsThis indicator displays HTF candles and pivot points.
The candles are displayed in a box and you can select Open-Close, High-Low or both.
You can show all of the past, or just "today only" or "previous day only".
You can also shift one previous candle to the current one.
The pivot point is the normal one.
There is an option to display CPR (Central pivot range).
Example: Shift previous to current
Pivots libraryLibrary "Pivots"
TODO: add library description here
pivots(_type, _open, _high, _low, _clsoe) Calculates the pivot point and returns its value.
Parameters:
_type : Specifies the type of pivot point.
_open : The open price
_high : The high price
_low : The low price
_clsoe : The close price
Returns: Returns the value of the calculated pivot point as a tuple.
cpr(_high, _low, _clsoe) Calculate the Central Pivot Range
Parameters:
_high : The high price
_low : The low price
_clsoe : The close price
Returns: Returns the values as a tuple.
htf_ohlc(_htf) Calculate the HTF values
Parameters:
_htf : Resolution
Returns: Returns the values as a tuple.
MTFindicatorsQuite recently TradingView added the possibility to create and use Libraries in PineScript. With this feature PineScript became higher quality of coding language overnight. Libraries enable splitting your code into multiple files, providing easier access to code reusability.
I was working on a script which included 3000 lines of code, which was recompiling 1:30 min, and recalculating over 1 minute as well. So I split it into 2 parts: main part + library containing "main logic", which I reuse in variety of scripts, but don't change too often. Result? Now recompilation of my main script takes 10 and recalculation 8 seconds!!!. I instantly fell in love with libraries.
Having said that, and being dedicated hater of security() calls, I have decided to publish a library of MTF indicators created with my own approach: "dig into formula". I have explained reasons for such approach in desription to this script:
So this library script will be a set of indicators reaching to higher timeframes. Just include one line at the beginning of the script you are creating:
import Peter_O/MTFindicators/1 as LIB
and then somewhere is the code add this line:
rsimtf=LIB.rsi_mtf(close,5,14)
All of a sudden you have access to rsimtf from 5x higher timeframe without any hassle :)
I start with RSI MTF, next ones will be ADX, Stochastic and some more. I will update this library with them here as well. Feel free to request particular indicators in comments. Maybe PSAR? Maybe Bollinger Bands?
HTF Trending AnalysisThis is a very simple tool I created for historical analysis. Its intent is to simply draw a box from the current date to a month/year that you specify. Maybe you will have some other uses for it
Papercuts Dual PSAR v01Dual PSAR is a trend following script that uses auto-higher timeframe calculation of the current timeframe to create a dual Parabolic Stop And Release.
This is useful because it can determine periods of transition or indecision and can flag those periods with which way it is learning even though it is undecided, what i call "Wait Zones".
When both PSARS are not in alignment, it uses the lower timeframe one to determine which way the wait zone is learning.
You can see below in the chart shows some good trends and some wait zones.
A wait zone can have bullish indication, but then still have a bearish continuation.
A wait zone can have bullish indication, and then enter a bull trend.
Typically I won't make trades in wait zones, and I will exit trades when entering one.
Just wanted to try this out and see how it did. Figured I'd share.
Papercuts Super Trend MTF v02All my scripts are part of a suite called Papercuts .
This one uses one current timeframe supertrend and adds Four Automatic Higher Timeframe Supertrends based on those same parameters to help you determine larger trends while only needing a single chart. This works quite well on 5 and 15 minute charts and will look up in time. Confident trends can be identified by having two or more lines in the same direction.
When unified, the intensity of the glow should increase a trends confidence. Unify collapses the 3 highest timeframe supertrends into the first higher timeframe supertrend. Without Unify on, the overall trends are usually easier to see at just a glance. Higher timeframe supertrends can show support or resistance and act as stop loss limit ranges if you choose. Unify keeps things a bit cleaner and more compact.
V02 updated to fsecurity for no repainting and added a 3MA trend option as well.
Thanks to @Pinecoders for helping me better understand the security function!
Here is a view with Unify on....
Here is a view with Unify off...
Fair Value Gap / FVG - HTF Orderflow bias / trendCalculates Fair Value Gap (FVG) as a counter and plots it below price.
FVG Counter value resets to +ve or -ve once the FVG counter reverses direction.
Use this script to find a bias to trade with.
Best used on HTF (like 1W, 1D), so the bias can be transferred to LTF (like 4H, 1H).
If you end up using this script, please leave a comment below on how you used it. I can try to incorporate those ideas in an update.
Cheers!
HTF CandlesThis draws candlesticks from higher time frames on the current chart. I tried to keep the script simple using some newly introduced Pine capabilities.
To change the options like the higher time frame and candle colors, check the indicator settings.
Looking forward to your opinions!
Example - HTF Step InterpolationAbout this script:
This example aims to highlight an alternative way to view HTF data by providing basic interpolation functionality.
This script does not aim to provide use in itself as an indicator or strategy.
Reason for study:
Educational Purposes Only
Supertrend ++Supertrend ++ is an HTF (HigherTimeFrame) Supertrend with an optional Volume Filter with adjustable value in the Settings.
Signals are represented by Green Labels (Buy) to indicate a Long Entry or Red Labels (Sell) to indicate a Short Entry.
Note that the script does not Repaint and that you have the option of placing a single Alert for the two available Alerts.
Always use the option "Once per bar" and not "Once per bar close" when placing an Alert of individual type.
If you have any suggestions or need help, please let us know in the comment area.
Good Trade everyone and remember, Risk Management remains the most important.
Example - HTF Values Without 'Security()'This is an example of how to reference higher timeframe data without the
need for a 'security()' call.
I have attempted to create the function example:
f_insecurity()
with the purpose of wrapping up and pumping out all common relevent HTF
price data that's needed for your everyday indicators in a reliable fashion.
HTF Highs Lows [JV]█ OVERVIEW
This script presents a label with an overview of higher timeframe highs and lows. This can be useful information as we all know that price likes to revisit previous highs and lows area, specially on the higher timeframe.
█ CONCEPTS
This information can be relevant and valuable for various reasons:
Finding horizontal Support and Resistance
Get a better view on Market Structure
Provide some information about Order Flow
TrendLines
...
█ FEATURES
Plots
This script provides the option to show information about 3 timeframes
Each timeframe can be separately shown or hidden
The Y position of the info label can be user defined, based on high or low of the chosen timeframe
The X offset of the info label can be adjusted to the user's liking and the chart resolution
The label color and text color can be user defined
The info label's size can be user defined
█ NOTES
Caveat
The timeframes must be chosen in order of size. Meaning that the highest timeframe should be on top. This is title as such on the info label, but I want to mention it again as it's something to pay attention to.
Repainting
The question that pops up all the time is: Does it repaint ?
I will quote PineCoders on this:
We're pretty sure Wilder was not asked very often if RSI repainted. Why? Because it wasn't in fashion—and largely unnecessary—to ask that sort of question in the 80's. Many traders back then used daily charts only, and indicator values were calculated at the day's close, so everybody knew what they were getting. Additionally, indicator values were calculated by generally reputable outfits or traders themselves, so data was pretty reliable. Today, almost anybody can write a simple indicator, and the programming languages used to write them are complex enough for some coders lacking the caution, know-how or ethics of the best professional coders, to get in over their heads and produce code that does not work the way they think it does.
Briefly: yes, it repaints and no it does not matter.
Simple because we are working with highs and lows on a higher timeframe. So if we get a new high or low within a certain time frame, we want this new high or low to be displayed and, for me, it's not relevant if this information appears when it happens or when the candle closes.
Questions & Suggestions
Questions, suggestions or even a word of thanks are always welcomed in the comments section. I usually answer within the same day.
█ THANKS
A word of thanks to, and I hope I am allowed to use hyperlinks here, LonesomeTheBlue for being an inspiration on coding style and his work on arrays in Pine Script and to lmatl for his support, words of advice and letting me borrow his brain now and then.
VOLatiliUMThis is a useful conjunction of volume and volatility together in one script, so I named it a blended name!
It can show the diagram of:
- Volume
- Volume Variation (Volume - Past Volume)
- Volume Density (Volume / (High - Low))
- Volatility in combination with the aforesaid ones
It also offers two concepts of bar colorizing, by using the size of the bars or by applying volatility from a higher time frame (HTF).
The option "Absolute Bar Values" is included for the ones who like to see all bars positive above the zero line!
Feel free to use the script and send me your opinions. Thanks.
Dual Volatility StopThis merges Volatility Stop & its MTF version both published by u/TradingView . Background is colored green or red when both the current timeframe Vstop and higher timeframe Vstop point in same direction. Aim is to take the standard Vstop script which differentiates market from only uptrend/downtrend to uptrend/downtrend/sideways. There is a tradeoff with this, that there is no need for the Vstop to be always in a position which reduces trade time & frees up capital. However this leads to situations where it takes slightly more time to catch on to a trend after a reversal.
Green Background = Buy
Red Background = Sell
No Background = Flat
MTF Stoch RSI ScreenerDisplays when multiple timeframes of Stochastic RSI are overbought/oversold. Multiple consecutive timeframes being overbought/oversold can signify a short term top or bottom.
Thanks to Micse in Pinescripters telegram who helped remove a few errors from this.
HTF Candle CloseThis draws a label to alert user when a higher timeframe candle closes on a intraday chart.
Purpose of it is so that people who mainly use lower timeframe charts do not forget to look at higher timeframe candle closes.