SamRecio

Copy/Paste Levels

SamRecio Updated   
Copy/Paste Levels allows levels to be pasted onto your chart from a properly formatted source.
This tool streamlines the process of adding lines to your chart, and sharing lines from your chart.
More than one ticker at a time!
This indicator will only draw lines on charts it has values for!
This means you can input levels for every ticker you need all at once, one time, and only be displayed the levels for the current chart you are looking at. When you switch tickers, the levels for that ticker will display. (Assuming you have levels entered for that ticker)

The formatting is as follows:
Ticker,Color,Style,Width,Lvl1,Lvl2,Lvl3;

Ticker - Any ticker on Tradingview can be used in the field
Color - Available colors are: Red,Orange,Yellow,Green,Blue,Purple,White,Black,Gray
Style - Available styles are: Solid,Dashed,Dotted
Width - This can be any negative integer, ex.(-1,-2,-3,-4,-5)
Lvls - These can be any positive number (decimals allowed)
Semi-Colons separate sections, each section contains enough information to create at least 1 line.

Each additional level added within the same section will have the same styling parameters as the other levels in the section.
Example:
2 solid lines colored red with a thickness of 2 on QQQ, 1 at $300 and 1 at $400.
QQQ,RED,SOLID,-2,300,400;

IMPORTANT MUST READ!!!
Remember to not include any spaces between commas and the entries in each field!
ex. ; QQQ, red, dotted, -1, 325; <- Wrong
ex. ;QQQ,red,dotted,-1,325;)<- Right
However,
All fields must be filled out, to use default values in the fields, insert a space between the commas.

ex. ;QQQ,red,dotted,,325; <- Wrong
ex. ;QQQ,red,dotted, ,325; <- Right

While spaces can not be included line breaks can!
I recommend for easier typing and viewing to include a line break for each new line (if changing styling or ticker)
Example:
2 solid lines, one red at $300, one green at $400, both default width. Written in a single line AND using multiple lines, both give the same output.
QQQ,red,solid, ,300;QQQ,green,solid, ,400;
or
QQQ,red,solid, ,300;
QQQ,green,solid, ,400;

In this following screenshot you can see more examples of different formatting variations.
The textbox contains exactly what is pasted into the settings input box.
As you can see, capitalization does not matter.

Default Values:
Color = optimal contrast color, If this field is filled in with a space it will display the optimal contrast color of the users background.
Style = solid
Width = -1

More Examples:

Multi-Ticker: drawing 3 lines at $300, all default values, on 3 different tickers
SPY, , , ,300;QQQ, , , ,300;AAPL, , , ,300
or
SPY, , , ,300;
QQQ, , , ,300;
AAPL, , , ,300

Multiple levels: There is no limit* to the number of levels that can be included within 1 section.
* only TV default line limit per indicator (500)
This will be 4 lines all with the same styling at different values on 2 separate tickers.
SPY,BLUE,SOLID,-2,100,200,300,400;QQQ,BLUE,SOLID,-2,100,200,300,400
or
SPY,BLUE,SOLID,-2,100,200,300,400;
QQQ,BLUE,SOLID,-2,100,200,300,400

Semi-colons must separate sections, but are not required at the beginning or end, it makes no difference if they are or are not added.
SPY,BLUE,SOLID,-2,100,200,300,400;
QQQ,BLUE,SOLID,-2,100,200,300,400
==
SPY,BLUE,SOLID,-2,100,200,300,400;
QQQ,BLUE,SOLID,-2,100,200,300,400;
==
;SPY,BLUE,SOLID,-2,100,200,300,400;
QQQ,BLUE,SOLID,-2,100,200,300,400;

All the above output the same results.

Hope this is helpful for people,
Enjoy!
Release Notes:
-removed minor redundancy in the code
Release Notes:
-Added a new field for text.
-Added User option to toggle on and off the prices for labels.
-Error message now displays the current ticker.

NEW FORMAT is as follows:
Ticker,Color,Style,Width,Text,lvls;

More info about the text field:
The text field can contain everything other than commas(,) and semi-colons(;).
These characters will mess with the formatting system, do not use them.
All text will be uppercase. Spaces are allowed in this box!
The text field will still need a space left in it when not in use.
Regardless of the text field, the value of the line will still be displayed next to it. This can be toggled on and off by the user.
Release Notes:
Re-worked the system a little bit, found an error with the way it was detecting tickers.
Found it because of the text feature, but it could happen with normal tickers too.
It was checking if the current ticker you were on was contained anywhere within the entire line of inputs.
Ex. If you had "Target" in the text field, if you went on the "TA" chart you would have levels from whichever levels had "target" as the text.
I resolved this for drawing levels; however, I was not able to ENTIRELY resolve it for the error message functionality.
For the most part in normal use, it will not be noticed.
However, if you input a ticker and only a ticker into the text field of a level, the error message will not show up on the ticker in the text field.
So just don't do that...it doesn't make sense to do that either.
Also made the line drawing more efficient!
Release Notes:
because of previous update, it was not reading line breaks properly, now it does...again...as it should!
Release Notes:
reverted to the old error message, new one was causing issues.
If the ticker you are on is contained anywhere within the entire input you will not receive any error message or lines.
I'm already working on a better method for getting this method across.
Release Notes:
- added some leniency for spacing in the format. I would still recommend not include spaces, but this should help if there's some forgotten ones.
Release Notes:
added confirm input window when added to chart.
Release Notes:
ZONE UPDATE Added the ability to create zones in between lines.
When typing the format, in the "Style" field, simply include the word "ZONE" anywhere in that field.
ex. Solid_Zone, solidzone, solidzone
All of these work with every variation (solid, dotted, dashed)
OR
If you want the default setting, entering "zone" alone will still give a zone, with solid lines.

-These zones require 2 levels in the line associated with the zone. It will not work with 3, it will not work with 1. ONLY 2.
The price text label will display both prices for levels on the zone it is displaying.

-Zone Opacity is now an option in the settings.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?