UNICODE CHEAT SHEETHello fellow coders
This publication is not a indicator or a strategy but rather a quick reference guide for Unicode characters in Pine Code script format. It's purpose is to quickly identify and copy any desired characters to your own scripts.
Hope everyone finds this useful
Unicode
UnispacesLibrary "Unispaces"
Easier than looking up unicode spaces
spaces(sequence, string1, string2)
UNISPACES
Parameters:
sequence : (int) required | 123 = 3 spaces / 3 different sizes (one space per number can find spaces in hover over)
string1 : (str) optional | default = ""
string2 : (str) optional | default = ""
Returns: `string - concatenated string surrounding unispaces`
space(space, string1, string2)
UNISPACE
Parameters:
space : (int) optional | default = 0 | 0-15 (can find spaces in hover over)
string1 : (str) optional | default = ""
string2 : (str) optional | default = ""
Returns: `string - concatenated string surrounding a unispace `
fontLibrary "font"
Unicode Characters Replacement function for strings.
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Int input
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Name input
Exploring UnicodeThis script demonstrates how to display Unicode characters and symbols, including emoji, in Pine:
• Part 1 displays multi-line labels on hi/lo pivots.
• Part 2 displays price/volume bumps using small up/down arrows plotted with plotchar() .
• Part 3 detects bounces and uses plotshape() to mark them.
You can use our `f_bounceFrom()` function from this part as confirmation for signals in your strategies.
Note that the labels displayed on pivots with the code in Part 1 are plotted in the past. In realtime, they would only appear where they are after 50 bars have elapsed from that point. The other plots are plotted on the bar where their conditions are detected.
You can display thousands of Unicode characters and symbols using Pine. As you can see with our script, it is very easy to do so. The challenge will often be to find the exact symbols you are looking for. Many websites exist to help you explore Unicode characters or symbols. The PineCoders Resources page contains a section presenting a few of them.
Duyck has a Unicode font function script containing functions to convert strings to monospaced Unicode representations. TradingView uses the Trebuchet font for most of its text, including text displayed with Pine scripts. While its numerals are monospace and will align vertically in labels text, Duyck's functions will be handy when you need to convert characters to a monospaced form, so they also align vertically in multi-line labels.
What is Unicode?
Unicode is to character encoding what Wikipedia is to knowledge; it holds codes to a good proportion of the characters or symbols used by humans, past or present. In the early days of computing, environments from different manufacturers often used different character encoding schemes, making transport between them difficult. Unicode solves that challenge. It is a comprehensive encoding scheme that visionaries from Xerox and Apple came up with in the late 80's. The addition of members from the Research Libraries Group, Sun Microsystems, Microsoft, Next and Metaphor created the "Unicode working group" and later, the Unicode Consortium , which continues to improve and manage the Unicode standard.
Theoretically, Unicode encodes values representing characters or glyphs —not their pictorial representations. The letters "A" or "a", or the blue heart emoji "💙" are each represented by a Unicode value. In practice, however, there are many different versions of the Latin alphabet in Unicode. That is how our low pivot label can display different representations of the letters "ITV". The exact rendition of Unicode symbols on a specific device is left to equipment manufacturers and typeface designers.
The current Unicode space is comprised of 17 planes of 65,536 characters each, which allows for more than one million code points . Planes are further divided into character blocks , which typically hold a character set corresponding to one script—or language. Emoticons are in the character block starting at U+1F600.
Look first. Then leap.
Plotchar - How to draw external symbols on a chartHey everyone
It's been a while :) but still on holidays and working on the website. I'll resume the scripts sharing shortly once I'll get back home
For today, I wanted to share a very useful script that is going to make you a top of money 100% guaranteed and you'll even have a Lamborghini delivered at your place by tomorrow... (imagine some followers would believe me for this)
This "script" is a proof of concept that you can draw external Unicode symbols on a chart.
If you're tired with the plotshape shapes by default, you can use some others - I usually find mine there emojipedia.org
What are the use cases?
- Draw a dead skeleton when your stop-loss is hit
- Draw a winning cup when your take profit is hit
- Draw a coffin when you run out of capital
FAQ
Q: Does this script has any interest?
A: I'm not sure myself
Q: Will you make money using it?
A: I'm not a financial advisor but ... very likely NO
Q: Is it cool though?
A: Hell yeah!!
Be sure to hit the thumbs up so that I'll share real scripts the next times and not "joke scripts". I promise it's the first and last time I'm sharing such a script
Dave
____________________________________________________________
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python