How To Input And Offset CSV DataExample method of how to use an input text area to import, offset, and plot CSV data using an array. Note that when using this method there is a limit of 4096 total characters per input.
For working with data sets larger than 4096 total characters an alternative method of pasting CSV data directly within the script can be seen below :
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!
Offset
How To Import And Offset CSV DataExample method of how to import, offset, and plot CSV data using an array.
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!
Time OffsetCompare ticker with time offset.
I couldn't find anything like this. I was hoping to use it to find a ticker that might act like a leading indicator for another one! Who knows?
In the settings you can choose any ticker to compare, input the the number of bars you want it to be offset (positive or negative), and select plot source.
EMAs Vertical & Horizontal Offset
This script allows you to set Horizontal and Vertical offset to EMA lines.
Default settings is to have one set of EMAs to show bearish wave (red line and circles)and the second set to show bullish wave (green line and circles).
It also includes supporting EMAs & SMA for direction and confirmation
Timeframe option allows you to overlay Higher TF EMAs onto the current TF.
2 EMA Meeting PointThis script will calculate when the next candle needs to close for the moving averages to cross .
If you use EMAs that are far away, the convergence point may be ridiculously far away from the chart. I recommend using ' Scale Price Chart Only ' with this script.
I think you can use this to organize your watchlists if you trade crossovers. If your cross is completely out of the chart, its symbol can be down below, because the cross is unlikely to happen in the next candle.
Good luck!
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
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.
Ichimoku with offset includedBased on the idea that some Donchian Channels in trading books have a lookback or offset of 1 in order to use it as a sort of trailing stop or so that the channels don't adjust. Ichimoku's Tenkan and Kijun lines have a very similar formula to Donchian Channels. In case anyone wants to use those lines as a sort of more fixed trailing stop, offset the Kijun, Tenkan, Span B, and/or treat it like Donchian Channels and such in the Ichimoku system, I included an offset of 1 as the default. To change this indicator to a standard regular looking Ichimoku, just change the offset value to 0.
The formula seems a bit different to what Tradingview has for their own version of Ichimoku but it's the same as many other programmers here. I made the colors as close to the traditional colors seen in books and other places and Tradingview as much as I could think of. Ichimoku has many different variations out there and to add the the confusion can have many different strategies to go with it. If you have any suggestions or tips, please let me know.
Donchian Channels with offset includedThere does not seem to be an offset for most Donchian Channel scripts out there. Many trading books have an offset of 1 but most Donchian Channels out there do not for some reason. I included one in case there is a need for it.
MultiTimeFrame Shifting Predictive Bollinger BandsThis is the optimized version of my MTFSBB indicator with capability of possible bands prediction in case of negative shifting (to the left).
Make me happy by using it and sending me your ideas about the prediction.
MTF Shifting BBs + Reverse Engineering RSIs Overlay on ChartAnother multi-timeframe indicator presents 3 MTF (each) Bollinger Bands and 3 MTF (each) Reverse Engineering RSI and of course with shifting (left/right) capability.
RERSI in a simple term is the RSI but on the main chart alongside with candles.
There are many adjustable options like:
- Show/Hide each BB
- Show/Hide each MA
- Non-integer BB deviation values
- Positive/Negative shifting values
- Show/Hide each RSI
- Show/Hide each RSI Mid Level
- Adjustable Overbought, Oversold and Mid Levels values
I wrote this after my first script MTFSBB, because it's very useful to have BBs and RSIs together on a chart.
Calculating RERSIs will take some time, so be patient with it and feel free to use it.
MultiTimeFrame Shifting Bollinger BandsJust 3 Bollinger Bands with different adjustable timeframes plus shifting (left/right) capability and non-integer deviation values.
I wrote this because I couldn't find the perfect BB indicator that matches my needs. Feel free to use it.
How To Color Prior BarsExample how to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function.
Currently when offsets are used in barcolor(), bgcolor(), plot(), plotarrow(), plotchar(), or plotshape(), the offset only works with a simple (static) integer. If series (dynamic) integers are used instead, there is not an error, but the series values are ignored. Because of this limitation of offset being constrained to using only fixed offsets, the normal way to paint 3 Black Crows would be to use 3 barcolor() functions. Since there are a known number of bars to be painted in that scenario, this can be easily accomplished.
If a condition encompassed a variable length of n bars, then the number of barcolor() functions needed to use would be unknown. How to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function? Dual examples below solves issue but requires n "future" bars, because of this it will not paint the most recent condition in realtime and may not be applicable for use in certain realtime situations. It paints similar in behavior to how a pivot does. Special thanks to LucF and RicardoSantos for illumination!
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!
SadLittleThings Price Compare With Offset MTF by RRBSadLittleThings Price Compare With Offset MTF by RagingRocketBull 2018
Version 1.0
This indicator lets you compare multiple assets across different timeframes, supports offsets and alpha multipliers.
Standard TradingView Compare doesn't have Offset/Timeframe/Multiplier options, hence this indicator.
Features:
- compare current asset's price with 2 custom ext OHLC sources
- plot sources as lines/bars/candles
- use offset:
- for lines - both positive/negative offsets, unlimited
- for bars/candles - only positive offsets <= 5000
- specify timeframe for each source
- uses timeframe textbox instead of input resolution dropdown to allow for 240 120 and other custom TFs
- support for timeframes in H: H, 2H, 4H etc
- show/hide sources
- colorize sources
- convert source price to 1000s, mlns, or blns using alpha multiplier
- total bars counter
Notes on using offsets:
- Max offset is defined by study max_bars_back which is limited to 5000 for free accounts. This variable specifies the number of history bars an indicator can access.
- if you see the 'internal server study error' => one of the indexes of ohlc series is out of bounds (i.e. close ) => decrease the offset <= 5000 or switch to line type
- you will be limited only by the total number of bars in history (n) +/- 1 full screen of empty bars
- you can't scroll past the beginning of history - 1 empty screen and past the end of history + 1 empty screen to be able to still see the line with applied offset
- before applying a large offset, scroll back long enough to make sure you have enough history loaded
- if you have a long history the indicator will get slower, its UI less responsive. Reloading the page may fix that.
- you will not see source's history past the beginning of the current asset - open the chart with the longest history first (i.e. BLX, not COINBASE)
- Make sure that the Left Price Scale shows up with Auto Fit Data enabled. You can reattach the indicator to a different scale in Style.
- you may not be able to plot intraday TFs < current TF, because free accounts are limited to TFs >= D1 (i.e. D, 2D, 3D, W), but you can still plot, say, H4+ on a lower TF H1 chart
1. uses plot*, security, change
OffsetThis is a simple vertical offset function. It will work with price data or data from indicators. Sometimes I find it useful, particularly when I want to eliminate extraneous trading signals, to use this offset function with some of my indicators. I hope you find it useful too.
Simple Horizontal Value and Offsets [Auto Shift]Original (Simple Horizontal Value and Offsets/SHV) Requested by @TAFA94
Description:
Simple adjustable incremented horizontal offset lines extending up and down from a Median point.
Set full value for manual Median point control, or set an incremental rounding value for auto Median adjustment.
Source and look-back period inputs for fine tuning auto adjust.
Auto adjust on by default - can be toggled off for straight manual control.
**NOTE**
All values will likely need to be changed immediately on applying this script, in order to properly fit your charts specific price/value range and/or time resolution.
Cheers!
Simple Horizontal Value and OffsetsRequested by @TAFA94
Simple horizontal values extending up and down from a median value.
Set Median Value, and set offset values. Simples!
Wave Channel 3D Wave Channel 3D
Built by Ricardo idea from JR & Aloakdutt from indieTrades Jan. 2010
This indicator is very easy to build. We utilize Moving Averages with a set multiplier and an offset. Specially we try to use Fibonacci sequence series numbers (1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...) as time space and multiplier (default 89, 8). Also included is Donchian Channel to locate strong trends and possible future support - resistance.
Examples of support/resistance on chart.
Dominant Price Trends
Future Support Resistance
Comparing Fibonacci Series Time Space - Multiplier
When Comparing make note of confluence support/resistance showing up with Fibonacci Series
Example uses DC
When Comparing make note of confluence support/resistance showing up with Fibonacci Series
Example without DC / Smooth MA