FunctionDatestringLibrary "FunctionDatestring"
Methods to stringify date/time, altho there is already builtin support for it.
datetime(unixtime) a stringified date stamp at specified unix time.
Parameters:
unixtime : int unix timestamp.
Returns: string
date_(unixtime) a stringified date stamp at specified unix time.
Parameters:
unixtime : int unix timestamp.
Returns: string
time_(unixtime) a stringified date stamp at specified unix time.
Parameters:
unixtime : int unix timestamp.
Returns: string
時間
Special Time PeriodWith this indicator, you can choose candles in the period you want on your chart.
How ?
• If your chart is 5 minutes, the duration should be greater than 5 on this indicator.
If you do not do it this way, there will be gaps in the price, it will not give the right result.
• If you want to see it in minutes, you must enter a direct numerical value. For example, to see 2 hours, you must enter the number 120. Because 2 hours is 120 minutes.
Like the warning above, if you want to plot a 2-hour chart with this indicator, a maximum of 1 hour should be selected on your main chart.
• Resolution, eg. '60' - 60 minutes, 'D' - daily, 'W' - weekly, 'M' - monthly, '5D' - 5 days, '12M' - one year, '3M' - one quarter
• For example, if you want to see the 2-day chart, you should have a maximum of 1 day chart open on your home screen and write "2D" to the indicator value.
• You will get much better results if the period on your main chart and the period on this indicator are multiples of each other.
• In the image below, the period on the main chart is 30 minutes, but the period on the indicator is 90
• Click on the facing brackets at the top right of the legend and your chart will enlarge.
Time of Day and Day of Week Buying and Selling StrategyThis strategy allows you to back test longing or shorting or do nothing during time increments of 30 minutes for various days of the week. For example if you want to see if every Saturday if Bitcoin dropped in value from 1600-7000 UTC, this script will allow you to test that.
Make sure you are in the 30 minute time frame while viewing the performance and trade history.
Igor Time SessionsThis script automatically highlights the Igor Session time zones based on the Chart Champions TPO time and volatility theory.
Session Time RangesHave you ever wondered if you are trading at the right time of the day or feel like all the good trades happen when you are sleeping? Well now you can check your theory :)
This Script allows you to highlight a time range on your chart over a 24hour time period. For example 3AM to 6AM
The script has two time variables, set your start time and end time based on a 24 hour clock and set the time zone offset variable to match your charts time zone. For example New York -4 (for utc just enter 0 for no offset )
This is a quick script I put together so hopefully it is error free enjoy :)
Timeframe Time of Day Buying and Selling StrategyThis strategy allows you to back test longing or shorting or do nothing during time increments of 30 minutes. The price trends in one direction every 30 minutes and this strategy allows you to test various 30 minute time frames across a range of dates to capitalize on this.
Make sure you are in the 30 minute time frame while viewing the performance and trade history.
ICT KillzonesThis Script plots the ICT Killzones in the Chart using a new Panel.
It's based on the Major Forex Sessions and this is usually where Key Swing Points occur.
It has a lookback of 20 days for Performance reasons.
CUSTOMISATION
- Time can be modified
- Lines width can be modified
- Lines colours can be modified
DEFAULT
By default the Killzones will be based on NY Time using the following order
- London Open: 02:00 to 05:00
- New York Open: 07:00 to 10:00
- London Close: 10:00 to 12:00
Natural Stochastic Indicator [CC]The Natural Stochastic Indicator was created by Jim Sloman and this is another indicator from his Ocean series which I will eventually publish all of them. Big thanks to @altcoinz and @tmac87 for giving me all of the source code in order to publish Jim's life work. This is another momentum indicator but unlike a traditional stochastic indicator, this one doesn't use overbought and oversold levels. Instead it becomes a sell signal when the indicator starts getting lower and vice versa. This takes the classic approach to a stochastic and combines it with the time factor from Jim's Ocean Theory to create this new indicator. I have included strong buy and sell signals as darker colors and normal buy and sell signals as lighter colors. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!
No Trading Zone (NZT)The script highlights Frankfurt's opening range up until New York's close. It is described as No Trading Zone in Gabrielle Fabris's The Price in Time book.
Projections of the Frankfurt range are potential supports and resistances and they are used in trade management & for taking profits in his system.
Full rules are not mine to share. You have to read the book to understand his system and run your own backtest on each pair to find out what management method you will be most comfortable with.
Auto Fib Time Zones and Trend-Based Fib Time by DGTFibonacci time zones, based on the Fibonacci number sequence, are vertical lines that represent potential areas where a swing high, low, or reversal could occur.
Trend-Based Fib Time shows probable price corrections in an existing trend. A useful tool to use in addition to Elliot Wave counting, Fib Time helps to identify how far the wave is likely to travel
Please note, Time zones aren't concerned with price, only time
Disclaimer :
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Time Wolna_2021_iun3[wozdux] Description of the Time_Wolna indicator
The indicator is designed to study the behavior of time. There are many indicators that study just the price, a little less indicators that study the volume of trading and vanishingly few indicators that study time.
This is not an oscillator, it does not have oversold or overbought levels. This indicator has an indefinite beginning and an indefinite end. Its value is not in the absolute values of the indicator, but in relative ones. This indicator calculates the time of price rise and the time of price decline. It clearly shows how long the price rises and how long the price falls.
The initial idea was to use my RSIVol indicator to study the time. Each bar is counted as a unit of time. If the price rises during the period of one bar, then one is added, if the price falls, then one is subtracted. By default, the blue line shows this time movement according to the RsiVol indicator.
The basic RsiVol indicator is shown at the bottom of the diagram. The bill goes along the blue line, which calculates the movement of the volume price. If the blue RSIVol line is above the yellow level, then the blue Time_Wolna time line is colored green. If the blue line in the base RsiVol indicator falls below the lower yellow level, then the blue time line of the Time_Wolna indicator turns red.
The result is a broken line that clearly shows the waves of rising and falling prices. In principle, the time indicator makes it easier to recognize waves.
It is known that time plays an important role in Elliott wave analysis, although in practice this is almost never done. The mention of Elliott is just a lyrical digression.
Time is very difficult to study. This indicator does not give clear buy or sell signals. This is just an analysis tool to help analysts.
In addition to the RsiVol indicator, simply the Rsi from the price and a simple moving average from the price are also used.
So, the settings of this indicator.
"switch Price == close <==> ( High+Low)/2" -- select the base price in all subsequent calculations
"Key EMA=> True=ema(Price); False=ema(Price*Volume)" --The key for switching the moving average from the price or from the volume price.
"T==> EMA(price, T)" --The period for calculating the moving average
" key red==> Yes/No Rsi")--the key turns on or off the RSI line red line
"key green==> Yes/No Orsi") --the key turns on or off the Volume RSI line green line
" key olive==> Yes/No RsiVol200 " -- the key enables or disables the Volumetric RSIVol200 olive line. This is RsiVol minus the 200-period moving average.
"keyVol blue==> Yes/No " - the key enables or disables the base blue line RSIVol
"keyVol blue==> V->tt(RsiVol) ->tt(ema(Price))"—The blue line selection will be calculated as the time from RSIVol or as the time from the moving average EMA.
"keyVol blue==> : 1=Time, 2=Time* price, 3=Time*(Ci-Ck) 4=Time*Volume, 5=Time*price*Volume")- selection for the blue baseline. By default, the time of the price rise or fall is calculated simply. Key=1. But you can investigate the joint influence of time and price and then the key is=2. If we study the combined effect of time and price changes per bar, then the key=3. If we study the joint influence of time and volume, then the key=4. If we study the joint influence of time, price and volume, then the key=5.
"key RsiO red + green==> : 1=Time, 2=Time*Price, 3=Time*(Ci-Ck) 4=Time*Volume, 5=Time*Price*Volume") - - - similar settings for the red green line. By default, the time of the price rise or fall is calculated simply. Key=1. But you can investigate the joint influence of time and price and then the key is=2. If we study the combined effect of time and price changes per bar, then the key=3. If we study the joint influence of time and volume, then the key=4. If we study the joint influence of time, price and volume, then the key=5.
"Key Color – - here you can disable changing the color of the blue line to green or red when the base indicator RsiVol exits above the upper and below the lower levels.
"Level nul ==> * Down Level Rsi - screen configuration in order to raise or lower chart
"Level nul ==> * Down Level ORsi -- beauty setup in order to raise or lower chart
"Level nul ==> * DownLevel RsiVol200 -- beauty setup in order to raise or lower chart
"blue =volume * price" – period for calculation of volumetric rates
"blue => RSIVOL(Volume*price,len) and EMA" – the period for calculating RsiVol
"blue__o1=> ema ( RSIVOL, o1)" – additional smoothing RsiVol
"red=rsi (Price,14)" – the period for calculating Rsi
"red= ema ( RSI ,3)" -- additional smoothing Rsi
"fuchsia__ => RsiVol200 (vp,200)" - the period for calculating RsiVol200
"fuchsia__o2=> ema ( RSIVOL200 , o2)" -- additional smoothing RsiVol200
To study the time between two fixed dates. Setting the start point of the calculation and the end point of the calculation
"Data(0)=Year" – the year of the start date
"Data(0)= Month" – the month of the start date
"Data (0)=Day" the day of the start date
"Data(1)=Year" – the year of the end date.
"Data(1)=Year" – month of the end date.
"Data(1)=Day" -- the day of the end date.
--------русский вариант описания ------
Описание индикатора Time_Wolna
Индикатор призван изучать поведение времени. Есть много индикаторов изучающих просто цену, немного меньше индикаторов изучающих объем торгов и исчезающе мало индикаторов, изучающих время.
Это не осциллятор у него нет уровней перепроданности или перекупленности. Данный индикатор имеет неопределенное начало и неопределенный конец. Ценность его не в абсолютных значениях индикатора, а в относительных. Этот индикатор высчитывает время подъема цены и время снижения цены. Он наглядно показывает сколько времени цена поднимается и сколько времени цена опускается.
Первоначальная идея была использовать мой индикатор RSIVol для изучения времени. Каждый бар считается за единицу времени. Если цена поднимается за период одного бара, то прибавляется единица, если цена опускается, то вычитается единица. По умолчанию голубая линия показывает такое движения времени по индикатору RsiVol.
Внизу на диаграмме показан базовый индикатор RsiVol. Счёт идет по синей линии, которая вычисляет движение объемной цены. Если синяя линия RSIVol находится выше желтого уровня, то голубая линия времени Time_Wolna окрашивается в зеленый цвет. Если синяя линия в базовом индикаторе RsiVol опускается ниже нижнего желтого уровня, то голубая линия времени индикатора Time_Wolna окрашивается в красный цвет.
В результате получается ломанная линия, четко показывающая волны восхождения и снижения цены. В принципе индикатор времени позволяет легче распознавать волны.
Известно, что время играет важную роль в волновом анализе Эллиотта, хотя на практике это почти никогда не делается. Упоминание Эллиотта это просто лирическое отступление.
Время очень трудно изучать. Этот индикатор не дает четких сигналов на покупку или продажу. Это всего лишь инструмент анализа в помощь аналитикам.
Кроме индикатора RsiVol, используются и просто Rsi от цены и простая скользящая средняя от цены.
Итак, настройки данного индикатора.
"switch Price == close <==> ( High+Low)/2" -- выбираем базовую цену во всех последующих вычислениях
"Key EMA=> True=ema(Price); False=ema(Price*Volume)" --Ключ переключения скользящей средней от цены или от объемной цены.
" T==> EMA(price,T)"--Период вычисления скользящей средней
"key red==> Yes/No Rsi")--ключ включает или выключает линию RSI красная линия
"key green==> Yes/No Orsi") --ключ включает или выключает линию Объемной RSI зеленая линия
"key olive==> Yes/No RsiVol200" -- ключ включает или выключает линию Объемной RSIVol200 оливковая линия. Это RsiVol минус 200-периодная скользящая средняя.
"keyVol blue==> Yes/No " – ключ включает или выключает базовую голубую линию RSIVol
"keyVol blue==> V->tt(RsiVol) ->tt(ema(Price))"—выбор голубая линия будет вычисляться как время от RSIVol или как время от скользящей средней EMA.
"keyVol blue==> : 1=Time, 2=Time* price, 3=Time*(Ci-Ck) 4=Time*Volume, 5=Time*price*Volume")—выбор для голубой базовой линии. По умолчанию вычисляется просто время подъема или опускания цены. Ключ=1. Но можно исследовать совместное влияние времени и цены и тогда ключ=2. Если изучаем совместное влияние времени и изменения цены за один бар, то ключ=3. Если изучаем совместное влияние времени и объема, то ключ=4. Если изучаем совместное влияние времени, цены и объема, то ключ=5.
"key RsiO red + green==> : 1=Time, 2=Time*Price, 3=Time*(Ci-Ck) 4=Time*Volume, 5=Time*Price*Volume") ---аналогичные настройки для красной зеленой линии. По умолчанию вычисляется просто время подъема или опускания цены. Ключ=1. Но можно исследовать совместное влияние времени и цены и тогда ключ=2. Если изучаем совместное влияние времени и изменения цены за один бар, то ключ=3. Если изучаем совместное влияние времени и объема, то ключ=4. Если изучаем совместное влияние времени, цены и объема, то ключ=5.
"Key Color" – здесь можно отключить изменение цвета голубой линии на зеленый или красный в моменты выхода базового индикатора RsiVol выше верхнего и ниже нижнего уровней.
"Level nul ==> * Down Level Rsi - косметическая настройка для того, чтобы поднять или опустить график
"Level nul ==> * Down Level ORsi -- косметическая настройка для того, чтобы поднять или опустить график
"Level nul ==> * DownLevel RsiVol200 -- косметическая настройка для того, чтобы поднять или опустить график
" blue =>volume * price" – период для вычисления объемной цены
" blue => RSIVOL(Volume*price,len) and EMA" – период для вычисления RsiVol
"blue__o1=> ema ( RSIVOL, o1)" – дополнительное сглаживание RsiVol
" red=rsi (Price,14)" – период для вычисления Rsi
" red= ema ( RSI ,3)" -- дополнительное сглаживание Rsi
"fuchsia__ => RsiVol200 (vp,200)" -- период для вычисления RsiVol200
"fuchsia__o2=> ema ( RSIVOL200 , o2)" -- дополнительное сглаживание RsiVol200
Для исследования времени между двумя фиксированными датами. Задаем начальную точку вычисления и конечную точку вычисления
"Data(0)=Year" – год начальной даты
"Data(0)= Month" – месяц начальной даты
"Data(0)=Day" день начальной даты
"Data(1)=Year" – год конечной даты.
"Data(1)=Year" – месяц конечной даты.
"Data(1)=Day" -- день конечной даты.
Time-Period Coloring Instagram LuckyNickVAFor Coloring Your Candles To A Specific Time Period. Used To Exploit Perspective Of Market Structure For Different Time Periods.
Hourly Time SeparatorI made this indicator mostly for personal use but there may be few others who would like to have vertical lines occur every day in specific our on chart.
I am no developer and all I did was copy @allanster's work and delete few lines and duplicate few others. Code will be open for anyone to edit since it was not my code to start with after all. Hopefully this one helps to someone.
Flunki T-WAP minus MA Oscillator
Yo,
Possible the last of these for now, and mostly for the sake of completeness..
This is..
Another simple oscillator that show the difference in price between a selectable timeframe TWAP and a Moving Average of that TWAP
This is shown as a histogram.
Use numeric TWAP values for minutes (30, 60 ,720 whatever) and D, 3D, W, M for higher values
There is also a global timeframe which will set the timeframe for a global alternate timeframe (instead of current chart resolution)
On top of that is a Moving Average of the histogram value, shown as a blue / red line with an option to highlight this MA crossing zero, and an option to colour bars to this line.
The major difference between this Oscillator, and the other script (Flunki VWAP minus MA Oscillator)
(I treid to insert a link but it's invisible so it would seem, anyway.. )
is that VWAP is usually calculated daily, so there is a sharp move upon the daily close, as VWAP starts a new day. Using TWAP this does not occur, so gives smoother transitions ; also the timeframe for TWAP is selectable for additional wap fun.
Simple idea : Code open
Enjoy !
Flunki TWAP minus MTF TWAP Oscillator
Heys,
Herewith a another simple oscillator that show the difference in price between a selectable timeframe TWAP and another alternative selectable timeframe TWAP
This is shown as a histogram.
Use numeric TWAP values for minutes (30, 60 ,720 whatever) and D, 3D, W, M for higher values
There is also a global timeframe which will set the timeframe for a global alternate timeframe (instead of current chart resolution)
On top of that is a Moving Average of the histogram value, shown as a blue / red line with an option to highlight this MA crossing zero, and an option to colour bars to this line.
Simple idea : Code open
Enjoy !
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.
h4hdwm (updated)I put most importand moving avarages for most importand time frames together. When you whatching a graph you are sometimes missing another time frime very importand moving avarage and there is a reaction on price. with this multi time frame multi ma indicator you can see all of them at once. it makes a little mass if you let all of them together. so you might close some of them.
Bigger time frames Moving Avarages has ticker lines and bigger steps.
Example - Future Line DrawingExample primarily focuses on:
• creating a simple function to get a time offset value
• using the offset to set drawing locations in the future
• how to properly set up and manipulate line positions
Extras ( end of script ):
• inclusion of vertical lines for visualising start and end points using the time offsets
• inclusion of label to read out the current time offset forwards/backwards
This script publication is intended for:
• Educational Purposes
Who is it for?
• anyone who wants to learn the basics of drawing using 'time' for purposes of positioning
Realtime All-Time High and All-Time Low Tracker [WIP]This is a study intended to port the work of /u/QuantNomad's "Kozlod - All-time high/low alerts" to pine version 4 without giving any alerts. It is intended to capture the most extreme points on any given price chart in real time, the absolute high and absolute low points. Ideally, the plotted lines would strictly diverge from one another in opposite directions and widen with new highs or lows on a hypothetical "all-time" resolution.
Most of the original code was replaced and I'm trying to resolve a bug where the script fails to register new highs or lows while at the same time making sure that earlier data is plotted correctly. If applied to an asset that has not yet recovered , is just too new, or has not achieved a lower low than its opening price, this indicator ceases to function correctly. This would not be an issue if pine script was more general purpose and had something similar to Python's max(list) function.
Any and all suggestions are welcome. This is simply to serve as a springboard for any programmers trying to design algorithms or strategies that use these variables on any price chart.
Happy Hunting!
- Patch Hemlock
Relative Volume at Time█ OVERVIEW
This indicator calculates relative volume, which is the ratio of present volume over an average of past volume.
It offers two calculation modes, both using a time reference as an anchor.
█ CONCEPTS
Calculation modes
The simplest way to calculate relative volume is by using the ratio of a bar's volume over a simple moving average of the last n volume values.
This indicator uses one of two, more subtle ways to calculate both values of the relative volume ratio: current volume:past volume .
The two calculations modes are:
1 — Cumulate from Beginning of TF to Current Bar where:
current volume = the cumulative volume since the beginning of the timeframe unit, and
past volume = the mean of volume during that same relative period of time in the past n timeframe units.
2 — Point-to-Point Bars at Same Offset from Beginning of TF where:
current volume = the volume on a single chart bar, and
past volume = the mean of volume values from that same relative bar in time from the past n timeframe units.
Timeframe units
Timeframe units can be defined in three different ways:
1 — Using Auto-steps, where the timeframe unit automatically adjusts to the timeframe used on the chart:
— A 1 min timeframe unit will be used on 1sec charts,
— 1H will be used for charts at 1min and less,
— 1D will be used for other intraday chart timeframes,
— 1W will be used for 1D charts,
— 1M will be used for charts at less than 1M,
— 1Y will be used for charts at greater or equal than 1M.
2 — As a fixed timeframe that you define.
3 — By time of day (for intraday chart timeframes only), which you also define. If you use non-intraday chart timeframes in this mode, the indicator will switch to Auto-steps.
Relative Relativity
A relative volume value of 1.0 indicates that current volume is equal to the mean of past volume , but how can we determine what constitutes a high relative volume value?
The traditional way is to settle for an arbitrary threshold, with 2.0 often used to indicate that relative volume is worthy of attention.
We wanted to provide traders with a contextual method of calculating threshold values, so in addition to the conventional fixed threshold value,
this indicator includes two methods of calculating a threshold channel on past relative volume values:
1 — Using the standard deviation of relative volume over a fixed lookback.
2 — Using the highs/lows of relative volume over a variable lookback.
Channels calculated on relative volume provide meta-relativity, if you will, as they are relative values of relative volume.
█ FEATURES
Controls in the "Display" section of inputs determine what is visible in the indicator's pane. The next "Settings" section is where you configure the parameters used in the calculations. The "Column Coloring Conditions" section controls the color of the columns, which you will see in three of the five display modes available. Whether columns are plotted or not, the coloring conditions also determine when markers appear, if you have chosen to show the markers in the "Display" section. The presence of markers is what triggers the alerts configured on this indicator. Finally, the "Colors" section of inputs allows you to control the color of the indicator's visual components.
Display
Five display modes are available:
• Current Volume Columns : shows columns of current volume , with past volume displayed as an outlined column.
• Relative Volume Columns : shows relative volume as a column.
• Relative Volume Columns With Average : shows relative volume as a column, with the average of relative volume.
• Directional Relative Volume Average : shows a line calculated using the average of +/- values of relative volume.
The positive value of relative volume is used on up bars; its negative value on down bars.
• Relative Volume Average : shows the average of relative volume.
A Hull moving average is used to calculate the average used in the three last display modes.
You can also control the display of:
• The value or relative volume, when in the first three display modes. Only the last 500 values will be shown.
• Timeframe transitions, shown in the background.
• A reminder of the active timeframe unit, which appears to the right of the indicator's last bar.
• The threshold used, which can be a fixed value or a channel, as determined in the next "Settings" section of inputs.
• Up/Down markers, which appear on transitions of the color of the volume columns (determined by coloring conditions), which in turn control when alerts are triggered.
• Conditions of high volatility.
Settings
Use this section of inputs to change:
• Calculation mode : this is where you select one of this indicator's two calculation modes for current volume and past volume , as explained in the "Concepts" section.
• Past Volume Lookback in TF units : the quantity of timeframe units used in the calculation of past volume .
• Define Timeframes Units Using : the mode used to determine what one timeframe unit is. Note that when using a fixed timeframe, it must be higher than the chart's timeframe.
Also, note that time of day timeframe units only work on intraday chart timeframes.
• Threshold Mode : Five different modes can be selected:
— Fixed Value : You can define the value using the "Fixed Threshold" field below. The default value is 2.0.
— Standard Deviation Channel From Fixed Lookback : This is a channel calculated using the simple moving average of relative volume
(so not the Hull moving average used elsewhere in the indicator), plus/minus the standard deviation multiplied by a user-defined factor.
The lookback used is the value of the "Channel Lookback" field. Its default is 100.
— High/Low Channel From Beginning of TF : in this mode, the High/Low values reset at the beginning of each timeframe unit.
— High/Low Channel From Beginning of Past Volume Lookback : in this mode, the High/Low values start from the farthest point back where we are calculating past volume ,
which is determined by the combination of timeframe units and the "Past Volume Lookback in TF units" value.
— High/Low Channel From Fixed Lookback : In this mode the lookback is fixed. You can define the value using the "Channel Lookback" field. The default value is 100.
• Period of RelVol Moving Average : the period of the Hull moving average used in the "Directional Relative Volume Average" and the "Relative Volume Average".
• High Volatility is defined using fast and slow ATR periods, so this represents the volatility of price.
Volatility is considered to be high when the fast ATR value is greater than its slow value. Volatility can be used as a filter in the column coloring conditions.
Column Coloring Conditions
• Eight different conditions can be turned on or off to determine the color of the volume columns. All "ON" conditions must be met to determine a high/low state of relative volume,
or, in the case of directional relative volume, a bull/bear state.
• A volatility state can also be used to filter the conditions.
• When the coloring conditions and the filter do not allow for a high/low state to be determined, the neutral color is used.
• Transitions of the color of the volume columns determined by coloring conditions are used to plot the up/down markers, which in turn control when alerts are triggered.
Colors
• You can define your own colors for all of the oscillator's plots.
• The default colors will perform well on light or dark chart backgrounds.
Alerts
• An alert can be defined for the script. The alert will trigger whenever an up/down marker appears in the indicator's display.
The particular combination of coloring conditions and the display settings for up/down markers when you create the alert will determine which conditions trigger the alert.
After alerts are created, subsequent changes to the conditions controlling the display of markers will not affect existing alerts.
• By configuring the script's inputs in different ways before you create your alerts, you can create multiple, functionally distinct alerts from this script.
When creating multiple alerts, it is useful to include in the alert's message a reminder of the particular conditions you used for each alert.
• As is usually the case, alerts triggering "Once Per Bar Close" will prevent repainting.
Error messages
Error messages will appear at the end of the chart upon the following conditions:
• When the combination of the timeframe units used and the "Past Volume Lookback in TF units" value create a lookback that is greater than 5000 bars.
The lookback will then be recalculated to a value such that a runtime error does not occur.
• If the chart's timeframe is higher than the timeframe units. This error cannot occur when using Auto-steps to calculate timeframe units.
• If relative volume cannot be calculated, for example, when no volume data is available for the chart's symbol.
• When the threshold of relative volume is configured to be visible but the indicator's scale does not allow it to be visible (in "Current Volume Columns" display mode).
█ NOTES
For traders
The chart shown here uses the following display modes: "Current Volume Columns", "Relative Volume Columns With Average", "Directional Relative Volume Average" and "Relative Volume Average". The last one also shows the threshold channel in standard deviation mode, and the TF Unit reminder to the right, in red.
Volume, like price, is a value with a market-dependent scale. The only valid reference for volume being its past values, any improvement in the way past volume is calculated thus represents a potential opportunity to traders. Relative volume calculated as it is here can help traders extract useful information from markets in many circumstances, markets with cyclical volume such as Forex being one, obvious case. The relative nature of the values calculated by this indicator also make it a natural fit for cross-market and cross-sector analysis, or to identify behavioral changes in the different futures contracts of the same market. Relative volume can also be put to more exotic uses, such as in evaluating changes in the popularity of exchanges.
Relative volume alone has no directional bias. While higher relative volume values always indicate higher trading activity, that activity does not necessarily translate into significant price movement. In a tightly fought battle between buyers and sellers, you could theoretically have very large volume for many bars, with no change whatsoever in bid/ask prices. This of course, is unlikely to happen in reality, and so traders are justified in considering high relative volume values as indicating periods where more attention is required, because imbalances in the strength of buying/selling power during high-volume trading periods can amplify price variations, providing traders with the generally useful gift of volatility.
Be sure to give the "Directional Relative Volume Average" a try. Contrary to the always-positive ratio widely used in this indicator, the "Directional Relative Volume Average" produces a value able to determine a bullish/bearish bias for relative volume.
Note that realtime bars must be complete for the relative volume value to be confirmed. Values calculated on historical or elapsed realtime bars will not recalculate unless historical volume data changes.
Finally, as with all indicators using volume information, keep in mind that some exchanges/brokers supply different feeds for intraday and daily data, and the volume data on both feeds can sometimes vary quite a bit.
For coders
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 of code were lifted from the MTF Selection Framework and the MTF Oscillator Framework , also by PineCoders.
█ THANKS
Thanks to dgtrd for suggesting to add the channel using standard deviation.
Thanks to adolgov for helpful suggestions on calculations and visuals.
Look first. Then leap.
Time Offset Calculation Framework - PineCoders FAQ█ OVERVIEW
Calculating time-based offsets is necessary when coders need to draw lines or labels into the future because using `xloc = xloc.bar_time` in `label.new()` or `line.new()` is then mandatory.
This script provides a function to help with those calculations:
f_timeFrom(_from, _qty, _units)
The function calculates a negative (into the past) or positive (into the future) offset from the current bar's starting or closing time, or from the current time of day.
The offset can be expressed in units of chart resolution, or in seconds, minutes, hours, days, months or years.
█ HOW TO USE THE FRAMEWORK
1. You will need to include the supplied `f_resInMinutes()` function in your script in order to use `f_timeFrom()`.
It is used to calculate offsets using chart units when `f_timeFrom(_, _, "chart")` is used.
2. Whether you use `f_timeFrom()` for labels or lines, remember to use `xloc = xloc.bar_time`, as the default is `xloc = xloc.bar_index`.
3. Use `f_timeFrom()` for the `x` argument in `label.new()`, or for `x1` or `x2` in `line.new()`.
It can of course also be used in the relevant `label.set_*()` or `line.set_*()` functions.
Examples
// Label 3 days into the future from current bar's time.
label.new(f_timeFrom("bar", 3, "days"), high, "time + 3 days", xloc.bar_time)
// Label 2 hours into the future from current time
label.new(f_timeFrom("now", 2, "hours"), high, "timenow + 3 hours", xloc.bar_time)
// Label at bar's time plus 4 units of the chart's resolution.
label.new(f_timeFrom("bar", 4, "chart"), high, "time + 3 chart units", xloc.bar_time)
The parameters are:
f_timeFrom(_from, _qty, _units) =>
// _from : starting time from where the offset is calculated: "bar" to start from the bar's starting time, "close" to start from the bar's closing time, "now" to start from the current time.
// _qty : the +/- qty of _units of offset required. A "series float" can be used but it will be cast to a "series int".
// _units : string containing one of the seven allowed time units: "chart" (chart's resolution), "seconds", "minutes", "hours", "days", "months", "years".
█ LIMITATIONS
While this function makes it easier for coders to calculate time offsets using a variety of methods, it does not solve the inherent problematic that offsets do not calculate accurately when bars are missing between the start and end times of the offset. There is currently no way to circumvent this challenge in Pine.
Missing bars will occur on holidays, during no-trade periods (including normal periods where markets are closed) and when there are irregularities in data feeds. Charts at seconds resolutions, for example, will often miss bars when there are no trades to update the feed. On hourly charts of non 24x7 markets, periods when the markets are closed will also cause irregularities, as will holidays on day charts.
Other irregularities can occur because of how the offsets are calculated. A calculation of a one second offset from the bar's time will end one bar further on daily charts, for example. `f_timeFrom()` is no panacea; it simply makes offsets easier to calculate, however imprecise they are.
█ HOW TO USE THIS SCRIPT
The script's Inputs allow you to specify an offset, its units and starting time, and control the frequency of bars where lines are drawn.
Use the Inputs to play around with the parameters; you will quickly notice the irregularities mentioned above and be able to judge the usefulness of time-based offsets on the type of chart you use.
Look first. Then leap.