DeleteArrayObject█ OVERVIEW
Delete array object according to array size such as label, line, linefill, box and table.
█ CREDITS
HeWhoMustNotBeNamed
LINE
Custom Price LineThis indicator lets you freely customize your price line. Choose between static or dynamic colors for falling/rising prices. In addition you can adjust the following:
Line style
Thickness
Length
Direction
It is also possible to mix different designs by using a single indicator.
Dashed Line Moving AveragesHere's a simple script which i concocted using ideas from various authors with the goal of creating a slightly better Moving Average dashed line script imo...I think i managed to do just that and a bit more.. =)
Features:
- Contains one of each VWMA SMA EMA. You can set the input length.
- Ability to set spacing between characters of the plotted moving average line
- Horizontal offset of the moving average lines (just in case)
- Can add any fancy characters that suits your taste e.g ( . , _ , -, !, *, rocket, lava, etc) to the moving average
- If you duplicate the script and modify the "Size" parameter of the plotchar() function's variables with the choices provided in the commented-out code; you can have some fun!
This script is for entertainment & educational purposes only.
[e2] Drawing Library :: Horizontal Ray█ OVERVIEW
Library "e2hray"
A drawing library that contains the hray() function, which draws a horizontal ray/s with an initial point determined by a specified condition. It plots a ray until it reached the price. The function let you control the visibility of historical levels and setup the alerts.
█ HORIZONTAL RAY FUNCTION
hray(condition, level, color, extend, hist_lines, alert_message, alert_delay, style, hist_style, width, hist_width)
Parameters:
condition : Boolean condition that defines the initial point of a ray
level : Ray price level.
color : Ray color.
extend : (optional) Default value true, current ray levels extend to the right, if false - up to the current bar.
hist_lines : (optional) Default value true, shows historical ray levels that were revisited, default is dashed lines. To avoid alert problems set to 'false' before creating alerts.
alert_message : (optional) Default value string(na), if declared, enables alerts that fire when price revisits a line, using the text specified
alert_delay : (optional) Default value int(0), number of bars to validate the level. Alerts won't trigger if the ray is broken during the 'delay'.
style : (optional) Default value 'line.style_solid'. Ray line style.
hist_style : (optional) Default value 'line.style_dashed'. Historical ray line style.
width : (optional) Default value int(1), ray width in pixels.
hist_width : (optional) Default value int(1), historical ray width in pixels.
Returns: void
█ EXAMPLES
• Example 1. Single horizontal ray from the dynamic input.
//@version=5
indicator("hray() example :: Dynamic input ray", overlay = true)
import e2e4mfck/e2hray/1 as e2draw
inputTime = input.time(timestamp("20 Jul 2021 00:00 +0300"), "Date", confirm = true)
inputPrice = input.price(54, 'Price Level', confirm = true)
e2draw.hray(time == inputTime, inputPrice, color.blue, alert_message = 'Ray level re-test!')
var label mark = label.new(inputTime, inputPrice, 'Selected point to start the ray', xloc.bar_time)
• Example 2. Multiple horizontal rays on the moving averages cross.
//@version=5
indicator("hray() example :: MA Cross", overlay = true)
import e2e4mfck/e2hray/1 as e2draw
float sma1 = ta.sma(close, 20)
float sma2 = ta.sma(close, 50)
bullishCross = ta.crossover( sma1, sma2)
bearishCross = ta.crossunder(sma1, sma2)
plot(sma1, 'sma1', color.purple)
plot(sma2, 'sma2', color.blue)
// 1a. We can use 2 function calls to distinguish long and short sides.
e2draw.hray(bullishCross, sma1, color.green, alert_message = 'Bullish Cross Level Broken!', alert_delay = 10)
e2draw.hray(bearishCross, sma2, color.red, alert_message = 'Bearish Cross Level Broken!', alert_delay = 10)
// 1b. Or a single call for both.
// e2draw.hray(bullishCross or bearishCross, sma1, bullishCross ? color.green : color.red)
• Example 3. Horizontal ray at the all time highs with an alert.
//@version=5
indicator("hray() example :: ATH", overlay = true)
import e2e4mfck/e2hray/1 as e2draw
var float ath = 0, ath := math.max(high, ath)
bool newAth = ta.change(ath)
e2draw.hray(nz(newAth ), high , color.orange, alert_message = 'All Time Highs Tested!', alert_delay = 10)
MACD + Divergence + Line █ OVERVIEW
Here's the classic MACD with some simples features in plus.
█ CONCEPTS
4 features
1 — Classic MACD histogram, with 4 different colors such as above or below 0, and above or below the previous bar
2 — Display option to disable EMA
3 — A signal line that show the exact point, because the histogram view might be hard to be precise
4 — Looking for previous Divergences, Bullish, Bearish and Hidden Bullish and Bearish but I don't like Hidden divergences
█ OTHER SECTIONS
An oscillator is good to know where we are in the trends, but it's not enough to run a small business of trading, you need to learn how to use it.
What is a divergence ?
Thanks to The rational investor for teaching me how to use this indicator.
regressLibrary "regress"
produces the slope (beta), y-intercept (alpha) and coefficient of determination for a linear regression
regress(x, y, len) regress: computes alpha, beta, and r^2 for a linear regression of y on x
Parameters:
x : the explaining (independent) variable
y : the dependent variable
len : use the most recent "len" values of x and y
Returns: : alpha is the x-intercept, beta is the slope, an r2 is the coefficient of determination
Note: the chart does not show anything, use the return values to compute model values in your own application, if you wish.
Vertical LinesThis script plots vertical lines on charts or indicators. Unfortunately pinescript is lacking a vertical line plotting function. Vertical lines are useful to mark events, such as crossover of levels, indicators signals or as a time marker.
After searching the internet for a long time and trying different scripts, this script is the simplest and visually the best. You would think that plotting a vertical line would be relatively easy, it is not! I thank the unknow author for sharing this solution and now I will share it on tradingview to make it readily available to anybody that needs it.
RSI crossover signals are used as an example in this script. When the RSI crosses over 70 or below 30, the script plots a red or green vertical line.
The script plots a vertical line as a histogram bar. The histogram bar must have a height.
Setting the height near infinity like 1e20 will cover all the ranges from top to bottom in most charts, but doesn't work all the time. If the chart range is small in values, the line is not plotted or the chart is visually compressed because the top of the bar is also a data point in the chart. Another solution is to find the highest point in the chart and multiply it by a number from 2 to 10 to set the top of the histogram bar. But this solution doesn't work if the line is drawn in the indicator window. additionally if the chart or indicator includes negative values, a histogram bar with a negative height must be concatenated to the histogram bar with a positive height to cover the positive and negative range.
It would seem intuitive to include a vertical plot function since it is very useful and pinescript already has a horizontal line plot function called Hline. But pinescript is becoming less intuitive, and redundant. A case in point is Version 4 variable declaration and naming, it less intuitive and more redundant than previous versions. I beg Tradingview to adopt a more refined scripting language such as Matlab or Python for charting purposes. These languages can be easily ported to other analysis programs for AI or statistical analysis.
Volume Profile Auto [line]This project is about:
- VPSV
- array.new_line()
- array.new_box()
VPSV (pine) is one of the rare features that draws lines/figures BETWEEN bars
It doesn't run on Pine script, which makes it possible to do such things.
I wanted to have something similar while a restriction of Pine script is the impossibility to draw between bars, the only way I could think of is by using line width
In this script the higher timeframe is started with several lines (left) and a box, this box goes further until the higher timeframe ends.
During the creation of the box, each candle (lower timeframe) in this box (higher timeframe - period) is checked for position and volume, the volume is added to the left line, so when you see a thicker line, this means at that level there is more volume traded.
One of the big differences with other volume profiles is that many look back to a previous period, here when a period starts, the lines collect data - volume until the period ends, it is especially very visible in very low TF's (seconds)
This is my first script with array.new_line() - array.new_box(), which is a very nice Pine feature!
I hope this script can be helpful to see the possibilities
Settings:
'Parts' -> amount of lines (left of box)
5 Parts:
15 Parts:
25 Parts:
50 Parts:
'Max Width' -> Sets the max width of the lines
'Automatic Settings' -> Sets the higher time frame automatically, see the tooltip ⓘ for more info
The yellow line is the max volume line of that period, last period has a red line (POC), also referring the max.
Cheers!
MTF WatchList Charts [Anan]█ OVERVIEW
I am happy to present this script with a nice idea!
You can now customize a watchlist with your preferred time frame and any symbol from any market.
The main purpose is to be aware of any moves and watch a brief overview of the chart.
█ FEATURES
- 8 customizable symbols with the option to show/hide anyone
- Multi time frame support
- 3 Types of charts (Candles / Heikin Ashi / Line)
- Displaying up to 10 candles for every chart
- Customizable chart colors
- Option to Show/hide Price
- Option to Show/hide Price Line
- Option to change Labels and Text Size
- Show Symbol name and used time frame
- Option to change gaps between charts
- Hover over on the top of any candle to see (Open/High/Low/Close) Prices
█ SCREENSHOTS
-----------------------------------------------
Special thanks to @dgtrd for inspiration and for the amazing framework used here ( HTF Candles by DGT )
Special thanks to Pine Chat @fareidzulkifli @Bjorgum @JohnBaron @fpainchaud
[CLX][#03] Object-Stack (Labels/Lines/Boxes)This script shows an example of how to manage objects (lines/labels/boxes) and prevent the need of garbage collecting and missing objects.
You only have to push your object into the right array.
*_FIXED (left-lock) or *_FORWARD (right-lock)
We hope you enjoy it! 🎉
CRYPTOLINX - jango_blockchained 😊👍
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 cryptolinx TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script.
ATH FinderFind the all time high (ATH) and plot a horizontal line extended from the ATH out to the right. Script also produces a label near the current candle indicating location and value of the ATH. If the ATH is higher than the current candle's high the label will be red and pointing up to indicate the ATH is above the current candle. If that current candle's high is the ATH, the label is green and pointing at the current candle's high.
Demand VectorCreate lines based on the demand for long/short, extracted from price range.. this lines have nothing to do with volume and liquidity, its just a interpretation of price range.
Pinescript - Common Label & Line Array Functions Library by RRBPinescript - Common Label & Line Array Functions Library by RagingRocketBull 2021
Version 1.0
This script provides a library of common array functions for arrays of label and line objects with live testing of all functions.
Using this library you can easily create, update, delete, join label/line object arrays, and get/set properties of individual label/line object array items.
You can find the full list of supported label/line array functions below.
There are several libraries:
- Common String Functions Library
- Standard Array Functions Library
- Common Fixed Type Array Functions Library
- Common Label & Line Array Functions Library
- Common Variable Type Array Functions Library
Features:
- 30 array functions in categories create/update/delete/join/get/set with support for both label/line objects (45+ including all implementations)
- Create, Update label/line object arrays from list/array params
- GET/SET properties of individual label/line array items by index
- Join label/line objects/arrays into a single string for output
- Supports User Input of x,y coords of 5 different types: abs/rel/rel%/inc/inc% list/array, auto transforms x,y input into list/array based on type, base and xloc, translates rel into abs bar indexes
- Supports User Input of lists with shortened names of string properties, auto expands all standard string properties to their full names for use in functions
- Live Output for all/selected functions based on User Input. Test any function for possible errors you may encounter before using in script.
- Output filters: hide all excluded and show only allowed functions using a list of function names
- Output Panel customization options: set custom style, color, text size, and line spacing
Usage:
- select create function - create label/line arrays from lists or arrays (optional). Doesn't affect the update functions. The only change in output should be function name regardless of the selected implementation.
- specify num_objects for both label/line arrays (default is 7)
- specify common anchor point settings x,y base/type for both label/line arrays and GET/SET items in Common Settings
- fill lists with items to use as inputs for create label/line array functions in Create Label/Line Arrays section
- specify label/line array item index and properties to SET in corresponding sections
- select label/line SET function to see the changes applied live
Code Structure:
- translate x,y depending on x,y type, base and xloc as specified in UI (required for all functions)
- expand all shortened standard property names to full names (required for create/update* from arrays and set* functions, not needed for create/update* from lists) to prevent errors in label.new and line.new
- create param arrays from string lists (required for create/update* from arrays and set* functions, not needed for create/update* from lists)
- create label/line array from string lists (property names are auto expanded) or param arrays (requires already expanded properties)
- update entire label/line array or
- get/set label/line array item properties by index
Transforming/Expanding Input values:
- for this script to work on any chart regardless of price/scale, all x*,y* are specified as % increase relative to x0,y0 base levels by default, but user can enter abs x,price values specific for that chart if necessary.
- all lists can be empty, contain 1 or several items, have the same/different lengths. Array Length = min(min(len(list*)), mum_objects) is used to create label/line objects. Missing list items are replaced with default property values.
- when a list contains only 1 item it is duplicated (label name/tooltip is also auto incremented) to match the calculated Array Length
- since this script processes user input, all x,y values must be translated to abs bar indexes before passing them to functions. Your script may provide all data internally and doesn't require this step.
- at first int x, float y arrays are created from user string lists, transformed as described below and returned as x,y arrays.
- translated x,y arrays can then be passed to create from arrays function or can be converted back to x,y string lists for the create from lists function if necessary.
- all translation logic is separated from create/update/set functions for the following reasons:
- to avoid redundant code/dependency on ext functions/reduce local scopes and to be able to translate everything only once in one place - should be faster
- to simplify internal logic of all functions
- because your script may provide all data internally without user input and won't need the translation step
- there are 5 types available for both x,y: abs, rel, rel%, inc, inc%. In addition to that, x can be: bar index or time, y is always price.
- abs - absolute bar index/time from start bar0 (x) or price (y) from 0, is >= 0
- rel - relative bar index/time from cur bar n (x) or price from y0 base level, is >= 0
- rel% - relative % increase of bar index/time (x) or price (y) from corresponding base level (x0 or y0), can be <=> 0
- inc - relative increment (step) for each new level of bar index/time (x) or price (y) from corresponding base level (x0 or y0), can be <=> 0
- inc% - relative % increment (% step) for each new level of bar index/time (x) or price (y) from corresponding base level (x0 or y0), can be <=> 0
- x base level >= 0
- y base level can be 0 (empty) or open, close, high, low of cur bar
- single item x1_list = "50" translates into:
- for x type abs: "50, 50, 50 ..." num_objects times regardless of xloc => x = 50
- for x type rel: "50, 50, 50 ... " num_objects times => x = x_base + 50
- for x type rel%: "50%, 50%, 50% ... " num_objects times => x_base * (1 + 0.5)
- for x type inc: "0, 50, 100 ... " num_objects times => x_base + 50 * i
- for x type inc%: "0%, 50%, 100% ... " num_objects times => x_base * (1 + 0.5 * i)
- when xloc = xloc.bar_index each rel*/inc* value in the above list is then subtracted from n: n - x to convert rel to abs bar index, values of abs type are not affected
- x1_list = "0, 50, 100, ..." of type rel is the same as "50" of type inc
- x1_list = "50, 50, 50, ..." of type abs/rel/rel% produces a sequence of the same values and can be shortened to just "50"
- single item y1_list = "2" translates into (ragardless of yloc):
- for y type abs: "2, 2, 2 ..." num_objects times => y = 2
- for y type rel: "2, 2, 2 ... " num_objects times => y = y_base + 2
- for y type rel%: "2%, 2%, 2% ... " num_objects times => y = y_base * (1 + 0.02)
- for y type inc: "0, 2, 4 ... " num_objects times => y = y_base + 2 * i
- for y type inc%: "0%, 2%, 4% ... " num_objects times => y = y_base * (1 + 0.02 * i)
- when yloc != yloc.price all calculated values above are simply ignored
- y1_list = "0, 2, 4" of type rel% is the same as "2" with type inc%
- y1_list = "2, 2, 2" of type abs/rel/rel% produces a sequence of the same values and can be shortened to just "2"
- you can enter shortened property names in lists. To lookup supported shortened names use corresponding dropdowns in Set Label/Line Array Item Properties sections
- all shortened standard property names must be expanded to full names (required for create/update* from arrays and set* functions, not needed for create/update* from lists) to prevent errors in label.new and line.new
- examples of shortened property names that can be used in lists: bar_index, large, solid, label_right, white, left, left, price
- expanded to their corresponding full names: xloc.bar_index, size.large, line.style_solid, label.style_label_right, color.white, text.align_left, extend.left, yloc.price
- all expanding logic is separated from create/update* from arrays and set* functions for the same reasons as above, and because param arrays already have different types, implying the use of final values.
- all expanding logic is included in the create/update* from lists functions because it seemed more natural to process string lists from user input directly inside the function, since they are already strings.
Creating Label/Line Objects:
- use study max_lines_count and max_labels_count params to increase the max number of label/line objects to 500 (+3) if necessary. Default number of label/line objects is 50 (+3)
- all functions use standard param sequence from methods in reference, except style always comes before colors.
- standard label/line.get* functions only return a few properties, you can't read style, color, width etc.
- label.new(na, na, "") will still create a label with x = n-301, y = NaN, text = "" because max default scope for a var is 300 bars back.
- there are 2 types of color na, label color requires color(na) instead of color_na to prevent error. text_color and line_color can be color_na
- for line to be visible both x1, x2 ends must be visible on screen, also when y1 == y2 => abs(x1 - x2) >= 2 bars => line is visible
- xloc.bar_index line uses abs x1, x2 indexes and can only be within 0 and n ends, where n <= 5000 bars (free accounts) or 10000 bars (paid accounts) limit, can't be plotted into the future
- xloc.bar_time line uses abs x1, x2 times, can't go past bar0 time but can continue past cur bar time into the future, doesn't have a length limit in bars.
- xloc.bar_time line with length = exact number of bars can be plotted only within bar0 and cur bar, can't be plotted into the future reliably because of future gaps due to sessions on some charts
- xloc.bar_index line can't be created on bar 0 with fixed length value because there's only 1 bar of horiz length
- it can be created on cur bar using fixed length x < n <= 5000 or
- created on bar0 using na and then assigned final x* values on cur bar using set_x*
- created on bar0 using n - fixed_length x and then updated on cur bar using set_x*, where n <= 5000
- default orientation of lines (for style_arrow* and extend) is from left to right (from bar 50 to bar 0), it reverses when x1 and x2 are swapped
- price is a function, not a line object property
Variable Type Arrays:
- you can't create an if/function that returns var type value/array - compiler uses strict types and doesn't allow that
- however you can assign array of any type to another array of any type creating an arr pointer of invalid type that must be reassigned to a matching array type before used in any expression to prevent error
- create_any_array2 uses this loophole to return an int_arr pointer of a var type array
- this works for all array types defined with/without var keyword and doesn't work for string arrays defined with var keyword for some reason
- you can't do this with var type vars, only var type arrays because arrays are pointers passed by reference, while vars are actual values passed by value.
- you can only pass a var type value/array param to a function if all functions inside support every type - otherwise error
- alternatively values of every type must be passed simultaneously and processed separately by corresponding if branches/functions supporting these particular types returning a common single type result
- get_var_types solves this problem by generating a list of dummy values of every possible type including the source type, tricking the compiler into allowing a single valid branch to execute without error, while ignoring all dummy results
Notes:
- uses Pinescript v3 Compatibility Framework
- uses Common String Functions Library, Common Fixed Type Array Functions Library, Common Variable Type Array Functions Library
- has to be a separate script to reduce the number of local scopes/compiled file size, can't be merged with another library.
- lets you live test all label/line array functions for errors. If you see an error - change params in UI
- if you see "Loop too long" error - hide/unhide or reattach the script
- if you see "Chart references too many candles" error - change x type or value between abs/rel*. This can happen on charts with 5000+ bars when a rel bar index x is passed to label.new or line.new instead of abs bar index n - x
- create/update_label/line_array* use string lists, while create/update_label/line_array_from_arrays* use array params to create label/line arrays. "from_lists" is dropped to shorten the names of the most commonly used functions.
- create_label/line_array2,4 are preferable, 5,6 are listed for pure demonstration purposes only - don't use them, they don't improve anything but dramatically increase local scopes/compiled file size
- for this reason you would mainly be using create/update_label/line_array2,4 for list params or create/update_label/line_array_from_arrays2 for array params
- all update functions are executed after each create as proof of work and can be disabled. Only create functions are required. Use update functions when necessary - when list/array params are changed by your script.
- both lists and array item properties use the same x,y_type, x,y_base from common settings
- doesn't use pagination, a single str contains all output
- why is this so complicated? What are all these functions for?
- this script merges standard label/line object methods with standard array functions to create a powerful set of label/line object array functions to simplify manipulation of these arrays.
- this library also extends the functionality of Common Variable Type Array Functions Library providing support for label/line types in var type array functions (any_to_str6, join_any_array5)
- creating arrays from either lists or arrays adds a level of flexibility that comes with complexity. It's very likely that in your script you'd have to deal with both string lists as input, and arrays internally, once everything is converted.
- processing user input, allowing customization and targeting for any chart adds a whole new layer of complexity, all inputs must be translated and expanded before used in functions.
- different function implementations can increase/reduce local scopes and compiled file size. Select a version that best suits your needs. Creating complex scripts often requires rewriting your code multiple times to fit the limits, every line matters.
P.S. Don't rely too much on labels, for too often they are fables.
List of functions*:
* - functions from other libraries are not listed
1. Join Functions
Labels
- join_label_object(label_, d1, d2)
- join_label_array(arr, d1, d2)
- join_label_array2(arr, d1, d2, d3)
Lines
- join_line_object(line_, d1, d2)
- join_line_array(arr, d1, d2)
- join_line_array2(arr, d1, d2, d3)
Any Type
- any_to_str6(arr, index, type)
- join_any_array4(arr, d1, d2, type)
- join_any_array5(arr, d, type)
2. GET/SET Functions
Labels
- label_array_get_text(arr, index)
- label_array_get_xy(arr, index)
- label_array_get_fields(arr, index)
- label_array_set_text(arr, index, str)
- label_array_set_xy(arr, index, x, y)
- label_array_set_fields(arr, index, x, y, str)
- label_array_set_all_fields(arr, index, x, y, str, xloc, yloc, label_style, label_color, text_color, text_size, text_align, tooltip)
- label_array_set_all_fields2(arr, index, x, y, str, xloc, yloc, label_style, label_color, text_color, text_size, text_align, tooltip)
Lines
- line_array_get_price(arr, index, bar)
- line_array_get_xy(arr, index)
- line_array_get_fields(arr, index)
- line_array_set_text(arr, index, width)
- line_array_set_xy(arr, index, x1, y1, x2, y2)
- line_array_set_fields(arr, index, x1, y1, x2, y2, width)
- line_array_set_all_fields(arr, index, x1, y1, x2, y2, xloc, extend, line_style, line_color, width)
- line_array_set_all_fields2(arr, index, x1, y1, x2, y2, xloc, extend, line_style, line_color, width)
3. Create/Update/Delete Functions
Labels
- delete_label_array(label_arr)
- create_label_array(list1, list2, list3, list4, list5, d)
- create_label_array2(x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- create_label_array3(x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- create_label_array4(x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- create_label_array5(x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- create_label_array6(x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- update_label_array2(label_arr, x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- update_label_array4(label_arr, x_list, y_list, str_list, xloc_list, yloc_list, style_list, color1_list, color2_list, size_list, align_list, tooltip_list, d)
- create_label_array_from_arrays2(x_arr, y_arr, str_arr, xloc_arr, yloc_arr, style_arr, color1_arr, color2_arr, size_arr, align_arr, tooltip_arr, d)
- create_label_array_from_arrays4(x_arr, y_arr, str_arr, xloc_arr, yloc_arr, style_arr, color1_arr, color2_arr, size_arr, align_arr, tooltip_arr, d)
- update_label_array_from_arrays2(label_arr, x_arr, y_arr, str_arr, xloc_arr, yloc_arr, style_arr, color1_arr, color2_arr, size_arr, align_arr, tooltip_arr, d)
Lines
- delete_line_array(line_arr)
- create_line_array(list1, list2, list3, list4, list5, list6, d)
- create_line_array2(x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- create_line_array3(x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- create_line_array4(x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- create_line_array5(x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- create_line_array6(x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- update_line_array2(line_arr, x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- update_line_array4(line_arr, x1_list, y1_list, x2_list, y2_list, xloc_list, extend_list, style_list, color_list, width_list, d)
- create_line_array_from_arrays2(x1_arr, y1_arr, x2_arr, y2_arr, xloc_arr, extend_arr, style_arr, color_arr, width_arr, d)
- update_line_array_from_arrays2(line_arr, x1_arr, y1_arr, x2_arr, y2_arr, xloc_arr, extend_arr, style_arr, color_arr, width_arr, d)
Auto Horizontal Lines_Arshak_TcAdjust the time as per your purpose.Turn off second line option if you don't need it.
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.
PRIME - R.o.c.M Ind. W/ TrendsThis experimental script is a variant of a model that allows a separate indicator window to be opened, revealing data for on balance volume, rsi, consumer commodity index and momentum indications. By use of the settings key, you can change the parameter of the source input as well as the desired lengths. After data compilation, the indicator will automatically draw any trend lines applicable to what is presented. The additional code is an attempt to allow the system to apply pivot points for alerts within the indicator itself.
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 the publishing TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Action Trend LineAction Trend Line is different of Moving Average between ema26 and ema260
My idea is, if ema26 drop to ema260 means downtrend
if ema26 increase or moving out of ema260 means uptrend
then writting a different line by 100 scale to be clear vision
at the bottom have plot sign up and down for each candle, it is status information
The chart show Action Trend Line, by 2 color and 2 sign at the bottom of chart.
If the line is growing up then color is green. you could know that is uptrend.
If the line is going down then color is red. you could know that is downtrend.
The triangle sign at the bottom of chart show trend folowing.
If previous and this line are uptrend, the triangle up and green color.
If previous and this line are downtrend, the triangle down and redcolor.
otherwise, the trend going to change it dosen't plot any sign, you cloud know warning the trend going to be change.
Must try and make you clearly understand.
Follow Line Trend SignalThis Script is a Trend Following system built over the concepts of normalising ATR over Bollinger Bands and Pivot points high low,
This Script Can be used over AnyTimeframe
and Can be treated as a stable alternative to Supertrend
Script has provisions for BUY and SELL Alerts
Enjoy!
RS Line - Gauge Performance vs IndexOverview:
This implementation of the RS Line mimics how Investor's Business Daily and CANSLIM investors measure growth stock performance versus the S&P 500.
If you are looking at a weekly chart, the RS Line is the performance of the stock over the past week versus the S&P 500 over that same time frame. The same logic applies to the daily and monthly charts, only the time frames are different.
If a stock moves up for the day/week/month and the S&P 500 does not, the RS Line will move up. If a stock ends the day/week/month flat, yet the S&P 500 moves up, the RS Line will go down.
Usage:
- Look for an upward sloping line.
- The steeper the line, the better.
- Can be used for viewing long-term trend.
TF Segmented Linear RegressionFit a line at successive intervals, where the interval period is determined by a user-selected time frame, this allows the user to have an estimate of the intrinsic trend within various intervals.
Settings
Timeframe : Determine the period of the interval, if the timeframe is weekly then a new line will be fit at the start each weeks, by default "Daily"
Mult : Multiplication factor for the RMSE, determine the distance between the upper and lower extremities
Src : Input data for the indicator
Plot Extremities : Logical value, if true then the extremities of the channel are plotted, if false only the midline is plotted, true by default.
Usage
The timeframe setting should be higher than the current chart timeframe, note however that too large values of timeframe might return an error. Since the maximum number of lines that can be plotted is 54, using the extremities will only return 18 channels.
The indicator can be compared to the "regression trend" drawing tool
Main tf = 5 min with the indicator using a daily timeframe, the filled area is produced by the regression trend drawing tool using the same interval as the indicator, and coincide with it.
Main tf = 15 min with the indicator using a weekly timeframe, wider channel indicate that the values tend to be farther away from the fitted line.
A line with a significant slope indicates a strong trend, in that case, the width of the channel is determined by the amplitude of the retracements in the trend, with a narrower channel indicating a cleaner trend.
When the fitted line has a low slope value and the channel is wide, it means that there were two or more variations of opposite directions with large amplitudes within the interval, this also indicates that a linear model is not appropriate.
A slope approximately equal to 0 with a low channel width indicates a trendless market with cyclical variations of low amplitude in it.
Refrences
Determining the starting and ending points of the fitted line was done using a linear combination between the wma and sma
The wma and sma functions both use a series as period by making use of the Wma and Sum functions in the following script
Computing The Linear Regression Using The WMA And SMAPlot a linear regression channel through the last length closing prices, with the possibility to use another source as input. The line is fit by using linear combinations between the WMA and SMA thus providing both an interesting and efficient method. The results are the same as the one provided by the built-in linear regression, only the computation differ.
Settings
length : Number of inputs to be used.
src : Source input of the indicator.
mult : Multiplication factor for the RMSE, determine the distance between the upper and lower level.
Usage
In technical analysis a linear regression can provide an estimate of the underlying trend in the price, this result can be extrapolated to have an estimate of the future evolution of the trend, while the upper and lower level can be used as support and resistance levels.
The slope of the fitted line indicates both the direction and strength of the trend, with a positive slope indicating an up-trending market while a negative slope indicates a down-trending market, a steeper line indicates a stronger trend.
We can see that the trend of the S&P500 in this chart is approximately linear, the upper and lower levels were previously tested and might return accurate support and resistance points in the future.
By using a linear regression we are making the following assumptions:
The trend is linear or approximately linear.
The cycle component has an approximately constant amplitude (this allows the upper and lower level to be more effective)
The underlying trend will have the same evolution in the future
In the case where the growth of a trend is non-linear, we can use a logarithmic scale to have a linear representation of the trend.
Details
In a simple linear regression, we want to the slope and intercept parameters that minimize the sum of squared residuals between the data points and the fitted line
intercept + x*slope
Both the intercept and slope have a simple solution, you can find both in the calculations of the lsma, in fact, the last point of the lsma with period length is equal to the last point of a linear regression fitted through the same length data points. We have seen many times that the lsma is an FIR filter with a series of coefficients representing a linearly decaying function with the last coefficients having a negative value, as such we can calculate the lsma more easily by using a linear combination between a WMA and SMA: 3WMA - 2SMA , this linear combination gives us the last point of our linear regression, denoted point B .
Now we need the first point of our linear regression, by using the calculations of the lsma we get this point by using:
intercept + (x-length+1)*slope
If we get the impulse response of such lsma we get
In blue the impulse response of a standard lsma, in red the impulse response of the lsma using the previous calculation, we can see that both are the same with the exception that the red one appears as being time inverted, the first coefficients are negative values and as such we also have a linear operation involving the WMA and SMA but with inverted terms and different coefficients, therefore the first point of our linear regression, denoted point A , is given by 4SMA - 3WMA , we then only need to join these two points thanks to "line.new".
The levels are simply equal to the fitted line plus/minus the root mean squared error between the fitted line and the data points, right now we only have two points, we need to find all the points of the fitted line, as such we first need to find the slope, which can be calculated by diving the vertical distance between B and A (the rise) with the horizontal distance between B and A (the run), that is
(A - B)/(length-1)
Once done we can find each point of our line by using
B + slope*i
where i is the position of the point starting from B, i=0 give B since B + slope*0 = B , then we continue for every i , we then only need to sum the squared distance between each closing prices at position i and the point found at that same position, we divide by length-1 and take the square root of the result in order to have the RMSE.
In Summary
The following post as shown that it was possible to compute a linear regression by using a linear combination between the WMA and SMA, since both had extremely efficient computations (see link at the end of the post) we could have a calculation for the linear regression where the number of operations is independent of length .
This post took me eons to make because it's related to the lsma, and I am rarely short on words when it comes to anything related to the lsma. Thx to LucF for the feedback and everything.
How To Show Vertical LinesExample of various methods to show dashed or solid vertical lines on chart based on using either session or time.
Credit for line method goes to midtownsk8rguy ->
Credit for plot method goes to PineCoders -> www.pinecoders.com
Special thanks to LucF, midtownsk8rguy, and PineCoders for permission to use their work.
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!
Highlight Last Bar of: D | W | M | Hour| H4 | MinutesSimple script highlighting a vertical line on the last bar of the Day/ Week/ Month/ Hour/ H4/ minute etc.
Helps maintain visibility of higher timeframes when on lower timeframes.
Quickly identify end of period levels.