MTF Candle [Pt]The Multi-Timeframe (MTF) Candle Tool is a powerful indicator designed for traders who wish to analyze standard candle bars and Heikin Ashi candles of multiple timeframes simultaneously. This tool is ideal for traders who prefer to trade in higher timeframes while keeping a close eye on the lower timeframes for confirmation signals. The indicator works by overlaying standard candle bars or Heikin Ashi candles of a higher timeframe onto the current chart. This allows traders to quickly switch between the current timeframe and the higher timeframe, without having to switch charts.
Features
- Live, real time updating MTF candle
- Custom colors
- Heikin Ashi candle
- Heikin Ashi Inside bar highlight
HTF
Simple ICT Order Blocks and Fair Value Gaps by Gowtham KannakajeThis scripts identifies ICT Order Block and ICT Fair Value Gaps
Fair Value Gap:
- Fair Value Gap toggle is off by default
- Users can choose to color the bars having Fair Value Gaps or can select to define the Fair Value Gap using boxes.
- Bar color and box colors can be customized
Order Blocks:
- Order Block box and candle color toggle is on by default
- Users can choose to color the Order Block candles or can select to define the Order Blocks using boxes.
- Bar color and box colors can be customized for bullish and bearish Order Block separately
Note:
- Order Blocks are considered valid only if the candle forming the Fair Value Gap closes away from the Order Block.
- Since Trading View limits the number of boxes to 500, it is advised to use the Color Candle option to identify the Order Blocks or Fair Value Gaps which are very old.
New concept Definitions:
Naked OB : An order block whose immediate next candle forms a Fair Value Gap. Here, the Order Block high or low contributes to the formation of Fair Value Gap.
Covered OB : An order block whose immediate next candle doesn't form a Fair Value Gap. Here, the Order Block high or low doesn't contribute to the formation of Fair Value Gap. Instead it will have other candles in between the Order Block and Fair Value Gap.
Disclaimer: The usage of this indicator might or might not contribute to your profits and losses and the author is not responsible for the same.
Happy Trading.
wick CE; plot candle wick and tail midpoint lines-Simple little tool to plot the wick CE: an ICT concept, consequent encroachment i.e. the midpoint line of a wick or tail; it being a potentially sensitive level (depending on context).
-Wrote this to save me time drawing out fib retracement to locate the precise level of the wick CE. Example usage: show indicator, add horizontal ray over favored wick CE level, hide indicator.
~choose how many consecutive bars back to plot wick CE lines.
~choose how many bars forward to extend the wick CE lines.
HTF Bar Close CountdownThis simple indicator displays a countdown for the amount of time left until a bar of your chosen timeframe closes.
Displays up to 5 different HTF countdowns.
Fully Customizable to fit any style, change the text colors, background colors, frame colors, display size and border & frame widths.
Flat display option for a sleek look to mesh with your charts.
Notes/Tips:
Higher Time Frames only! This is only intended to view HTF countdowns, will not work when trying to use a timeframe lower than your current chart's.
Some weird timeframes do not work, you'll know when.
Only works on live charts! Will display "Closed" when on an inactive chart.
Does not work for replay! A countdown is pretty pointless on a replay that is not real-time anyways...
Enjoy!
HTF Tool 2HTF Tool 2: Because the previous version was removed for being too powerful.
HTF Tool allows Users to display Higher Timeframe(HTF) Candles on their Chart with retracement lines drawn from the (High/Low) range of the HTF candle, as well as a live HTF MA.
This indicator perfectly handles Requested data to display a non-lagging HTF Moving Average(MA) by bridging a solid historical data stream with the live data stream.
This is done by offsetting plot data backwards to the middle of the last HTF candle, and then drawing a line from the last candle middle, to the live candle middle.
I have manipulated the data display to give the appearance that it consists of only 1 plot line, Whereas in reality, The HTF MA consists of 3 different processes:
- 1 historical plot value, to display the (correct) historical EMA with the same plot points you would see on the HTF chart from the same ema.
- 1 live line, re-drawn at every tick to mimic the way plot values move around while the bar is live.
- 1 live plot value, that is only displayed as a number on the status line and price scale to make it look like these are the outputs from the constantly redrawing line.
Because of this, This indicator displays the exact same way you would see this data on the requested timeframe's chart .
Note: You will see 2 values on the status line, these are the Historic MA, and Live MA values (Left, Right).
When hovering over historic values, a Historic MA value will only display in the middle of the HTF bars (same bar as the HTF wick)
This indicator include:
- HTF Candles, Drawn in the Traditional Candlestick Fashion.
- A User Adjustable HTF EMA / SMA , This Moving Average is accurate the the display you would see on a HTF chart.
- User Adjustable Retracement lines, up to 3 levels. These levels dynamically delete when price crosses them.
- Adjustable Display Range to display more or less HTF candles.
- Toggleable "Safe Mode" to keep the indicator display looking clean at all times.*
All Colors are Customizable to fit your layout style (Candle, Levels, HTF MA)
*Safe mode checks that your current chart's timeframe cleanly multiplies into your requested timeframe an odd number of times. This keeps the HTF candle wicks perfectly centered, and keeps the candle body width perfectly consistent.
If you choose to turn safe mode off here are some things to consider:
All Vertical data is consistent with the HTF requested , ONLY the horizontal alignment of the indicator will be thrown off.
When on low timeframes requesting other relatively low timeframes these issues are extremely more apparent than when requesting substantially larger timeframes.
Example: Safe Mode will likely need to be turned off for any 4h chart request, but as seen in the following image, the bars still look very normal.
Note: If you ONLY want to see the Levels and Moving Average... You ARE capable of requesting the current chart's timeframe. If you do this, the indicator will stop drawing the HTF candles, since your chart already shows that timeframe's candles.
Enjoy!
Higher Time Frame EMAs and 1% volatility indicatorSet the "higher time frame" (HTF) from which the EMAs will be calculated in all timeframes.
Example: I chose timeframe 1D and I will see the EMAs from TF 1D also in smaller TF as 1, 5, 30, 60 minutes.
There are 4 EMAs. The default values are 5, 10, 60 and 223 periods from "Scalping the Bull" indicator.
You can change the periods of each EMA.
The indicator have also a volatility indication, showing -1% and +1% price levels.
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
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!
View HTF CandlesThis script will allow you to see your selected higher timeframe candles while on a lower timeframe. Supported HTFs are: Daily, 4H and 1H.
[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.
[VDB]HTF-Momentum-SpeedThis script is for plotting momentum and speed of higher timeframe using MACD Histograms.
Settings are hardcoded to 35/70/20 for momentum while speeds change slow length to 100, 200 and 300.
There is an option to use the user defined higher timeframe is case auto selection is inappropriate.
DISCLAIMER: This indicator has been created for educational reference only and do not constitute investment advice. This indicator should not be relied upon as a substitute for extensive independent market research before making your actual trading decisions. Market data or any other content is subject to change at any time without notice. Liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from use of this indicator is accountability of user using it.
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!