CINXE.COM
Release notes
<!DOCTYPE html><html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script> const url = window.location.href; const expectedUrl = url.replace( /^https:\/\/(?!beta)(\w+\.)?tradingview\.com/, 'https://www.tradingview.com', ); if (url !== expectedUrl) { window.location.replace(expectedUrl); } </script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="none"><link rel="icon" href="https://static.tradingview.com/static/images/favicon.ico"><link rel="icon" type="image/svg+xml" href="/pine-script-docs/favicon.svg"><title>Release notes</title><meta name="og:title" content="Release notes"><meta name="twitter:title" content="Release notes"><meta name="description" content="Everything you need to know about Pine Script™."><meta name="og:description" content="Everything you need to know about Pine Script™."><meta name="twitter:description" content="Everything you need to know about Pine Script™."><meta name="keywords" content="tradingview, pine, script, indicators, strategies"><meta name="og:image" content="/pine-script-docs/meta-image.png"><meta name="twitter:image" content="/pine-script-docs/meta-image.png"><meta name="og:image:width" content="1200"><meta name="og:image:height" content="630"><meta name="og:url" content="https://www.tradingview.com/pine-script-docs/release-notes/"><meta name="twitter:url" content="https://www.tradingview.com/pine-script-docs/release-notes/"><meta name="og:type" content="website"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:site" content="@TradingView"><link rel="canonical" href="https://www.tradingview.com/pine-script-docs/release-notes/"><link rel="sitemap" href="/pine-script-docs/sitemap-index.xml"><link rel="stylesheet" href="/pine-script-docs/_astro/index.CI8A0IeF.css"> <link rel="stylesheet" href="/pine-script-docs/_astro/index.BL2bgAvq.css"> <style>.tv-spinner{display:none;position:absolute;margin:0 auto;border:0 solid rgb(149 152 161 / 20%);border-radius:50%;border-top-color:var(--tv-spinner-color, #2962ff);border-left-color:var(--tv-spinner-color, #2962ff);animation:tv-spinner-container-rotate .9s linear infinite}.tv-spinner-shown{display:block}.tv-spinner-size-large{top:calc(50% - 32px);left:calc(50% - 32px);width:56px;height:56px;border-width:4px}@keyframes tv-spinner-container-rotate{to{transform:rotate(360deg)}}:root{--page-background-color: #fff;background-color:var(--page-background-color)}:root[data-theme=dark]{--page-background-color: #000}body{background-color:var(--page-background-color)}#redirect-link{display:flex;position:absolute;inset:0;align-items:center;justify-content:center}#spinner{display:block;position:absolute;opacity:1;transition:opacity .2s} .twitter-tweet:not(.twitter-tweet-rendered){padding:var(--tc-padding, 1em);border:1px solid var(--tc-border-color, #cfd9de)}.twitter-tweet:not(.twitter-tweet-rendered)>:first-child{margin-top:0}.twitter-tweet:not(.twitter-tweet-rendered)>:last-child{margin-bottom:0}lite-youtube{background-color:#000;position:relative;display:block;contain:content;background-position:center center;background-size:cover;cursor:pointer;max-width:720px}lite-youtube:before{content:attr(data-title);display:block;position:absolute;top:0;background-image:linear-gradient(180deg,#000000ab,#0000008a 14%,#00000026 54%,#0000000d 72%,#0000 94%);height:99px;width:100%;font-family:YouTube Noto,Roboto,Arial,Helvetica,sans-serif;color:#eee;text-shadow:0 0 2px rgba(0,0,0,.5);font-size:18px;padding:25px 20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box}lite-youtube:hover:before{color:#fff}lite-youtube:after{content:"";display:block;padding-bottom:56.25%}lite-youtube>iframe{width:100%;height:100%;position:absolute;top:0;left:0;border:0}lite-youtube>.lty-playbtn{display:block;width:100%;height:100%;background:no-repeat center/68px 48px;background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.63 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="red"/><path d="M45 24 27 14v20" fill="white"/></svg>');position:absolute;cursor:pointer;z-index:1;filter:grayscale(100%);transition:filter .1s cubic-bezier(0,0,.2,1);border:0}lite-youtube:hover>.lty-playbtn,lite-youtube .lty-playbtn:focus{filter:none}lite-youtube.lyt-activated{cursor:unset}lite-youtube.lyt-activated:before,lite-youtube.lyt-activated>.lty-playbtn{opacity:0;pointer-events:none}.lyt-visually-hidden{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}lite-youtube>iframe{all:unset!important;width:100%!important;height:100%!important;position:absolute!important;inset:0!important;border:0!important}lite-vimeo{font-size:10px;background-color:#000;position:relative;display:block;contain:content;background-position:center center;background-size:cover}lite-vimeo:after{content:"";display:block;padding-bottom:56.25%}lite-vimeo>iframe{all:unset!important;width:100%!important;height:100%!important;position:absolute!important;inset:0!important;border:0!important}lite-vimeo>.ltv-playbtn{content:"";position:absolute;inset:0;width:100%;background:transparent;outline:0;border:0;cursor:pointer}lite-vimeo>.ltv-playbtn:before{width:6.5em;height:4em;background:#172322bf;opacity:.8;border-radius:.25rem;transition:all .2s cubic-bezier(0,0,.2,1)}lite-vimeo>.ltv-playbtn:focus:before{outline:auto}lite-vimeo:hover>.ltv-playbtn:before{background-color:#00adef;background-color:var(--ltv-color, #00adef);opacity:1}lite-vimeo>.ltv-playbtn:after{border-style:solid;border-width:1em 0 1em 1.7em;border-color:transparent transparent transparent #fff}lite-vimeo>.ltv-playbtn:before,lite-vimeo>.ltv-playbtn:after{content:"";position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}lite-vimeo.ltv-activated:before,lite-vimeo.ltv-activated>.ltv-playbtn{cursor:unset;opacity:0;pointer-events:none} </style><script type="module" src="/pine-script-docs/_astro/hoisted.6418KLaP.js"></script></head> <body> <div id="search-content-blur" hidden></div> <script> /* eslint-disable @typescript-eslint/typedef */ window.ThemeProvider = (() => { function getCurrent() { return ( // eslint-disable-next-line no-restricted-syntax typeof localStorage !== 'undefined' && localStorage.getItem('tv-docs-theme') ); } const storedTheme = getCurrent(); const theme = storedTheme || (window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'); document.documentElement.dataset.theme = theme === 'light' ? 'light' : 'dark'; document.documentElement.classList.toggle( 'theme-dark', theme === 'dark', ); // add support for ui-lib themes document.documentElement.classList.toggle( 'sl-theme-dark', theme === 'dark', ); // add support for shoelace themes return { updatePickers(themeArg = storedTheme || 'auto') { let currentTheme = themeArg; if (currentTheme === 'unknown') { currentTheme = getCurrent() || 'auto'; } document .querySelectorAll('docs-theme-select') .forEach((picker) => { const select = picker.querySelector('select'); if (select) select.value = currentTheme; /** @type {HTMLTemplateElement | null} */ const tmpl = document.querySelector(`#theme-icons`); const newIcon = tmpl && tmpl.content.querySelector('.' + currentTheme); if (newIcon) { const oldIcon = picker.querySelector('svg.label-icon'); if (oldIcon) { oldIcon.replaceChildren( ...newIcon.cloneNode(true).childNodes, ); } } }); }, }; })(); /* eslint-enable @typescript-eslint/typedef */ </script><template id="theme-icons"><svg width="16" height="16" viewBox="0 0 28 28" class="light" data-icon="theme/sun-28"> <symbol id="ai:local:theme/sun-28"><g fill="currentColor"><path d="M14 3h1.5v5H14V3Zm0 18h1.5v5H14v-5Zm12-5.5V14h-5v1.5h5ZM8 14v1.5H3V14h5Zm15.3-7-1-1-3.6 3.6 1.1 1 3.5-3.5ZM9.5 18.7l1.1 1.1-3.5 3.5-1-1 3.4-3.6ZM22 23.3l1-1-3.6-3.6-1 1.1 3.5 3.5ZM10.3 9.6l-1.1 1-3.5-3.5 1-1 3.6 3.5Z"/><path fill-rule="evenodd" d="M19 14.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-1.5 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" clip-rule="evenodd"/></g></symbol><use xlink:href="#ai:local:theme/sun-28"></use> </svg><svg width="16" height="16" viewBox="0 0 28 28" class="dark" data-icon="theme/moon-28"> <symbol id="ai:local:theme/moon-28"><path fill="currentColor" fill-rule="evenodd" d="M21 7.02A9.23 9.23 0 0 0 15.2 5 9.1 9.1 0 0 0 6 14c0 4.97 4.12 9 9.2 9a9.33 9.33 0 0 0 5.8-2.02A7 7 0 0 1 14.36 14 7 7 0 0 1 21 7.02Zm-3.95-.3a7.91 7.91 0 0 0-1.85-.22A7.6 7.6 0 0 0 7.5 14a7.6 7.6 0 0 0 7.7 7.5 8 8 0 0 0 1.85-.22A8.46 8.46 0 0 1 12.86 14c0-3.1 1.69-5.8 4.19-7.28Z" clip-rule="evenodd"/></symbol><use xlink:href="#ai:local:theme/moon-28"></use> </svg><svg width="16" height="16" viewBox="0 0 28 28" class="auto" data-icon="theme/system-28"> <symbol id="ai:local:theme/system-28"><path fill="currentColor" d="M8 4h1v2H8V4Zm0 9v2h1v-2H8Zm6-3V9h-2v1h2ZM3 9v1h2V9H3Zm5.5 3a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm4.2-6-.7-.7-1.4 1.4.7.7L12.7 6ZM5 13.7l-.7-.7 1.4-1.4.7.7L5 13.7Zm7.7-.7-.7.7-1.4-1.4.7-.7 1.4 1.4ZM4.3 6l.7-.7 1.4 1.4-.7.7L4.3 6Zm3 17 14-14 .8.7L8 23.7l-.7-.7Zm17.2-.1a3.5 3.5 0 0 1-3.4-5.9H21a4 4 0 1 0 3.5 5.9Z"/></symbol><use xlink:href="#ai:local:theme/system-28"></use> </svg></template> <div class="backdrop" data-mobile-menu-backdrop data-astro-cid-h2irkosh></div> <div class="menu-container" data-astro-cid-h2irkosh> <div class="header" data-astro-cid-h2irkosh> <div class="header-group" data-astro-cid-h2irkosh> <div id="version-select" data-astro-cid-kx7qoxgq> <label style="--sl-select-width: undefined; --sl-label-icon-size: 16px;" data-astro-cid-lmznfliq> <span class="sr-only" data-astro-cid-lmznfliq>Version</span> <select value="v6" data-has-border no-icon="true" data-astro-cid-lmznfliq> <option value="v6" selected="true" data-astro-cid-lmznfliq>Version 6</option><option value="v5" data-astro-cid-lmznfliq>Version 5</option><option value="v4" data-astro-cid-lmznfliq>Version 4</option><option value="v3" data-astro-cid-lmznfliq>Version 3</option> </select> <svg width="16" height="16" viewBox="0 0 24 24" class="icon caret" data-astro-cid-lmznfliq data-icon="theme/down-caret"> <symbol id="ai:local:theme/down-caret"><path fill="currentColor" d="M17 9.17a1 1 0 0 0-1.41 0L12 12.71 8.46 9.17a1 1 0 1 0-1.41 1.42l4.24 4.24a1.002 1.002 0 0 0 1.42 0L17 10.59a1.002 1.002 0 0 0 0-1.42Z"/></symbol><use xlink:href="#ai:local:theme/down-caret"></use> </svg> </label> </div> <docs-theme-select class="" data-astro-cid-3wpspbi7> <label style="--sl-select-width: 48px; --sl-label-icon-size: 28px;" data-astro-cid-lmznfliq> <span class="sr-only" data-astro-cid-lmznfliq>Theme</span> <svg width="28" height="28" viewBox="0 0 28 28" class="icon label-icon" data-button data-round data-astro-cid-lmznfliq data-icon="theme/system-28"> <use xlink:href="#ai:local:theme/system-28"></use> </svg> <select value="auto" data-button data-astro-cid-lmznfliq> <option value="dark" data-astro-cid-lmznfliq> Dark </option><option value="light" data-astro-cid-lmznfliq> Light </option><option value="auto" selected="true" data-astro-cid-lmznfliq> Auto </option> </select> </label> </docs-theme-select> <script> ThemeProvider.updatePickers('unknown'); </script> </div> <div class="header-group" data-astro-cid-h2irkosh> <div class="not-content" style="stroke-width:2px" data-astro-cid-pkzv2hgs> <button id="mobile-menu-back-button" title="Close menu" data-astro-cid-pkzv2hgs class="not-content stvb-base stvb-pointer stvb-gray stvb-medium stvb-primary stvb-icon"> <svg width="28" height="28" viewBox="0 0 28 28" data-astro-cid-h2irkosh data-icon="theme/arrow-back"> <symbol id="ai:local:theme/arrow-back"><g fill="none"><g clip-path="url(#a)"><path stroke="var(--arrow-fill-color, #131722)" d="m17 20-6-6 6-6"/></g><defs><clipPath id="a"><path fill="#fff" d="M28 28H0V0h28z"/></clipPath></defs></g></symbol><use xlink:href="#ai:local:theme/arrow-back"></use> </svg> </button> </div> </div> </div> <aside id="nav" class="keep-visible" style="--navbar-right-border-width: 0px" data-astro-cid-sa57sq6l> <div class="sidebar-viewport slick-scroll" data-astro-cid-sa57sq6l> <div class="sidebar" data-mobile data-astro-cid-sa57sq6l> <ul class="toc" aria-label="Docs sidebar" data-astro-cid-sa57sq6l> <li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/welcome" data-astro-cid-omxx3dey>Welcome to Pine Script™ v6</a></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Pine Script™ primer</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/first-steps" data-astro-cid-omxx3dey>First steps</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/first-indicator" data-astro-cid-omxx3dey>First indicator</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/next-steps" data-astro-cid-omxx3dey>Next steps</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Language</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/execution-model" data-astro-cid-omxx3dey>Execution model</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/time-series" data-astro-cid-omxx3dey>Time series</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/script-structure" data-astro-cid-omxx3dey>Script structure</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/identifiers" data-astro-cid-omxx3dey>Identifiers</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/operators" data-astro-cid-omxx3dey>Operators</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/variable-declarations" data-astro-cid-omxx3dey>Variable declarations</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/conditional-structures" data-astro-cid-omxx3dey>Conditional structures</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/loops" data-astro-cid-omxx3dey>Loops</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/type-system" data-astro-cid-omxx3dey>Type system</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/built-ins" data-astro-cid-omxx3dey>Built-ins</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/user-defined-functions" data-astro-cid-omxx3dey>User-defined functions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/objects" data-astro-cid-omxx3dey>Objects</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/enums" data-astro-cid-omxx3dey>Enums</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/methods" data-astro-cid-omxx3dey>Methods</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/arrays" data-astro-cid-omxx3dey>Arrays</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/matrices" data-astro-cid-omxx3dey>Matrices</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/maps" data-astro-cid-omxx3dey>Maps</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Concepts</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/alerts" data-astro-cid-omxx3dey>Alerts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/backgrounds" data-astro-cid-omxx3dey>Backgrounds</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-coloring" data-astro-cid-omxx3dey>Bar coloring</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-plotting" data-astro-cid-omxx3dey>Bar plotting</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-states" data-astro-cid-omxx3dey>Bar states</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/chart-information" data-astro-cid-omxx3dey>Chart information</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/colors" data-astro-cid-omxx3dey>Colors</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/fills" data-astro-cid-omxx3dey>Fills</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/inputs" data-astro-cid-omxx3dey>Inputs</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/levels" data-astro-cid-omxx3dey>Levels</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/libraries" data-astro-cid-omxx3dey>Libraries</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/lines-and-boxes" data-astro-cid-omxx3dey>Lines and boxes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/non-standard-charts-data" data-astro-cid-omxx3dey>Non-standard charts data</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/other-timeframes-and-data" data-astro-cid-omxx3dey>Other timeframes and data</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/plots" data-astro-cid-omxx3dey>Plots</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/repainting" data-astro-cid-omxx3dey>Repainting</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/sessions" data-astro-cid-omxx3dey>Sessions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/strategies" data-astro-cid-omxx3dey>Strategies</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/tables" data-astro-cid-omxx3dey>Tables</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/text-and-shapes" data-astro-cid-omxx3dey>Text and shapes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/time" data-astro-cid-omxx3dey>Time</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/timeframes" data-astro-cid-omxx3dey>Timeframes</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Writing scripts</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/style-guide" data-astro-cid-omxx3dey>Style guide</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/debugging" data-astro-cid-omxx3dey>Debugging</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/profiling-and-optimization" data-astro-cid-omxx3dey>Profiling and optimization</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/publishing" data-astro-cid-omxx3dey>Publishing scripts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/limitations" data-astro-cid-omxx3dey>Limitations</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>FAQ</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/general" data-astro-cid-omxx3dey>General</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/alerts" data-astro-cid-omxx3dey>Alerts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/data-structures" data-astro-cid-omxx3dey>Data structures</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/functions" data-astro-cid-omxx3dey>Functions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/indicators" data-astro-cid-omxx3dey>Indicators</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/other-data-and-timeframes" data-astro-cid-omxx3dey>Other data and timeframes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/programming" data-astro-cid-omxx3dey>Programming</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/strings-and-formatting" data-astro-cid-omxx3dey>Strings and formatting</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/error-messages" data-astro-cid-omxx3dey>Error messages</a></li><li class="item" data-current data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/release-notes" data-astro-cid-omxx3dey>Release notes</a></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Migration guides</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-6" data-astro-cid-omxx3dey>To Pine Script™ version 6</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-5" data-astro-cid-omxx3dey>To Pine Script™ version 5</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-4" data-astro-cid-omxx3dey>To Pine Script™ version 4</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-3" data-astro-cid-omxx3dey>To Pine Script™ version 3</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/where-can-i-get-more-information" data-astro-cid-omxx3dey>Where can I get more information?</a></li> </ul> <div class="toc-bottom" data-astro-cid-sa57sq6l></div> </div> </div> </aside> </div> <header class="header" data-astro-cid-d74r2unp> <nav role="navigation" aria-label="Main Navigation" data-astro-cid-d74r2unp> <mobile-menu-button id="mobile-menu-button-wc" data-astro-cid-oojooh3d> <!-- Annoyingly I need to wrap this. TODO: improve this --> <div id="mobile-menu-button-header" data-astro-cid-oojooh3d> <div class="not-content" style="" data-astro-cid-pkzv2hgs> <button title="Open navigation menu" data-astro-cid-pkzv2hgs class="not-content stvb-base stvb-pointer stvb-gray stvb-medium stvb-secondary stvb-icon stvb-icon-force-color stvb-force-no-border"> <svg width="28" height="28" viewBox="0 0 24 24" data-astro-cid-oojooh3d data-icon="theme/bars"> <symbol id="ai:local:theme/bars"><path fill="currentColor" d="M3 8h18a1 1 0 1 0 0-2H3a1 1 0 0 0 0 2Zm18 8H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2Zm0-5H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2Z"/></symbol><use xlink:href="#ai:local:theme/bars"></use> </svg> </button> </div> </div> </mobile-menu-button> <div data-hide-when-search data-astro-cid-d74r2unp> <div class="header-logo" data-astro-cid-tycb33lk> <a href="/pine-script-docs/" aria-label="Home button" data-astro-cid-tycb33lk> <div class="documentation-logo logo" data-astro-cid-tycb33lk><svg width="188" height="44" viewBox="0 0 188 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M26.9989 28.0001L18.4281 20.7531L11.3382 23.2611C10.402 23.5923 9.60771 22.5041 10.2085 21.7134L21.0877 7.39502C21.4749 6.88536 22.2346 6.86567 22.6478 7.35459L34.7627 21.6923C35.1531 22.1543 35.0472 22.8544 34.5376 23.1802L26.9989 28.0001ZM32.4978 22.1105L27.1641 25.5207L19.7195 19.2258C19.1767 18.7669 18.4312 18.6305 17.7611 18.8676L13.8245 20.2602L21.9253 9.59841L32.4978 22.1105Z" fill="currentColor"/> <path d="M33.432 28.0842L38.3592 34.7471C38.7427 35.2657 38.3724 36 37.7274 36H6.27248C5.62746 36 5.25722 35.2657 5.64074 34.7471L10.8523 27.6996C10.9484 27.5697 11.0822 27.4725 11.2356 27.4214L17.6878 25.2707C17.9285 25.1904 18.1932 25.2314 18.3984 25.3806L26.2854 31.1166C26.5445 31.3051 26.8922 31.3173 27.1639 31.1475L32.3838 27.885C32.7316 27.6677 33.1881 27.7544 33.432 28.0842Z" fill="currentColor"/> <path d="M59.56 13.96C63.016 13.96 65.536 16.456 65.536 19.696C65.536 22.936 63.016 25.432 59.56 25.432H57.376V31H53.896V13.96H59.56ZM59.512 22.168C61.096 22.168 62.152 21.088 62.152 19.696C62.152 18.304 61.096 17.224 59.512 17.224H57.376V22.168H59.512ZM70.8636 14.944C70.8636 16.096 69.9276 17.032 68.7516 17.032C67.6236 17.032 66.6636 16.096 66.6636 14.944C66.6636 13.792 67.6236 12.856 68.7516 12.856C69.9276 12.856 70.8636 13.792 70.8636 14.944ZM67.1196 31V19H70.4076V31H67.1196ZM73.0849 31V19H76.3729V20.368C76.9969 19.408 78.2449 18.736 79.8049 18.736C82.7089 18.736 84.4369 20.848 84.4369 23.968V31H81.1489V24.52C81.1489 22.792 80.4049 21.736 79.0369 21.736C77.5249 21.736 76.3729 22.84 76.3729 25.144V31H73.0849ZM86.2041 25C86.2041 21.448 88.8681 18.736 92.5161 18.736C95.6601 18.736 98.4201 20.752 98.4201 24.64C98.4201 24.928 98.4201 25.264 98.3721 25.768H89.3961C89.5881 27.376 91.0041 28.264 92.5881 28.264C94.0761 28.264 95.1561 27.568 95.6841 26.752L98.1321 28.576C97.0281 30.184 95.0841 31.264 92.5641 31.264C88.9881 31.264 86.2041 28.792 86.2041 25ZM92.4201 21.448C91.1961 21.448 89.8281 22.072 89.5161 23.536H95.1321C94.8441 22.12 93.6441 21.448 92.4201 21.448ZM104.412 28.24L107.076 26.008C107.916 27.28 109.38 28.024 110.772 28.024C112.14 28.024 113.052 27.352 113.052 26.368C113.052 25.408 112.356 24.736 110.676 24.16L109.236 23.656C106.5 22.696 105.036 21.112 105.036 18.784C105.036 15.568 107.484 13.672 110.796 13.672C112.884 13.672 114.708 14.392 116.172 16.024L113.868 18.4C113.052 17.416 111.996 16.936 110.82 16.936C109.644 16.936 108.54 17.44 108.54 18.448C108.54 19.48 109.38 19.936 111.18 20.584L112.548 21.088C115.044 22 116.604 23.584 116.604 26.152C116.58 29.2 114.156 31.288 110.628 31.288C107.916 31.288 105.636 30.112 104.412 28.24ZM129.859 27.808C128.827 29.872 126.667 31.264 124.171 31.264C120.619 31.264 117.811 28.624 117.811 25C117.811 21.376 120.619 18.736 124.171 18.736C126.667 18.736 128.827 20.128 129.859 22.192L127.003 23.728C126.523 22.624 125.491 21.808 124.171 21.808C122.443 21.808 121.123 23.152 121.123 25C121.123 26.848 122.443 28.192 124.171 28.192C125.491 28.192 126.523 27.376 127.003 26.272L129.859 27.808ZM131.482 31V19H134.77V20.92C135.178 19.744 136.402 18.856 137.746 18.856C138.082 18.856 138.442 18.88 138.85 19V22.336C138.346 22.168 137.89 22.072 137.362 22.072C135.802 22.072 134.77 23.296 134.77 25.264V31H131.482ZM144.215 14.944C144.215 16.096 143.279 17.032 142.103 17.032C140.975 17.032 140.015 16.096 140.015 14.944C140.015 13.792 140.975 12.856 142.103 12.856C143.279 12.856 144.215 13.792 144.215 14.944ZM140.471 31V19H143.759V31H140.471ZM146.436 36.016V19H149.724V20.344C150.276 19.576 151.548 18.736 153.204 18.736C156.396 18.736 158.844 21.592 158.844 25C158.844 28.408 156.396 31.264 153.204 31.264C151.548 31.264 150.276 30.424 149.724 29.656V36.016H146.436ZM155.508 25C155.508 23.128 154.284 21.736 152.484 21.736C150.684 21.736 149.46 23.128 149.46 25C149.46 26.872 150.684 28.264 152.484 28.264C154.284 28.264 155.508 26.872 155.508 25ZM168.407 30.88C167.879 31.048 167.231 31.144 166.319 31.144C163.775 31.144 161.735 29.728 161.735 26.8V21.88H159.311V19H161.735V15.664H165.023V19H168.407V21.88H165.023V26.152C165.023 27.616 165.647 28.192 167.063 28.192C167.591 28.192 168.023 28.12 168.407 27.976V30.88ZM177.626 22.648V13.96H179.978L181.874 16.888L183.746 13.96H186.122V22.648H183.698V18.184L181.874 20.968L180.026 18.136V22.648H177.626ZM171.386 22.648V16.456H169.058V13.96H176.258V16.456H173.93V22.648H171.386Z" fill="currentColor"/> </svg> </div> </a> </div> </div> <div class="flex" data-astro-cid-d74r2unp></div> <div class="flex" data-astro-cid-d74r2unp> <div class="search-container" data-astro-cid-fg37foga> <div class="search-wrapper" data-astro-cid-fg37foga> <input class="search-input" type="text" placeholder="Search docs" name="s" value="" data-astro-cid-fg37foga> <svg width="28" height="28" viewBox="0 0 28 28" class="search-button" data-astro-cid-fg37foga data-icon="theme/search"> <symbol id="ai:local:theme/search"><path fill="currentColor" fill-rule="evenodd" d="M18.5 12.5a6 6 0 1 1-12 0 6 6 0 0 1 12 0Zm-1.25 5.8a7.5 7.5 0 1 1 1.06-1.06l4.22 4.23.53.53L22 23.06l-.53-.53-4.22-4.22Z" clip-rule="evenodd"/></symbol><use xlink:href="#ai:local:theme/search"></use> </svg> <button class="search-clear" type="button" title="Reset" data-search-clear data-astro-cid-fg37foga>Clear</button> <span class="divider" data-astro-cid-fg37foga></span> <button class="search-close" type="button" title="Close" data-search-close data-astro-cid-fg37foga> <svg width="18" height="18" viewBox="0 0 18 18" data-astro-cid-fg37foga data-icon="theme/cross-18"> <use xlink:href="#ai:local:theme/cross-18"></use> </svg> </button> </div> <div id="search-results-wrapper" data-astro-cid-fg37foga> <aside id="search-results" hidden data-astro-cid-fg37foga> <!-- Don't use h1 because when built it will be used as the first heading on the page --> <div class="heading" data-astro-cid-fg37foga>Search results</div> <div id="search-results-contents" data-astro-cid-fg37foga></div> </aside> </div> </div> </div> <ul class="links" data-astro-cid-d74r2unp> </ul> <div class="flex" data-astro-cid-d74r2unp></div> <div data-hide-when-search data-astro-cid-d74r2unp> <div id="version-select" data-hideable="true" data-astro-cid-kx7qoxgq> <label style="--sl-select-width: undefined; --sl-label-icon-size: 16px;" data-astro-cid-lmznfliq> <span class="sr-only" data-astro-cid-lmznfliq>Version</span> <select value="v6" data-has-border no-icon="true" data-astro-cid-lmznfliq> <option value="v6" selected="true" data-astro-cid-lmznfliq>Version 6</option><option value="v5" data-astro-cid-lmznfliq>Version 5</option><option value="v4" data-astro-cid-lmznfliq>Version 4</option><option value="v3" data-astro-cid-lmznfliq>Version 3</option> </select> <svg width="16" height="16" viewBox="0 0 24 24" class="icon caret" data-astro-cid-lmznfliq data-icon="theme/down-caret"> <use xlink:href="#ai:local:theme/down-caret"></use> </svg> </label> </div> </div> <button id="search-button" data-astro-cid-6zeqadij> <svg width="28" height="28" viewBox="0 0 28 28" data-astro-cid-6zeqadij data-icon="theme/search"> <use xlink:href="#ai:local:theme/search"></use> </svg> </button> <script data-base-url="/pine-script-docs"> async function loadPageFind() { const base = document.currentScript.getAttribute('data-base-url'); const pageFindBundleUrl = `${base}/pagefind/`; const pagefind = await import(`${pageFindBundleUrl}pagefind.js`); await pagefind.options({ bundlePath: pageFindBundleUrl, }); window.pagefind = pagefind; } loadPageFind().catch(); </script> <docs-theme-select class="hide-with-breakpoint-568" data-astro-cid-3wpspbi7> <label style="--sl-select-width: 48px; --sl-label-icon-size: 28px;" data-astro-cid-lmznfliq> <span class="sr-only" data-astro-cid-lmznfliq>Theme</span> <svg width="28" height="28" viewBox="0 0 28 28" class="icon label-icon" data-button data-round data-astro-cid-lmznfliq data-icon="theme/system-28"> <use xlink:href="#ai:local:theme/system-28"></use> </svg> <select value="auto" data-button data-astro-cid-lmznfliq> <option value="dark" data-astro-cid-lmznfliq> Dark </option><option value="light" data-astro-cid-lmznfliq> Light </option><option value="auto" selected="true" data-astro-cid-lmznfliq> Auto </option> </select> </label> </docs-theme-select> <script> ThemeProvider.updatePickers('unknown'); </script> </nav> </header> <div id="image-lightbox" class="not-content" hidden data-astro-cid-kws7taxh> <div class="button-wrapper" data-astro-cid-kws7taxh> <div class="not-content" style="" data-astro-cid-pkzv2hgs> <button id="lightbox-close-button" title="Close image preview" data-astro-cid-pkzv2hgs class="not-content stvb-base stvb-pointer stvb-black stvb-medium stvb-secondary stvb-icon stvb-force-no-border"> <svg width="24" height="24" viewBox="0 0 18 18" data-astro-cid-kws7taxh data-icon="theme/cross-18"> <symbol id="ai:local:theme/cross-18"><g fill="none"><g clip-path="url(#a)"><path fill="currentColor" fill-rule="evenodd" d="M5.53 4.47 4.47 5.53 7.94 9l-3.47 3.47 1.06 1.06L9 10.06l3.47 3.47 1.06-1.06L10.06 9l3.47-3.47-1.06-1.06L9 7.94 5.53 4.47Z" clip-rule="evenodd"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h18v18H0z"/></clipPath></defs></g></symbol><use xlink:href="#ai:local:theme/cross-18"></use> </svg> </button> </div> </div> <img id="lightbox-image" src="" data-astro-cid-kws7taxh> </div> <div id="page-container" data-astro-cid-xgirumru> <aside id="nav" class="" style="" data-astro-cid-sa57sq6l> <div class="sidebar-viewport slick-scroll" data-astro-cid-sa57sq6l> <div class="sidebar" data-astro-cid-sa57sq6l> <ul class="toc" aria-label="Docs sidebar" data-astro-cid-sa57sq6l> <li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/welcome" data-astro-cid-omxx3dey>Welcome to Pine Script™ v6</a></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Pine Script™ primer</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <symbol id="ai:local:theme/right-caret"><path fill="currentColor" d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></symbol><use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/first-steps" data-astro-cid-omxx3dey>First steps</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/first-indicator" data-astro-cid-omxx3dey>First indicator</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/primer/next-steps" data-astro-cid-omxx3dey>Next steps</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Language</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/execution-model" data-astro-cid-omxx3dey>Execution model</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/time-series" data-astro-cid-omxx3dey>Time series</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/script-structure" data-astro-cid-omxx3dey>Script structure</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/identifiers" data-astro-cid-omxx3dey>Identifiers</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/operators" data-astro-cid-omxx3dey>Operators</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/variable-declarations" data-astro-cid-omxx3dey>Variable declarations</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/conditional-structures" data-astro-cid-omxx3dey>Conditional structures</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/loops" data-astro-cid-omxx3dey>Loops</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/type-system" data-astro-cid-omxx3dey>Type system</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/built-ins" data-astro-cid-omxx3dey>Built-ins</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/user-defined-functions" data-astro-cid-omxx3dey>User-defined functions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/objects" data-astro-cid-omxx3dey>Objects</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/enums" data-astro-cid-omxx3dey>Enums</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/methods" data-astro-cid-omxx3dey>Methods</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/arrays" data-astro-cid-omxx3dey>Arrays</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/matrices" data-astro-cid-omxx3dey>Matrices</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/language/maps" data-astro-cid-omxx3dey>Maps</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Concepts</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/alerts" data-astro-cid-omxx3dey>Alerts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/backgrounds" data-astro-cid-omxx3dey>Backgrounds</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-coloring" data-astro-cid-omxx3dey>Bar coloring</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-plotting" data-astro-cid-omxx3dey>Bar plotting</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/bar-states" data-astro-cid-omxx3dey>Bar states</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/chart-information" data-astro-cid-omxx3dey>Chart information</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/colors" data-astro-cid-omxx3dey>Colors</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/fills" data-astro-cid-omxx3dey>Fills</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/inputs" data-astro-cid-omxx3dey>Inputs</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/levels" data-astro-cid-omxx3dey>Levels</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/libraries" data-astro-cid-omxx3dey>Libraries</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/lines-and-boxes" data-astro-cid-omxx3dey>Lines and boxes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/non-standard-charts-data" data-astro-cid-omxx3dey>Non-standard charts data</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/other-timeframes-and-data" data-astro-cid-omxx3dey>Other timeframes and data</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/plots" data-astro-cid-omxx3dey>Plots</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/repainting" data-astro-cid-omxx3dey>Repainting</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/sessions" data-astro-cid-omxx3dey>Sessions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/strategies" data-astro-cid-omxx3dey>Strategies</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/tables" data-astro-cid-omxx3dey>Tables</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/text-and-shapes" data-astro-cid-omxx3dey>Text and shapes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/time" data-astro-cid-omxx3dey>Time</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/concepts/timeframes" data-astro-cid-omxx3dey>Timeframes</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Writing scripts</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/style-guide" data-astro-cid-omxx3dey>Style guide</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/debugging" data-astro-cid-omxx3dey>Debugging</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/profiling-and-optimization" data-astro-cid-omxx3dey>Profiling and optimization</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/publishing" data-astro-cid-omxx3dey>Publishing scripts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/writing/limitations" data-astro-cid-omxx3dey>Limitations</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>FAQ</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/general" data-astro-cid-omxx3dey>General</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/alerts" data-astro-cid-omxx3dey>Alerts</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/data-structures" data-astro-cid-omxx3dey>Data structures</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/functions" data-astro-cid-omxx3dey>Functions</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/indicators" data-astro-cid-omxx3dey>Indicators</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/other-data-and-timeframes" data-astro-cid-omxx3dey>Other data and timeframes</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/programming" data-astro-cid-omxx3dey>Programming</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/faq/strings-and-formatting" data-astro-cid-omxx3dey>Strings and formatting</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/error-messages" data-astro-cid-omxx3dey>Error messages</a></li><li class="item" data-current data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/release-notes" data-astro-cid-omxx3dey>Release notes</a></li><li class="item" data-astro-cid-omxx3dey><details data-astro-cid-omxx3dey><summary data-astro-cid-omxx3dey><div class="summary-link" data-astro-cid-omxx3dey>Migration guides</div><div class="caret" data-astro-cid-omxx3dey><svg width="18" height="18" viewBox="0 0 24 24" class="icon" data-astro-cid-omxx3dey data-icon="theme/right-caret"> <use xlink:href="#ai:local:theme/right-caret"></use> </svg></div></summary><ul class="children" data-astro-cid-omxx3dey><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-6" data-astro-cid-omxx3dey>To Pine Script™ version 6</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-5" data-astro-cid-omxx3dey>To Pine Script™ version 5</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-4" data-astro-cid-omxx3dey>To Pine Script™ version 4</a></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/migration-guides/to-pine-version-3" data-astro-cid-omxx3dey>To Pine Script™ version 3</a></li></ul></details></li><li class="item" data-astro-cid-omxx3dey><a class="page-link" href="/pine-script-docs/where-can-i-get-more-information" data-astro-cid-omxx3dey>Where can I get more information?</a></li> </ul> <div class="toc-bottom" data-astro-cid-sa57sq6l></div> </div> </div> </aside> <main class="main-pane" data-page-type="md" data-astro-cid-xgirumru> <a id="top" data-astro-cid-xgirumru></a> <main class="content" data-toc-shown data-astro-cid-ju3wuhkz> <div class="content-width" data-astro-cid-xgirumru> <div class="breadcrumbs" data-pagefind-ignore data-astro-cid-wlavna2o> <a href="/pine-script-docs" aria-label="Return back to the documentation home page." data-astro-cid-wlavna2o> <span data-astro-cid-wlavna2o>User Manual</span> </a> <span class="divider" data-astro-cid-wlavna2o>/</span> <span class="current-item" data-astro-cid-wlavna2o>Release notes</span> </div> </div> <div id="slot-container" data-astro-cid-xgirumru> <h1 id="release-notes" class="md-heading"><a href="#release-notes">Release notes<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h1> <p>This page contains release notes describing notable changes to the Pine Script™ experience.</p> <h2 id="2024" class="md-heading"><a href="#2024">2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="november-2024" class="md-heading"><a href="#november-2024">November 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="introducing-pine-script-v6" class="md-heading"><a href="#introducing-pine-script-v6">Introducing Pine Script™ v6<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Pine Script™ has graduated to v6! Starting today, future Pine updates will apply exclusively to this version. Therefore, we recommend converting existing v5 scripts to access new features as we roll them out. See our <a href="/pine-script-docs/migration-guides/to-pine-version-6/">migration guide</a> to understand the changes to existing Pine behaviors and learn how to convert scripts to v6.</p> <p>Several new features and behaviors come with this version’s release:</p> <ul> <li>Scripts can now call <code dir="auto">request.*()</code> functions with <em>“series string”</em> arguments for the parameters that define the requested context, meaning a single <code dir="auto">request.*()</code> call can change its requested data feed on <em>any</em> historical bar. Additionally, it is now possible to call <code dir="auto">request.*()</code> functions inside the local scopes of <a href="/pine-script-docs/language/loops/">loops</a>, <a href="/pine-script-docs/language/conditional-structures/">conditional structures</a>, and exported <a href="/pine-script-docs/concepts/libraries/">library</a> functions. See the <a href="/pine-script-docs/concepts/other-timeframes-and-data/#dynamic-requests">Dynamic requests</a> section of the <a href="/concepts/other-timeframes-and-data/">Other timeframes and data</a> page to learn more.</li> <li>Values of the “bool” type are now strictly <code dir="auto">true</code> or <code dir="auto">false</code>. They are never <a href="https://www.tradingview.com/pine-script-reference/v6/#var_na">na</a> in v6. Additionally, the <a href="https://www.tradingview.com/pine-script-reference/v6/#kw_or">or</a> and <a href="https://www.tradingview.com/pine-script-reference/v6/#kw_and">and</a> operators now feature <em>short-circuit (“lazy”)</em> evaluation. If the first expression of an <a href="https://www.tradingview.com/pine-script-reference/v6/#kw_or">or</a> operation is <code dir="auto">true</code>, or the first expression of an <a href="https://www.tradingview.com/pine-script-reference/v6/#kw_and">and</a> operation is <code dir="auto">false</code>, the script does <strong>not</strong> evaluate the second expression because it is not necessary to determine the result. These improvements help boost the runtime efficiency of scripts that rely on “bool” values and conditional expressions.</li> <li>The <code dir="auto">size</code> property of <a href="/pine-script-docs/concepts/text-and-shapes/#labels">labels</a> and the <code dir="auto">text_size</code> property of <a href="/pine-script-docs/concepts/lines-and-boxes/#boxes">boxes</a> and <a href="/pine-script-docs/concepts/tables/">tables</a> now support “int” values in addition to the <code dir="auto">size.*</code> constants. These “int” values represent sizes in <em>typographic points</em>, offering a more granular and wide range of text size possibilities.</li> <li>The new <code dir="auto">text_formatting</code> parameter of the <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_label.new">label.new()</a>, <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_box.new">box.new()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_table.cell">table.cell()</a> functions determines whether the object’s displayed text is <strong>bold</strong>, <em>italicized</em>, or <em><strong>both</strong></em>. It accepts one of these three new <code dir="auto">text.*</code> constants: <a href="https://www.tradingview.com/pine-script-reference/v6/#const_text.format_bold">text.format_bold</a>, <a href="https://www.tradingview.com/pine-script-reference/v6/#const_text.format_italic">text.format_italic</a>, <a href="https://www.tradingview.com/pine-script-reference/v6/#const_text.format_none">text.format_none</a>. To modify a drawing object’s <code dir="auto">text_formatting</code> property, use the corresponding <code dir="auto">*set_text_formatting()</code> functions.</li> <li><a href="/pine-script-docs/concepts/strategies/">Strategies</a> no longer stop calculating and raise an error when they reach the 9000 trade limit while not using Deep Backtesting mode. Instead, they <em>trim</em> the oldest orders to make space for new ones. The trimmed orders are <em>not</em> visible in the <a href="/pine-script-docs/concepts/strategies/#strategy-tester">Strategy Tester</a>, but that does not change the strategy’s simulation. To retrieve the trade index of the earliest <em>non-trimmed</em> order, use the <a href="https://www.tradingview.com/pine-script-reference/v6/#var_strategy.closedtrades.first_index">strategy.closedtrades.first_index</a> variable.</li> <li>The <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_array.get">array.get()</a>, <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_array.set">array.set()</a>, <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_array.insert">array.insert()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_array.remove">array.remove()</a> functions now support <em>negative</em> <code dir="auto">index</code> arguments to reference elements starting from the <em>end</em> of an <a href="/pine-script-docs/language/arrays/#arrays">array</a>. For instance, the call <code dir="auto">array.get(myArray, -2)</code> retrieves the second to last element in <code dir="auto">myArray</code>, which is equivalent to <code dir="auto">array.get(myArray, array.size(myArray) - 2)</code>.</li> <li>The new <a href="https://www.tradingview.com/pine-script-reference/v6/#var_syminfo.mincontract">syminfo.mincontract</a> variable holds a value representing the smallest number of contracts/shares/lots/units required to trade the current symbol, as set by the exchange.</li> <li>Two new variables, <a href="https://www.tradingview.com/pine-script-reference/v6/#var_syminfo.main_tickerid">syminfo.main_tickerid</a> and <a href="https://www.tradingview.com/pine-script-reference/v6/#var_timeframe.main_period">timeframe.main_period</a>, reference the ticker ID and timeframe from the script’s <em>main context</em>, even if the script uses them in the <code dir="auto">expression</code> argument of a <code dir="auto">request.*()</code> call. Here, “main context” refers to the current chart’s symbol and timeframe, unless the script is an <a href="https://www.tradingview.com/pine-script-reference/v6/#fun_indicator">indicator()</a> that includes <code dir="auto">symbol</code> or <code dir="auto">timeframe</code> arguments in its declaration statement.</li> </ul> <h3 id="october-2024" class="md-heading"><a href="#october-2024">October 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added an optional <code dir="auto">behind_chart</code> parameter to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a> functions. This parameter specifies where plots and drawings appear relative to the main chart display when the <code dir="auto">overlay</code> parameter is <code dir="auto">true</code>. If <code dir="auto">behind_chart</code> is <code dir="auto">true</code>, the script’s visuals appear behind the chart display. If <code dir="auto">false</code>, they appear in front of the chart display. The default is <code dir="auto">true</code>.</p> <h3 id="august-2024" class="md-heading"><a href="#august-2024">August 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ticker.new">ticker.new()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ticker.modify">ticker.modify()</a> functions feature two new parameters: <code dir="auto">settlement_as_close</code> and <code dir="auto">backadjustment</code>. Users can specify whether these parameters are on, off, or set to inherit the symbol’s default settings. These settings only affect the data from futures symbols with these options available on their charts. They have no effect on other symbols.</p> <ul> <li> <p>The <code dir="auto">backadjustment</code> parameter specifies whether past contract data on continuous futures symbols is back-adjusted. Its possible values are: <a href="https://www.tradingview.com/pine-script-reference/v5/#const_backadjustment.on">backadjustment.on</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#const_backadjustment.off">backadjustment.off</a>, or <a href="https://www.tradingview.com/pine-script-reference/v5/#const_backadjustment.inherit">backadjustment.inherit</a>.</p> </li> <li> <p>The <code dir="auto">settlement_as_close</code> parameter specifies whether a futures symbol’s <a href="https://www.tradingview.com/pine-script-reference/v5/#var_close">close</a> value represents the actual closing price or the settlement price on “1D” and higher timeframes. Its possible values are: <a href="https://www.tradingview.com/pine-script-reference/v5/#const_settlement_as_close.on">settlement_as_close.on</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#const_settlement_as_close.off">settlement_as_close.off</a>, or <a href="https://www.tradingview.com/pine-script-reference/v5/#const_settlement_as_close.inherit">settlement_as_close.inherit</a>.</p> </li> <li> <p>The Sharpe and Sortino ratios in the Strategy Tester module have updated calculations. Previously, the ratios used strategy returns over monthly periods if the trading range was three or more months and daily periods if the range was three or more days but less than three months. Both ratios now always use monthly periods for consistency.</p> </li> </ul> <h3 id="june-2024" class="md-heading"><a href="#june-2024">June 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added a new parameter to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box.new">box.new()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_label.new">label.new()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_line.new">line.new()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_polyline.new">polyline.new()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table.new">table.new()</a> functions:</p> <ul> <li><code dir="auto">force_overlay</code> - If true, the drawing will display on the main chart pane, even when the script occupies a separate pane. Optional. The default is false.</li> </ul> <h4 id="pine-script-enums" class="md-heading"><a href="#pine-script-enums">Pine Script™ Enums<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Enums, also known as <em>enumerations</em>, <em>enumerated types</em>, or <a href="/pine-script-docs/language/type-system/#enum-types">enum types</a>, are unique data types with all possible values declared by the programmer. They can help programmers maintain more strict control over the values allowed by variables, conditional expressions, and <a href="/pine-script-docs/language/type-system/#collections">collections</a>, and they enable convenient dropdown input creation with the new <a href="/pine-script-docs/concepts/inputs/#enum-input">input.enum()</a> function. See our User Manual’s <a href="/pine-script-docs/language/enums/">Enums</a> page to learn more about these new types and how to use them.</p> <h3 id="may-2024" class="md-heading"><a href="#may-2024">May 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added an optional <code dir="auto">calc_bars_count</code> parameter to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request.security">request.security()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request.security_lower_tf">request.security_lower_tf()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request.seed">request.seed()</a> functions that allows users to limit the number of recent historical bars a script or data request can execute across. When a script’s <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a> or <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a> declaration statement includes a <code dir="auto">calc_bars_count</code> argument, its “Settings/Inputs” tab will include a “Calculated bars” input in the “Calculation” section. The default value in all these functions is 0, which signifies that the script or request executes across all the available data.</p> <p>The <code dir="auto">strategy.*</code> namespace features several new built-in variables:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_trade">strategy.avg_trade</a> - Returns the average amount of money gained or lost per trade. Calculated as the sum of all profits and losses divided by the number of closed trades.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_trade_percent">strategy.avg_trade_percent</a> - Returns the average percentage gain or loss per trade. Calculated as the sum of all profit and loss percentages divided by the number of closed trades.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_winning_trade">strategy.avg_winning_trade</a> - Returns the average amount of money gained per winning trade. Calculated as the sum of profits divided by the number of winning trades.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_winning_trade_percent">strategy.avg_winning_trade_percent</a> - Returns the average percentage gain per winning trade. Calculated as the sum of profit percentages divided by the number of winning trades.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_losing_trade">strategy.avg_losing_trade</a> - Returns the average amount of money lost per losing trade. Calculated as the sum of losses divided by the number of losing trades.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.avg_losing_trade_percent">strategy.avg_losing_trade_percent</a> - Returns the average percentage loss per losing trade. Calculated as the sum of loss percentages divided by the number of losing trades.</li> </ul> <h4 id="pine-profiler" class="md-heading"><a href="#pine-profiler">Pine Profiler<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Our new <a href="/pine-script-docs/writing/profiling-and-optimization/#pine-profiler">Pine Profiler</a> is a powerful utility that analyzes the executions of all significant code in a script and displays helpful performance information next to the code lines <em>inside</em> the Pine Editor. The <a href="/pine-script-docs/writing/profiling-and-optimization/#pine-profiler">Profiler</a>’s information provides insight into a script’s runtime, the distribution of runtime across significant code regions, and the number of times each code region executes. With these insights, programmers can effectively pinpoint performance <em>bottlenecks</em> and ensure they focus on <a href="/pine-script-docs/writing/profiling-and-optimization/#optimization">optimizing</a> their code where it truly matters when they need to improve execution times.</p> <p>See the new <a href="/pine-script-docs/writing/profiling-and-optimization/">Profiling and optimization</a> page to learn more about the Profiler, how it works, and how to use it to analyze a script’s performance and identify optimization opportunities.</p> <h4 id="pine-editor-improvements" class="md-heading"><a href="#pine-editor-improvements">Pine Editor improvements<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>When opening the detached Pine Editor from a tab with a chart, it now links directly to that tab, as indicated by the “Linked” status and green icon in the bottom-right corner. While linked, the “Add to chart”, “Update on chart”, and “Apply to entire layout” buttons affect the charts on the main tab.</p> <p>The detached Pine Editor now includes the Pine console.</p> <h3 id="april-2024" class="md-heading"><a href="#april-2024">April 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added a new parameter to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plot">plot()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotchar">plotchar()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotcandle">plotcandle()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotbar">plotbar()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotarrow">plotarrow()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotshape">plotshape()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_bgcolor">bgcolor()</a> functions:</p> <ul> <li><code dir="auto">force_overlay</code> - If true, the output will display on the main chart pane, even when the script occupies a separate pane.</li> </ul> <h3 id="march-2024" class="md-heading"><a href="#march-2024">March 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The <code dir="auto">syminfo.*</code> namespace features a new built-in variable:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.expiration_date">syminfo.expiration_date</a> - On non-continuous futures symbols, returns a UNIX timestamp representing the start of the last day of the current contract.</li> </ul> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_time">time()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_time_close">time_close()</a> functions have a new parameter:</p> <ul> <li><code dir="auto">bars_back</code> - If specified, the function will calculate the timestamp from the bar N bars back relative to the current bar on its timeframe. It can also calculate the expected time of a future bar up to 500 bars away if the argument is a negative value. Optional. The default is 0.</li> </ul> <h3 id="february-2024" class="md-heading"><a href="#february-2024">February 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added two new functions for working with strings:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str.repeat">str.repeat()</a> - Constructs a new string containing the source string repeated a specified number of times with a separator injected between each repeated instance.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str.trim">str.trim()</a> - Constructs a new string with all consecutive whitespaces and other control characters removed from the left and right of the source string.</li> </ul> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request.financial">request.financial()</a> function now accepts “D” as a <code dir="auto">period</code> argument, allowing scripts to request available daily financial data.</p> <p>For example:</p> <div class="pine-colorizer not-content">//@version=5 indicator("Daily financial data demo") //@variable The daily Premium/Discount to Net Asset Value for "AMEX:SPY" float f1 = request.financial("AMEX:SPY", "NAV", "D") plot(f1)</div> <p>The <code dir="auto">strategy.*</code> namespace features a new variable for monitoring available capital in a strategy’s simulation:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.opentrades.capital_held">strategy.opentrades.capital_held</a> - Returns the capital amount currently held by open trades.</li> </ul> <h3 id="january-2024" class="md-heading"><a href="#january-2024">January 2024<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The <code dir="auto">syminfo.*</code> namespace features new built-in variables:</p> <p>Syminfo:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.employees">syminfo.employees</a> - The number of employees the company has.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.shareholders">syminfo.shareholders</a> - The number of shareholders the company has.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.shares_outstanding_float">syminfo.shares_outstanding_float</a> - The total number of shares outstanding a company has available, excluding any of its restricted shares.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.shares_outstanding_total">syminfo.shares_outstanding_total</a> - The total number of shares outstanding a company has available, including restricted shares held by insiders, major shareholders, and employees.</li> </ul> <p>Target price:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_average">syminfo.target_price_average</a> - The average of the last yearly price targets for the symbol predicted by analysts.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_date">syminfo.target_price_date</a> - The starting date of the last price target prediction for the current symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_estimates">syminfo.target_price_estimates</a> - The latest total number of price target predictions for the current symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_high">syminfo.target_price_high</a> - The last highest yearly price target for the symbol predicted by analysts.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_low">syminfo.target_price_low</a> - The last lowest yearly price target for the symbol predicted by analysts.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.target_price_median">syminfo.target_price_median</a> - The median of the last yearly price targets for the symbol predicted by analysts.</li> </ul> <p>Recommendations:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_buy">syminfo.recommendations_buy</a> - The number of analysts who gave the current symbol a “Buy” rating.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_buy_strong">syminfo.recommendations_buy_strong</a> - The number of analysts who gave the current symbol a “Strong Buy” rating.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_date">syminfo.recommendations_date</a> - The starting date of the last set of recommendations for the current symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_hold">syminfo.recommendations_hold</a> - The number of analysts who gave the current symbol a “Hold” rating.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_total">syminfo.recommendations_total</a> - The total number of recommendations for the current symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_sell">ssyminfo.recommendations_sell</a> - The number of analysts who gave the current symbol a “Sell” rating.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo.recommendations_sell_strong">syminfo.recommendations_sell_strong</a> - The number of analysts who gave the current symbol a “Strong Sell” rating.</li> </ul> <h2 id="2023" class="md-heading"><a href="#2023">2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2023" class="md-heading"><a href="#december-2023">December 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added <code dir="auto">format</code> and <code dir="auto">precision</code> parameters to all <code dir="auto">plot*()</code> functions, allowing indicators and strategies to selectively apply formatting and decimal precision settings to plotted results in the chart pane’s y-axis, the script’s status line, and the Data Window. The arguments passed to these parameters supersede the values in the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a> functions. Both are optional. The defaults for these parameters are the same as the values specified in the script’s declaration statement.</p> <p>For example:</p> <div class="pine-colorizer not-content">//@version=5 indicator("My script", format = format.percent, precision = 4) plot(close, format = format.price) // Price format with 4-digit precision. plot(100 * bar_index / close, precision = 2) // Percent format with 2-digit precision. </div> <h3 id="november-2023" class="md-heading"><a href="#november-2023">November 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>We’ve added the following variables and functions to the <code dir="auto">strategy.*</code> namespace:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.grossloss_percent">strategy.grossloss_percent</a> - The total gross loss value of all completed losing trades, expressed as a percentage of the initial capital.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.grossprofit_percent">strategy.grossprofit_percent</a> - The total gross profit value of all completed winning trades, expressed as a percentage of the initial capital.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.max_runup_percent">strategy.max_runup_percent</a> - The maximum rise from a trough in the equity curve, expressed as a percentage of the trough value.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.max_drawdown_percent">strategy.max_drawdown_percent</a> - The maximum drop from a peak in the equity curve, expressed as a percentage of the peak value.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.netprofit_percent">strategy.netprofit_percent</a> - The total value of all completed trades, expressed as a percentage of the initial capital.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy.openprofit_percent">strategy.openprofit_percent</a> - The current unrealized profit or loss for all open positions, expressed as a percentage of realized equity.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.closedtrades.max_drawdown_percent">strategy.closedtrades.max_drawdown_percent()</a> - Returns the maximum drawdown of the closed trade, i.e., the maximum possible loss during the trade, expressed as a percentage.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.closedtrades.max_runup_percent">strategy.closedtrades.max_runup_percent()</a> - Returns the maximum run-up of the closed trade, i.e., the maximum possible profit during the trade, expressed as a percentage.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.closedtrades.profit_percent">strategy.closedtrades.profit_percent()</a> - Returns the profit/loss value of the closed trade, expressed as a percentage. Losses are expressed as negative values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.opentrades.max_drawdown_percent">strategy.opentrades.max_drawdown_percent()</a> - Returns the maximum drawdown of the open trade, i.e., the maximum possible loss during the trade, expressed as a percentage.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.opentrades.max_runup_percent">strategy.opentrades.max_runup_percent()</a> - Returns the maximum run-up of the open trade, i.e., the maximum possible profit during the trade, expressed as a percentage.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.opentrades.profit_percent">strategy.opentrades.profit_percent()</a> - Returns the profit/loss of the open trade, expressed as a percentage. Losses are expressed as negative values.</li> </ul> <h3 id="october-2023" class="md-heading"><a href="#october-2023">October 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="pine-script-polylines" class="md-heading"><a href="#pine-script-polylines">Pine Script™ Polylines<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Polylines are drawings that sequentially connect the coordinates from an <a href="https://www.tradingview.com/pine-script-reference/v5/#type_array">array</a> of up to 10,000 <a href="/pine-script-docs/language/type-system/#chart-points">chart points</a> using straight or <em>curved</em> line segments, allowing scripts to draw custom formations that are difficult or impossible to achieve using <a href="https://www.tradingview.com/pine-script-reference/v5/#type_line">line</a> or <a href="https://www.tradingview.com/pine-script-reference/v5/#type_box">box</a> objects. To learn more about this new drawing type, see the <a href="/pine-script-docs/concepts/lines-and-boxes/#polylines">Polylines</a> section of our User Manual’s page on <a href="/pine-script-docs/concepts/lines-and-boxes/">Lines and boxes</a>.</p> <h3 id="september-2023" class="md-heading"><a href="#september-2023">September 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.default_entry_qty">strategy.default_entry_qty()</a> - Calculates the default quantity, in units, of an entry order from <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.entry">strategy.entry()</a> or <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy.order">strategy.order()</a> if it were to fill at the specified <code dir="auto">fill_price</code> value.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_chart.point.new">chart.point.new()</a> - Creates a new <a href="https://www.tradingview.com/pine-script-reference/v5/#type_chart.point">chart.point</a> object with the specified <code dir="auto">time</code>, <code dir="auto">index</code>, and <code dir="auto">price</code>.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dseed">request.seed()</a> - Requests data from a user-maintained GitHub repository and returns it as a series. An in-depth tutorial on how to add new data can be found <a href="https://github.com/tradingview-pine-seeds/docs" rel="nofollow">here</a>.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ticker%7Bdot%7Dinherit">ticker.inherit()</a> - Constructs a ticker ID for the specified <code dir="auto">symbol</code> with additional parameters inherited from the ticker ID passed into the function call, allowing the script to request a symbol’s data using the same modifiers that the <code dir="auto">from_tickerid</code> has, including extended session, dividend adjustment, currency conversion, non-standard chart types, back-adjustment, settlement-as-close, etc.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_timeframe.from_seconds">timeframe.from_seconds()</a> - Converts a specified number of <code dir="auto">seconds</code> into a valid timeframe string based on our <a href="/pine-script-docs/concepts/timeframes/#timeframe-string-specifications">timeframe specification format</a>.</li> </ul> <p>The <code dir="auto">dividends.*</code> namespace now includes variables for retrieving future dividend information:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_dividends.future_amount">dividends.future_amount</a> - Returns the payment amount of the upcoming dividend in the currency of the current instrument, or <code dir="auto">na</code> if this data isn’t available.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_dividends.future_ex_date">dividends.future_ex_date</a> - Returns the Ex-dividend date (Ex-date) of the current instrument’s next dividend payment, or <code dir="auto">na</code> if this data isn’t available.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_dividends.future_pay_date">dividends.future_pay_date</a> - Returns the Payment date (Pay date) of the current instrument’s next dividend payment, or <code dir="auto">na</code> if this data isn’t available.</li> </ul> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request.security_lower_tf">request.security_lower_tf()</a> function has a new parameter:</p> <ul> <li><code dir="auto">ignore_invalid_timeframe</code> - Determines how the function behaves when the chart’s timeframe is smaller than the <code dir="auto">timeframe</code> value in the function call. If <code dir="auto">false</code>, the function will raise a runtime error and halt the script’s execution. If <code dir="auto">true</code>, the function will return <code dir="auto">na</code> without raising an error.</li> </ul> <p>Users can now explicitly declare variables with the <code dir="auto">const</code>, <code dir="auto">simple</code>, and <code dir="auto">series</code> type qualifiers, allowing more precise control over the types of variables in their scripts. For example:</p> <div class="pine-colorizer not-content">//@version=5 indicator("My script") //@variable A constant `string` used as the `title` in the `plot()` function. const string plotTitle = "My plot" //@variable An `int` variable whose value is consistent after the first chart bar. simple int a = 10 //@variable An `int` variable whose value can change on every bar. series int b = bar_index plot(b % a, title = plotTitle)</div> <h3 id="august-2023" class="md-heading"><a href="#august-2023">August 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Added the following alert <a href="https://www.tradingview.com/support/solutions/43000531021">placeholders</a>:</p> <ul> <li><code dir="auto">{{syminfo.currency}}</code> - Returns the currency code of the current symbol (“EUR”, “USD”, etc.).</li> <li><code dir="auto">{{syminfo.basecurrency}}</code> - Returns the base currency code of the current symbol if the symbol refers to a currency pair. Otherwise, it returns <code dir="auto">na</code>. For example, it returns “EUR” when the symbol is “EURUSD”.</li> </ul> <h4 id="pine-script-maps" class="md-heading"><a href="#pine-script-maps">Pine Script™ Maps<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Maps are collections that hold elements in the form of <em>key-value pairs</em>. They associate unique keys of a <em>fundamental type</em> with values of a <em>built-in</em> or <a href="/pine-script-docs/language/type-system/#user-defined-types">user-defined</a> type. Unlike <a href="/pine-script-docs/language/arrays/">arrays</a>, these collections are <em>unordered</em> and do not utilize an internal lookup index. Instead, scripts access the values of maps by referencing the <em>keys</em> from the key-value pairs put into them. For more information on these new collections, see our <a href="/pine-script-docs/language/maps/">User Manual’s page on Maps</a>.</p> <h3 id="july-2023" class="md-heading"><a href="#july-2023">July 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Fixed an issue that caused strategies to occasionally calculate the sizes of limit orders incorrectly due to improper tick rounding of the <code dir="auto">limit</code> price.</p> <p>Added a new built-in variable to the <code dir="auto">strategy.*</code> namespace:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy%7Bdot%7Dmargin_liquidation_price">strategy.margin_liquidation_price</a> - When a strategy uses margin, returns the price value after which a margin call will occur.</li> </ul> <h3 id="june-2023" class="md-heading"><a href="#june-2023">June 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New <code dir="auto">syminfo.*</code> built-in variables were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo%7Bdot%7Dsector">syminfo.sector</a> - Returns the sector of the symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo%7Bdot%7Dindustry">syminfo.industry</a> - Returns the industry of the symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo%7Bdot%7Dcountry">syminfo.country</a> - Returns the two-letter code of the country where the symbol is traded.</li> </ul> <p>A new display parameter for all <code dir="auto">input.*()</code> functions was added. It provides you with more control over the display of input values next to a script’s name. Four arguments can be used: <a href="https://www.tradingview.com/pine-script-reference/v5/#var_display%7Bdot%7Dstatus_line">display.status_line</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#var_display%7Bdot%7Ddata_window">display.data_window</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#var_display%7Bdot%7Dall">display.all</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#var_display%7Bdot%7Dnone">display.none</a>. Combinations of these arguments using plus or minus signs are allowed, and regardless of the argument used, input values will always continue to appear in the <code dir="auto">Inputs</code> tab of the script’s settings.</p> <h3 id="may-2023" class="md-heading"><a href="#may-2023">May 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New parameter added to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dentry">strategy.entry()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dorder">strategy.order()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclose">strategy.close()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclose_all">strategy.close_all()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> functions:</p> <ul> <li><code dir="auto">disable_alert</code> - Disables order fill alerts for any orders placed by the function.</li> </ul> <p>Our “Indicator on indicator” feature, which allows a script to pass another indicator’s plot as a source value via the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_input%7Bdot%7Dsource">input.source()</a> function, now supports multiple external inputs. Scripts can use a multitude of external inputs originating from up to 10 different indicators.</p> <p>We’ve added the following array functions:</p> <ul> <li> <p><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Devery">array.every()</a> - Returns <code dir="auto">true</code> if all elements of the <code dir="auto">id</code> array are <code dir="auto">true</code>, <code dir="auto">false</code> otherwise.</p> </li> <li> <p><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dsome">array.some()</a> - Returns <code dir="auto">true</code> if at least one element of the <code dir="auto">id</code> array is <code dir="auto">true</code>, <code dir="auto">false</code> otherwise. These functions also work with arrays of <a href="https://www.tradingview.com/pine-script-reference/v5/#type_int">int</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#type_float">float</a> types, in which case zero values are considered <code dir="auto">false</code>, and all others <code dir="auto">true</code>.</p> </li> </ul> <h3 id="april-2023" class="md-heading"><a href="#april-2023">April 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Fixed an issue with trailing stops in <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> being filled on high/low prices rather than on intrabar prices.</p> <p>Fixed behavior of <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dmode">array.mode()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmode">matrix.mode()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dmode">ta.mode()</a>. Now these functions will return the smallest value when the data has no most frequent value.</p> <h3 id="march-2023" class="md-heading"><a href="#march-2023">March 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>It is now possible to use seconds-based timeframe strings for the <code dir="auto">timeframe</code> parameter in <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity">request.security()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity_lower_tf">request.security_lower_tf()</a>.</p> <p>A new function was added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dcurrency_rate">request.currency_rate()</a> - provides a daily rate to convert a value expressed in the <code dir="auto">from</code> currency to another in the <code dir="auto">to</code> currency.</li> </ul> <h3 id="february-2023" class="md-heading"><a href="#february-2023">February 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="pine-script-methods" class="md-heading"><a href="#pine-script-methods">Pine Script™ Methods<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Pine Script™ methods are specialized functions associated with specific instances of built-in or user-defined types. They offer a more convenient syntax than standard functions, as users can access methods in the same way as object fields using the handy dot notation syntax. Pine Script™ includes built-in methods for <a href="https://www.tradingview.com/pine-script-reference/v5/#type_array">array</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#type_matrix">matrix</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#type_line">line</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#type_linefill">linefill</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#type_label">label</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#type_box">box</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#type_table">table</a> types and facilitates user-defined methods with the new <a href="https://www.tradingview.com/pine-script-reference/v5/#kw_method">method</a> keyword. For more details on this new feature, see our <a href="/pine-script-docs/language/methods/">User Manual’s page on methods</a>.</p> <h3 id="january-2023" class="md-heading"><a href="#january-2023">January 2023<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New array functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dfirst">array.first()</a> - Returns the array’s first element.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dlast">array.last()</a> - Returns the array’s last element.</li> </ul> <h2 id="2022" class="md-heading"><a href="#2022">2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2022" class="md-heading"><a href="#december-2022">December 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="pine-objects" class="md-heading"><a href="#pine-objects">Pine Objects<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Pine objects are instantiations of the new user-defined composite types (UDTs) declared using the <a href="https://www.tradingview.com/pine-script-reference/v5/#kw_type">type</a> keyword. Experienced programmers can think of UDTs as method-less classes. They allow users to create custom types that organize different values under one logical entity. A detailed rundown of the new functionality can be found in our <a href="/pine-script-docs/language/objects/">User Manual’s page on objects</a>.</p> <p>A new function was added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ticker%7Bdot%7Dstandard">ticker.standard()</a> - Creates a ticker to request data from a standard chart that is unaffected by modifiers like extended session, dividend adjustment, currency conversion, and the calculations of non-standard chart types: Heikin Ashi, Renko, etc.</li> </ul> <p>New <code dir="auto">strategy.*</code> functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dentry_comment">strategy.opentrades.entry_comment()</a> - The function returns the comment message of the open trade’s entry.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dentry_comment">strategy.closedtrades.entry_comment()</a> - The function returns the comment message of the closed trade’s entry.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dexit_comment">strategy.closedtrades.exit_comment()</a> - The function returns the comment message of the closed trade’s exit.</li> </ul> <h3 id="november-2022" class="md-heading"><a href="#november-2022">November 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Fixed behaviour of <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_math%7Bdot%7Dround_to_mintick">math.round_to_mintick()</a> function. For ‘na’ values it returns ‘na’.</p> <h3 id="october-2022" class="md-heading"><a href="#october-2022">October 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Pine Script™ now has a new, more powerful and better-integrated editor. Read <a href="https://www.tradingview.com/blog/en/new-vsc-style-pine-script-editor-34159/">our blog</a> to find out everything to know about all the new features and upgrades.</p> <p>New overload for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_fill">fill()</a> function was added. Now it can create vertical gradients. More info about it in the <a href="https://www.tradingview.com/blog/en/pine-script-vertical-gradients-33586/">blog post</a>.</p> <p>A new function was added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dformat_time">str.format_time()</a> - Converts a timestamp to a formatted string using the specified format and time zone.</li> </ul> <h3 id="september-2022" class="md-heading"><a href="#september-2022">September 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The <code dir="auto">text_font_family</code> parameter now allows the selection of a monospace font in <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_label%7Bdot%7Dnew">label.new()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">box.new()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table%7Bdot%7Dcell">table.cell()</a> function calls, which makes it easier to align text vertically. Its arguments can be:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_font%7Bdot%7Dfamily_default">font.family_default</a> - Specifies the default font.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_font%7Bdot%7Dfamily_monospace">font.family_monospace</a> - Specifies a monospace font.</li> </ul> <p>The accompanying setter functions are:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_label%7Bdot%7Dset_text_font_family">label.set_text_font_family()</a> - The function sets the font family of the text inside the label.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_font_family">box.set_text_font_family()</a> - The function sets the font family of the text inside the box.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table%7Bdot%7Dcell_set_text_font_family">table.cell_set_text_font_family()</a> - The function sets the font family of the text inside the cell.</li> </ul> <h3 id="august-2022" class="md-heading"><a href="#august-2022">August 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>A new label style <a href="https://www.tradingview.com/pine-script-reference/v5/#const_label%7Bdot%7Dstyle_text_outline">label.style_text_outline</a> was added.</p> <p>A new parameter for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dpivot_point_levels">ta.pivot_point_levels()</a> function was added:</p> <ul> <li><code dir="auto">developing</code> - If <code dir="auto">false</code>, the values are those calculated the last time the anchor condition was true. They remain constant until the anchor condition becomes true again. If <code dir="auto">true</code>, the pivots are developing, i.e., they constantly recalculate on the data developing between the point of the last anchor (or bar zero if the anchor condition was never true) and the current bar. Cannot be <code dir="auto">true</code> when <code dir="auto">type</code> is set to <code dir="auto">"Woodie"</code>.</li> </ul> <p>A new parameter for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">box.new()</a> function was added:</p> <ul> <li><code dir="auto">text_wrap</code> - It defines whether the text is presented in a single line, extending past the width of the box if necessary, or wrapped so every line is no wider than the box itself.</li> </ul> <p>This parameter supports two arguments:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_text%7Bdot%7Dwrap_none">text.wrap_none</a> - Disabled wrapping mode for <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">box.new</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_wrap">box.set_text_wrap</a> functions.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_text%7Bdot%7Dwrap_auto">text.wrap_auto</a> - Automatic wrapping mode for <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">box.new</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_wrap">box.set_text_wrap</a> functions.</li> </ul> <p>New built-in functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dmin">ta.min()</a> - Returns the all-time low value of <code dir="auto">source</code> from the beginning of the chart up to the current bar.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dmax">ta.max()</a> - Returns the all-time high value of <code dir="auto">source</code> from the beginning of the chart up to the current bar.</li> </ul> <p>A new annotation <code dir="auto">//@strategy_alert_message</code> was added. If the annotation is added to the strategy, the text written after it will be automatically set as the default alert message in the [Create Alert] window.</p> <div class="pine-colorizer not-content">//@version=5 // @strategy_alert_message My Default Alert Message strategy("My Strategy") plot(close)</div> <h3 id="july-2022" class="md-heading"><a href="#july-2022">July 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>It is now possible to fine-tune where a script’s plot values are displayed through the introduction of new arguments for the <code dir="auto">display</code> parameter of the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plot">plot()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotchar">plotchar()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotshape">plotshape()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotarrow">plotarrow()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotcandle">plotcandle()</a>, and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_plotbar">plotbar()</a> functions.</p> <p>Four new arguments were added, complementing the previously available <a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Dall">display.all</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Dnone">display.none</a>:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Ddata_window">display.data_window</a> displays the plot values in the Data Window, one of the items available from the chart’s right sidebar.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Dpane">display.pane</a> displays the plot in the pane where the script resides, as defined in with the <code dir="auto">overlay</code> parameter of the script’s <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a>, or <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_library">library()</a> declaration statement.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Dprice_scale">display.price_scale</a> controls the display of the plot’s label and price in the price scale, if the chart’s settings allow them.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_display%7Bdot%7Dstatus_line">display.status_line</a> displays the plot values in the script’s status line, next to the script’s name on the chart, if the chart’s settings allow them.</li> </ul> <p>The <code dir="auto">display</code> parameter supports the addition and subtraction of its arguments:</p> <ul> <li><code dir="auto">display.all - display.status_line</code> will display the plot’s information everywhere except in the script’s status line.</li> <li><code dir="auto">display.price_scale + display.status_line</code> will display the plot in the price scale and status line only.</li> </ul> <h3 id="june-2022" class="md-heading"><a href="#june-2022">June 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The behavior of the argument used with the <code dir="auto">qty_percent</code> parameter of <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> has changed. Previously, the percentages used on successive exit orders of the same position were calculated from the remaining position at any given time. Instead, the percentages now always apply to the initial position size. When executing the following strategy, for example:</p> <div class="pine-colorizer not-content">//@version=5 strategy("strategy.exit() example", overlay = true) strategy.entry("Long", strategy.long, qty = 100) strategy.exit("Exit Long1", "Long", trail_points = 50, trail_offset = 0, qty_percent = 20) strategy.exit("Exit Long2", "Long", trail_points = 100, trail_offset = 0, qty_percent = 20)</div> <p>20% of the initial position will be closed on each <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> call. Before, the first call would exit 20% of the initial position, and the second would exit 20% of the remaining 80% of the position, so only 16% of the initial position.</p> <p>Two new parameters for the built-in <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dvwap">ta.vwap()</a> function were added:</p> <ul> <li><code dir="auto">anchor</code> - Specifies the condition that triggers the reset of VWAP calculations. When <code dir="auto">true</code>, calculations reset; when <code dir="auto">false</code>, calculations proceed using the values accumulated since the previous reset.</li> <li><code dir="auto">stdev_mult</code> - If specified, the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dvwap">ta.vwap()</a> calculates the standard deviation bands based on the main VWAP series and returns a <code dir="auto">[vwap, upper_band, lower_band]</code> tuple.</li> </ul> <p>New overloaded versions of the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclose">strategy.close()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclose_all">strategy.close_all()</a> functions with the <code dir="auto">immediately</code> parameter. When <code dir="auto">immediately</code> is set to <code dir="auto">true</code>, the closing order will be executed on the tick where it has been placed, ignoring the strategy parameters that restrict the order execution to the open of the next bar.</p> <p>New built-in functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_timeframe%7Bdot%7Dchange">timeframe.change()</a> - Returns <code dir="auto">true</code> on the first bar of a new <code dir="auto">timeframe</code>, <code dir="auto">false</code> otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dpivot_point_levels">ta.pivot_point_levels()</a> - Returns a float array with numerical values representing 11 pivot point levels: <code dir="auto">[P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5]</code>. Levels absent from the specified <code dir="auto">type</code> return na values.</li> </ul> <p>New built-in variables were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_session%7Bdot%7Disfirstbar">session.isfirstbar</a> - returns <code dir="auto">true</code> if the current bar is the first bar of the day’s session, <code dir="auto">false</code> otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_session%7Bdot%7Dislastbar">session.islastbar</a> - returns <code dir="auto">true</code> if the current bar is the last bar of the day’s session, <code dir="auto">false</code> otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_session%7Bdot%7Disfirstbar_regular">session.isfirstbar_regular</a> - returns <code dir="auto">true</code> on the first regular session bar of the day, <code dir="auto">false</code> otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_session%7Bdot%7Dislastbar_regular">session.islastbar_regular</a> - returns <code dir="auto">true</code> on the last regular session bar of the day, <code dir="auto">false</code> otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dleft_visible_bar_time">chart.left_visible_bar_time</a> - returns the <code dir="auto">time</code> of the leftmost bar currently visible on the chart.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dright_visible_bar_time">chart.right_visible_bar_time</a> - returns the <code dir="auto">time</code> of the rightmost bar currently visible on the chart.</li> </ul> <h3 id="may-2022" class="md-heading"><a href="#may-2022">May 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p><a href="https://www.tradingview.com/pine-script-reference/v5/#type_matrix">Matrix</a> support has been added to the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity">request.security()</a> function.</p> <p>The historical states of <a href="https://www.tradingview.com/pine-script-reference/v5/#type_array">arrays</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#type_matrix">matrices</a> can now be referenced with the <a href="https://www.tradingview.com/pine-script-reference/v5/#op_%5B%5D">[]</a> operator. In the example below, we reference the historic state of a matrix 10 bars ago:</p> <div class="pine-colorizer not-content">//@version=5 indicator("matrix.new<float> example") m = matrix.new<float>(1, 1, close) float x = na if bar_index > 10 x := matrix.get(m[10], 0, 0) plot(x) plot(close)</div> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_ta%7Bdot%7Dchange">ta.change()</a> function now can take values of <a href="https://www.tradingview.com/pine-script-reference/v5/#type_int">int</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#type_bool">bool</a> types as its <code dir="auto">source</code> parameter and return the difference in the respective type.</p> <p>New built-in variables were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dbg_color">chart.bg_color</a> - Returns the color of the chart’s background from the <code dir="auto">"Chart settings/Appearance/Background"</code> field.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dfg_color">chart.fg_color</a> - Returns a color providing optimal contrast with <a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dbg_color">chart.bg_color</a>.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_standard">chart.is_standard</a> - Returns true if the chart type is bars, candles, hollow candles, line, area or baseline, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#const_currency%7Bdot%7DUSDT">currency.USDT</a> - A constant for the Tether currency code.</li> </ul> <p>New functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_syminfo%7Bdot%7Dprefix">syminfo.prefix()</a> - returns the exchange prefix of the <code dir="auto">symbol</code> passed to it, e.g. “NASDAQ” for “NASDAQ:AAPL”.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_syminfo%7Bdot%7Dticker">syminfo.ticker()</a> - returns the ticker of the <code dir="auto">symbol</code> passed to it without the exchange prefix, e.g. “AAPL” for “NASDAQ:AAPL”.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity_lower_tf">request.security_lower_tf()</a> - requests data from a lower timeframe than the chart’s.</li> </ul> <p>Added <code dir="auto">use_bar_magnifier</code> parameter for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a> function. When <code dir="auto">true</code>, the <a href="/pine-script-docs/concepts/strategies/#broker-emulator">Broker Emulator</a> uses lower timeframe data during history backtesting to achieve more realistic results.</p> <p>Fixed behaviour of <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> function when stop loss triggered at prices outside the bars price range.</p> <p>Added new <code dir="auto">comment</code> and <code dir="auto">alert</code> message parameters for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dexit">strategy.exit()</a> function:</p> <ul> <li><code dir="auto">comment_profit</code> - additional notes on the order if the exit was triggered by crossing <code dir="auto">profit</code> or <code dir="auto">limit</code> specifically.</li> <li><code dir="auto">comment_loss</code> - additional notes on the order if the exit was triggered by crossing <code dir="auto">stop</code> or <code dir="auto">loss</code> specifically.</li> <li><code dir="auto">comment_trailing</code> - additional notes on the order if the exit was triggered by crossing <code dir="auto">trail_offset</code> specifically.</li> <li><code dir="auto">alert_profit</code> - text that will replace the <code dir="auto">'{{strategy.order.alert_message}}'</code> placeholder if the exit was triggered by crossing <code dir="auto">profit</code> or <code dir="auto">limit</code> specifically.</li> <li><code dir="auto">alert_loss</code> - text that will replace the <code dir="auto">'{{strategy.order.alert_message}}'</code> placeholder if the exit was triggered by crossing <code dir="auto">stop</code> or <code dir="auto">loss</code> specifically.</li> <li><code dir="auto">alert_trailing</code> - text that will replace the <code dir="auto">'{{strategy.order.alert_message}}'</code> placeholder if the exit was triggered by crossing <code dir="auto">trail_offset</code> specifically.</li> </ul> <h3 id="april-2022" class="md-heading"><a href="#april-2022">April 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Added the <code dir="auto">display</code> parameter to the following functions: <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_barcolor">barcolor</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_bgcolor">bgcolor</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_fill">fill</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_hline">hline</a>.</p> <p>A new function was added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Deconomic">request.economic()</a> - Economic data includes information such as the state of a country’s economy or of a particular industry.</li> </ul> <p>New built-in variables were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy%7Bdot%7Dmax_runup">strategy.max_runup</a> - Returns the maximum equity run-up value for the whole trading interval.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_syminfo%7Bdot%7Dvolumetype">syminfo.volumetype</a> - Returns the volume type of the current symbol.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_heikinashi">chart.is_heikinashi</a> - Returns true if the chart type is Heikin Ashi, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_kagi">chart.is_kagi</a> - Returns true if the chart type is Kagi, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_linebreak">chart.is_linebreak</a> - Returns true if the chart type is Line break, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_pnf">chart.is_pnf</a> - Returns true if the chart type is Point & figure, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_range">chart.is_range</a> - Returns true if the chart type is Range, false otherwise.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_chart%7Bdot%7Dis_renko">chart.is_renko</a> - Returns true if the chart type is Renko, false otherwise.</li> </ul> <p>New matrix functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dnew%3Ctype%3E">matrix.new<type>()</a> - Creates a new matrix object. A matrix is a two-dimensional data structure containing rows and columns. All elements in the matrix must be of the type specified in the type template (“<type>”).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Drow">matrix.row()</a> - Creates a one-dimensional array from the elements of a matrix row.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dcol">matrix.col()</a> - Creates a one-dimensional array from the elements of a matrix column.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dget">matrix.get()</a> - Returns the element with the specified index of the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dset">matrix.set()</a> - Assigns <code dir="auto">value</code> to the element at the <code dir="auto">column</code> and <code dir="auto">row</code> index of the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Drows">matrix.rows()</a> - Returns the number of rows in the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dcolumns">matrix.columns()</a> - Returns the number of columns in the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Delements_count">matrix.elements_count()</a> - Returns the total number of matrix elements.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dadd_row">matrix.add_row()</a> - Adds a row to the matrix. The row can consist of <code dir="auto">na</code> values, or an array can be used to provide values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dadd_col">matrix.add_col()</a> - Adds a column to the matrix. The column can consist of <code dir="auto">na</code> values, or an array can be used to provide values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dremove_row">matrix.remove_row()</a> - Removes the row of the matrix and returns an array containing the removed row’s values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dremove_col">matrix.remove_col()</a> - Removes the column of the matrix and returns an array containing the removed column’s values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dswap_rows">matrix.swap_rows()</a> - Swaps the rows in the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dswap_columns">matrix.swap_columns()</a> - Swaps the columns in the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dfill">matrix.fill()</a> - Fills a rectangular area of the matrix defined by the indices <code dir="auto">from_column</code> to <code dir="auto">to_column</code>.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dcopy">matrix.copy()</a> - Creates a new matrix which is a copy of the original.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dsubmatrix">matrix.submatrix()</a> - Extracts a submatrix within the specified indices.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dreverse">matrix.reverse()</a> - Reverses the order of rows and columns in the matrix. The first row and first column become the last, and the last become the first.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dreshape">matrix.reshape()</a> - Rebuilds the matrix to <code dir="auto">rows</code> x <code dir="auto">cols</code> dimensions.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dconcat">matrix.concat()</a> - Append one matrix to another.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dsum">matrix.sum()</a> - Returns a new matrix resulting from the sum of two matrices, or of a matrix and a scalar (a numerical value).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Ddiff">matrix.diff()</a> - Returns a new matrix resulting from the subtraction between matrices, or of matrix and a scalar (a numerical value).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmult">matrix.mult()</a> - Returns a new matrix resulting from the product between the matrices, or between a matrix and a scalar (a numerical value), or between a matrix and a vector (an array of values).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dsort">matrix.sort()</a> - Rearranges the rows in the <code dir="auto">id</code> matrix following the sorted order of the values in the <code dir="auto">column</code>.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Davg">matrix.avg()</a> - Calculates the average of all elements in the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmax">matrix.max()</a> - Returns the largest value from the matrix elements.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmin">matrix.min()</a> - Returns the smallest value from the matrix elements.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmedian">matrix.median()</a> - Calculates the median (“the middle” value) of matrix elements.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dmode">matrix.mode()</a> - Calculates the mode of the matrix, which is the most frequently occurring value from the matrix elements. When there are multiple values occurring equally frequently, the function returns the smallest of those values.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dpow">matrix.pow()</a> - Calculates the product of the matrix by itself <code dir="auto">power</code> times.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Ddet">matrix.det()</a> - Returns the determinant of a square matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dtranspose">matrix.transpose()</a> - Creates a new, transposed version of the matrix by interchanging the row and column index of each element.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dpinv">matrix.pinv()</a> - Returns the pseudoinverse of a matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dinv">matrix.inv()</a> - Returns the inverse of a square matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Drank">matrix.rank()</a> - Calculates the rank of the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Deigenvalues">matrix.trace()</a> - Calculates the trace of a matrix (the sum of the main diagonal’s elements).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Deigenvectors">matrix.eigenvalues()</a> - Returns an array containing the eigenvalues of a square matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7D">matrix.eigenvectors()</a> - Returns a matrix of eigenvectors, in which each column is an eigenvector of the matrix.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dkronis_zero">matrix.kron()</a> - Returns the Kronecker product for the two matrices.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_zero">matrix.is_zero()</a> - Determines if all elements of the matrix are zero.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_identity">matrix.is_identity()</a> - Determines if a matrix is an identity matrix (elements with ones on the main diagonal and zeros elsewhere).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_binary">matrix.is_binary()</a> - Determines if the matrix is binary (when all elements of the matrix are 0 or 1).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_symmetric">matrix.is_symmetric()</a> - Determines if a square matrix is symmetric (elements are symmetric with respect to the main diagonal).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_antisymmetric">matrix.is_antisymmetric()</a> - Determines if a matrix is antisymmetric (its transpose equals its negative).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_diagonal">matrix.is_diagonal()</a> - Determines if the matrix is diagonal (all elements outside the main diagonal are zero).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_antidiagonal">matrix.is_antidiagonal()</a> - Determines if the matrix is anti-diagonal (all elements outside the secondary diagonal are zero).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_triangular">matrix.is_triangular()</a> - Determines if the matrix is triangular (if all elements above or below the main diagonal are zero).</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_stochastic">matrix.is_stochastic()</a> - Determines if the matrix is stochastic.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_matrix%7Bdot%7Dis_square">matrix.is_square()</a> - Determines if the matrix is square (it has the same number of rows and columns).</li> </ul> <p>Added a new parameter for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy">strategy()</a> function:</p> <ul> <li><code dir="auto">risk_free_rate</code> - The risk-free rate of return is the annual percentage change in the value of an investment with minimal or zero risk, used to calculate the Sharpe and Sortino ratios.</li> </ul> <h3 id="march-2022" class="md-heading"><a href="#march-2022">March 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New array functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dsort_indices">array.sort_indices()</a> - returns an array of indices which, when used to index the original array, will access its elements in their sorted order.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dpercentrank">array.percentrank()</a> - returns the percentile rank of a value in the array.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dpercentile_nearest_rank">array.percentile_nearest_rank()</a> - returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using the nearest-rank method.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dpercentile_linear_interpolation">array.percentile_linear_interpolation()</a> - returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using linear interpolation.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dabs">array.abs()</a> - returns an array containing the absolute value of each element in the original array.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dbinary_search">array.binary_search()</a> - returns the index of the value, or -1 if the value is not found.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dbinary_search_leftmost">array.binary_search_leftmost()</a> - returns the index of the value if it is found or the index of the next smallest element to the left of where the value would lie if it was in the array.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dbinary_search_rightmost">array.binary_search_rightmost()</a> - returns the index of the value if it is found or the index of the element to the right of where the value would lie if it was in the array.</li> </ul> <p>Added a new optional <code dir="auto">nth</code> parameter for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dmin">array.min()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dmax">array.max()</a> functions.</p> <p>Added <code dir="auto">index</code> in <a href="https://www.tradingview.com/pine-script-reference/v5/#op_for%7Bdot%7D%7Bdot%7D%7Bdot%7Din">for..in</a> operator. It tracks the current iteration’s index.</p> <h4 id="table-merging-and-cell-tooltips" class="md-heading"><a href="#table-merging-and-cell-tooltips">Table merging and cell tooltips<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <ul> <li>It is now possible to merge several cells in a table. A merged cell doesn’t have to be a header: you can merge cells in any direction, as long as the resulting cell doesn’t affect any already merged cells and doesn’t go outside of the table’s bounds. Cells can be merged with the new <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table%7Bdot%7Dmerge_cells">table.merge_cells()</a> function.</li> <li>Tables now support tooltips, floating labels that appear when you hover over a table’s cell. To add a tooltip, pass a string to the <code dir="auto">tooltip</code> argument of the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table%7Bdot%7Dcell">table.cell()</a> function or use the new <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_table%7Bdot%7Dcell_set_tooltip">table.cell_set_tooltip()</a> function.</li> </ul> <h3 id="february-2022" class="md-heading"><a href="#february-2022">February 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Added templates and the ability to create arrays via templates. Instead of using one of the <code dir="auto">array.new_*()</code> functions, a template function <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dnew%3Ctype%3E">array.new<type>()</a> can be used. In the example below, we use this functionality to create an array filled with <code dir="auto">float</code> values:</p> <div class="pine-colorizer not-content">//@version=5 indicator("array.new<float> example") length = 5 var a = array.new<float>(length, close) if array.size(a) == length array.remove(a, 0) array.push(a, close) plot(array.sum(a) / length, "SMA")</div> <p>New functions were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_timeframe%7Bdot%7Din_seconds">timeframe.in_seconds(timeframe)</a> - converts the timeframe passed to the <code dir="auto">timeframe</code> argument into seconds.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_input%7Bdot%7Dtext_area">input.text_area()</a> - adds multiline text input area to the Script settings.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dentry_id">strategy.closedtrades.entry_id()</a> - returns the id of the closed trade’s entry.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dexit_id">strategy.closedtrades.exit_id()</a> - returns the id of the closed trade’s exit.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dentry_id">strategy.opentrades.entry_id()</a> - returns the id of the open trade’s entry.</li> </ul> <h3 id="january-2022" class="md-heading"><a href="#january-2022">January 2022<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Added new functions to clone drawings:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_line%7Bdot%7Dcopy">line.copy()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_label%7Bdot%7Dcopy">label.copy()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dcopy">box.copy()</a></li> </ul> <h2 id="2021" class="md-heading"><a href="#2021">2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2021" class="md-heading"><a href="#december-2021">December 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="linefills" class="md-heading"><a href="#linefills">Linefills<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>The space between lines drawn in Pine Script™ can now be filled! We’ve added a new <code dir="auto">linefill</code> drawing type, along with a number of functions dedicated to manipulating it. Linefills are created by passing two lines and a color to the <code dir="auto">linefill.new()</code> function, and their behavior is based on the lines they’re tied to: they extend in the same direction as the lines, move when their lines move, and are deleted when one of the two lines is deleted.</p> <p>New linefill-related functions:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_array%7Bdot%7Dnew_linefill">array.new_linefill()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill">linefill()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill%7Bdot%7Ddelete">linefill.delete()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill%7Bdot%7Dget_line1">linefill.get_line1()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill%7Bdot%7Dget_line2">linefill.get_line2()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill%7Bdot%7Dnew">linefill.new()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_linefill%7Bdot%7Dset_color">linefill.set_color()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_linefill%7Bdot%7Dall">linefill.all()</a></li> </ul> <h4 id="new-functions-for-string-manipulation" class="md-heading"><a href="#new-functions-for-string-manipulation">New functions for string manipulation<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Added a number of new functions that provide more ways to process strings, and introduce regular expressions to Pine Script™:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dcontains">str.contains(source, str)</a> - Determines if the <code dir="auto">source</code> string contains the <code dir="auto">str</code> substring.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dpos">str.pos(source, str)</a> - Returns the position of the <code dir="auto">str</code> string in the <code dir="auto">source</code> string.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dsubstring">str.substring(source, begin_pos, end_pos)</a> - Extracts a substring from the <code dir="auto">source</code> string.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dreplace">str.replace(source, target, replacement, occurrence)</a> - Contrary to the existing <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dreplace_all">str.replace_all()</a> function, <code dir="auto">str.replace()</code> allows the selective replacement of a matched substring with a replacement string.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dlower">str.lower(source)</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dupper">str.upper(source)</a> - Convert all letters of the <code dir="auto">source</code> string to lower or upper case:</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dstartswith">str.startswith(source, str)</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dendswith">str.endswith(source, str)</a> - Determine if the <code dir="auto">source</code> string starts or ends with the <code dir="auto">str</code> substring.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_str%7Bdot%7Dmatch">str.match(source, regex)</a> - Extracts the substring matching the specified <a href="https://en.wikipedia.org/wiki/Regular_expression#Perl_and_PCRE" rel="nofollow">regular expression</a>.</li> </ul> <h4 id="textboxes" class="md-heading"><a href="#textboxes">Textboxes<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Box drawings now supports text. The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">box.new()</a> function has five new parameters for text manipulation: <code dir="auto">text</code>, <code dir="auto">text_size</code>, <code dir="auto">text_color</code>, <code dir="auto">text_valign</code>, and <code dir="auto">text_halign</code>. Additionally, five new functions to set the text properties of existing boxes were added:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text">box.set_text()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_color">box.set_text_color()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_size">box.set_text_size()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_valign">box.set_text_valign()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dset_text_halign">box.set_text_halign()</a></li> </ul> <h4 id="new-built-in-variables" class="md-heading"><a href="#new-built-in-variables">New built-in variables<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Added new built-in variables that return the <code dir="auto">bar_index</code> and <code dir="auto">time</code> values of the last bar in the dataset. Their values are known at the beginning of the script’s calculation:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_last_bar_index">last_bar_index</a> - Bar index of the last chart bar.</li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_last_bar_time">last_bar_time</a> - UNIX time of the last chart bar.</li> </ul> <p>New built-in <code dir="auto">source</code> variable:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_hlcc4">hlcc4</a> - A shortcut for <code dir="auto">(high + low + close + close)/4</code>. It averages the high and low values with the double-weighted close.</li> </ul> <h3 id="november-2021" class="md-heading"><a href="#november-2021">November 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <h4 id="forin" class="md-heading"><a href="#forin">for…in<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Added a new <a href="https://www.tradingview.com/pine-script-reference/v5/#op_for%7Bdot%7D%7Bdot%7D%7Bdot%7Din">for…in</a> operator to iterate over all elements of an array:</p> <div class="pine-colorizer not-content">//@version=5 indicator("My Script") int[] a1 = array.from(1, 3, 6, 3, 8, 0, -9, 5) highest(array) => var int highestNum = na for item in array if na(highestNum) or item > highestNum highestNum := item highestNum plot(highest(a1))</div> <h4 id="function-overloads" class="md-heading"><a href="#function-overloads">Function overloads<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Added function overloads. Several functions in a script can now share the same name, as long one of the following conditions is true:</p> <ul> <li>Each overload has a different number of parameters:</li> </ul> <div class="pine-colorizer not-content">//@version=5 indicator("Function overload") // Two parameters mult(x1, x2) => x1 * x2 // Three parameters mult(x1, x2, x3) => x1 * x2 * x3 plot(mult(7, 4)) plot(mult(7, 4, 2))</div> <ul> <li>When overloads have the same number of parameters, all parameters in each overload must be explicitly typified, and their type combinations must be unique:</li> </ul> <div class="pine-colorizer not-content">//@version=5 indicator("Function overload") // Accepts both 'int' and 'float' values - any 'int' can be automatically cast to 'float' mult(float x1, float x2) => x1 * x2 // Returns a 'bool' value instead of a number mult(bool x1, bool x2) => x1 and x2 ? true : false mult(string x1, string x2) => str.tonumber(x1) * str.tonumber(x2) // Has three parameters, so explicit types are not required mult(x1, x2, x3) => x1 * x2 * x3 plot(mult(7, 4)) plot(mult(7.5, 4.2)) plot(mult(true, false) ? 1 : 0) plot(mult("5", "6")) plot(mult(7, 4, 2))</div> <h4 id="currency-conversion" class="md-heading"><a href="#currency-conversion">Currency conversion<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Added a new [currency] argument to most <code dir="auto">request.*()</code> functions. If specified, price values returned by the function will be converted from the source currency to the target currency. The following functions are affected:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Ddividends">request.dividends()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dearnings">request.earnings()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dfinancial">request.financial()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity">request.security()</a></li> </ul> <h3 id="october-2021" class="md-heading"><a href="#october-2021">October 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Pine Script™ v5 is here! This is a list of the <strong>new</strong> features added to the language, and a few of the <strong>changes</strong> made. See the Pine Script™ v5 <a href="/pine-script-docs/migration-guides/to-pine-version-5">Migration guide</a> for a complete list of the <strong>changes</strong> in v5.</p> <h4 id="new-features" class="md-heading"><a href="#new-features">New features<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Libraries are a new type of publication. They allow you to create custom functions for reuse in other scripts. See this manual’s page on <a href="/pine-script-docs/concepts/libraries/">Libraries</a>.</p> <p>Pine Script™ now supports <a href="https://www.tradingview.com/pine-script-reference/v5/#kw_switch">switch</a> structures! They provide a more convenient and readable alternative to long ternary operators and <a href="https://www.tradingview.com/pine-script-reference/v5/#kw_if">if</a> statements.</p> <p><a href="https://www.tradingview.com/pine-script-reference/v5/#kw_while">while</a> loops are here! They allow you to create a loop that will only stop when its controlling condition is false, or a <code dir="auto">break</code> command is used in the loop.</p> <p>New built-in array variables are maintained by the Pine Script™ runtime to hold the IDs of all the active objects of the same type drawn by your script. They are <a href="https://www.tradingview.com/pine-script-reference/v5/#var_label%7Bdot%7Dall">label.all</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#var_line%7Bdot%7Dall">line.all</a>, <a href="https://www.tradingview.com/pine-script-reference/v5/#var_box%7Bdot%7Dall">box.all</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#var_table%7Bdot%7Dall">table.all</a>.</p> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_runtime%7Bdot%7Derror">runtime.error()</a> function makes it possible to halt the execution of a script and display a runtime error with a custom message. You can use any condition in your script to trigger the call.</p> <p>Parameter definitions in user-defined functions can now include a default value: a function defined as <code dir="auto">f(x = 1) => x</code> will return 1 when called as <code dir="auto">f()</code>, i.e., without providing an argument for its <code dir="auto">x</code> parameter.</p> <p>New variables and functions provide better script visibility on strategy information:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dentry_price">strategy.closedtrades.entry_price()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dentry_price">strategy.opentrades.entry_price()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dentry_bar_index">strategy.closedtrades.entry_bar_index()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dentry_bar_index">strategy.opentrades.entry_bar_index()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dentry_time">strategy.closedtrades.entry_time()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dentry_time">strategy.opentrades.entry_time()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dsize">strategy.closedtrades.size()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dsize">strategy.opentrades.size()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dprofit">strategy.closedtrades.profit()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dprofit">strategy.opentrades.profit()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dcommission">strategy.closedtrades.commission()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dcommission">strategy.opentrades.commission()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dmax_runup">strategy.closedtrades.max_runup()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dmax_runup">strategy.opentrades.max_runup()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dmax_drawdown">strategy.closedtrades.max_drawdown()</a> and <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dopentrades%7Bdot%7Dmax_drawdown">strategy.opentrades.max_drawdown()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dexit_price">strategy.closedtrades.exit_price()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dexit_bar_index">strategy.closedtrades.exit_bar_index()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dclosedtrades%7Bdot%7Dexit_time">strategy.closedtrades.exit_time()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dconvert_to_account">strategy.convert_to_account()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#fun_strategy%7Bdot%7Dconvert_to_symbol">strategy.convert_to_symbol()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v5/#var_strategy%7Bdot%7Daccount_currency">strategy.account_currency</a></li> </ul> <p>A new <a href="https://www.tradingview.com/pine-script-reference/v5/#const_earnings%7Bdot%7Dstandardized">earnings.standardized</a> constant for the <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dearnings">request.earnings()</a> function allows requesting standardized earnings data.</p> <p>A v4 to v5 converter is now included in the Pine Script™ Editor. See the Pine Script™ v5 <a href="/pine-script-docs/migration-guides/to-pine-version-5">Migration guide</a> for more information on converting your scripts to v5.</p> <p>The <a href="https://www.tradingview.com/pine-script-reference/v5/">Reference Manual</a> now includes the systematic mention of the form and type (e.g., “simple int”) required for each function parameter.</p> <p>The User Manual was reorganized and new content was added.</p> <h4 id="changes" class="md-heading"><a href="#changes">Changes<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h4> <p>Many built-in variables, functions and function arguments were renamed or moved to new namespaces in v5. The venerable <code dir="auto">study()</code>, for example, is now <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_indicator">indicator()</a>, and <code dir="auto">security()</code> is now <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_request%7Bdot%7Dsecurity">request.security()</a>. New namespaces now group related functions and variables together. This consolidation implements a more rational nomenclature and provides an orderly space to accommodate the many additions planned for Pine Script™.</p> <p>See the Pine Script™ v5 <a href="/pine-script-docs/migration-guides/to-pine-version-5">Migration guide</a> for a complete list of the <strong>changes</strong> made in v5.</p> <h3 id="september-2021" class="md-heading"><a href="#september-2021">September 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New parameter has been added for the <code dir="auto">dividends()</code>, <code dir="auto">earnings()</code>, <code dir="auto">financial()</code>, <code dir="auto">quandl()</code>, <code dir="auto">security()</code>, and <code dir="auto">splits()</code> functions:</p> <ul> <li><code dir="auto">ignore_invalid_symbol</code> - determines the behavior of the function if the specified symbol is not found: if <code dir="auto">false</code>, the script will halt and return a runtime error; if <code dir="auto">true</code>, the function will return <code dir="auto">na</code> and execution will continue.</li> </ul> <h3 id="july-2021" class="md-heading"><a href="#july-2021">July 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p><code dir="auto">tostring</code> now accepts “bool” and “string” types.</p> <p>New argument for <code dir="auto">time</code> and <code dir="auto">time_close</code> functions was added:</p> <ul> <li><code dir="auto">timezone</code> - timezone of the <code dir="auto">session</code> argument, can only be used when a session is specified. Can be written out in GMT notation (e.g. “GMT-5”) or as an <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">IANA time zone database name</a> (e.g. “America/New_York”).</li> </ul> <p>It is now possible to place a drawing object in the future with <code dir="auto">xloc = xloc.bar_index</code>.</p> <p>New argument for <code dir="auto">study</code> and <code dir="auto">strategy</code> functions was added:</p> <ul> <li><code dir="auto">explicit_plot_zorder</code> - specifies the order in which the indicator’s plots, fills, and hlines are rendered. If true, the plots will be drawn based on the order in which they appear in the indicator’s code, each newer plot being drawn above the previous ones.</li> </ul> <h3 id="june-2021" class="md-heading"><a href="#june-2021">June 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New variable was added:</p> <ul> <li><code dir="auto">barstate.islastconfirmedhistory</code> - returns <code dir="auto">true</code> if script is executing on the dataset’s last bar when market is closed, or script is executing on the bar immediately preceding the real-time bar, if market is open. Returns <code dir="auto">false</code> otherwise.</li> </ul> <p>New function was added:</p> <ul> <li><code dir="auto">round_to_mintick(x)</code> - returns the value rounded to the symbol’s mintick, i.e. the nearest value that can be divided by <code dir="auto">syminfo.mintick</code>, without the remainder, with ties rounding up.</li> </ul> <p>Expanded <code dir="auto">tostring()</code> functionality. The function now accepts three new formatting arguments:</p> <ul> <li><code dir="auto">format.mintick</code> to format to tick precision.</li> <li><code dir="auto">format.volume</code> to abbreviate large values.</li> <li><code dir="auto">format.percent</code> to format percentages.</li> </ul> <h3 id="may-2021" class="md-heading"><a href="#may-2021">May 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Improved backtesting functionality by adding the Leverage mechanism.</p> <p>Added support for table drawings and functions for working with them. Tables are unique objects that are not anchored to specific bars; they float in a script’s space, independently of the chart bars being viewed or the zoom factor used. For more information, see the <a href="/pine-script-docs/concepts/tables/">Tables</a> User Manual page.</p> <p>New functions were added:</p> <ul> <li><code dir="auto">color.rgb(red, green, blue, transp)</code> - creates a new color with transparency using the RGB color model.</li> <li><code dir="auto">color.from_gradient(value, bottom_value, top_value, bottom_color, top_color)</code> - returns color calculated from the linear gradient between bottom_color to top_color.</li> <li><code dir="auto">color.r(color)</code>, <code dir="auto">color.g(color)</code>, <code dir="auto">color.b(color)</code>, <code dir="auto">color.t(color)</code> - retrieves the value of one of the color components.</li> <li><code dir="auto">array.from()</code> - takes a variable number of arguments with one of the types: <code dir="auto">int</code>, <code dir="auto">float</code>, <code dir="auto">bool</code>, <code dir="auto">string</code>, <code dir="auto">label</code>, <code dir="auto">line</code>, <code dir="auto">color</code>, <code dir="auto">box</code>, <code dir="auto">table</code> and returns an array of the corresponding type.</li> </ul> <p>A new <code dir="auto">box</code> drawing has been added to Pine Script™, making it possible to draw rectangles on charts using the Pine Script™ syntax. For more details see the Pine Script™ <a href="https://www.tradingview.com/pine-script-reference/v5/#fun_box%7Bdot%7Dnew">reference</a> and the <a href="/pine-script-docs/concepts/lines-and-boxes/">Lines and boxes</a> User Manual page.</p> <p>The <code dir="auto">color.new</code> function can now accept series and input arguments, in which case, the colors will be calculated at runtime. For more information about this, see our <a href="/pine-script-docs/concepts/colors/">Colors</a> User Manual page.</p> <h3 id="april-2021" class="md-heading"><a href="#april-2021">April 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New math constants were added:</p> <ul> <li><code dir="auto">math.pi</code> - is a named constant for Archimedes’ constant. It is equal to 3.1415926535897932.</li> <li><code dir="auto">math.phi</code> - is a named constant for the golden ratio. It is equal to 1.6180339887498948.</li> <li><code dir="auto">math.rphi</code> - is a named constant for the golden ratio conjugate. It is equal to 0.6180339887498948.</li> <li><code dir="auto">math.e</code> - is a named constant for Euler’s number. It is equal to 2.7182818284590452.</li> </ul> <p>New math functions were added:</p> <ul> <li><code dir="auto">round(x, precision)</code> - returns the value of <code dir="auto">x</code> rounded to the nearest integer, with ties rounding up. If the precision parameter is used, returns a float value rounded to that number of decimal places.</li> <li><code dir="auto">median(source, length)</code> - returns the median of the series.</li> <li><code dir="auto">mode(source, length)</code> - returns the mode of the series. If there are several values with the same frequency, it returns the smallest value.</li> <li><code dir="auto">range(source, length)</code> - returns the difference between the <code dir="auto">min</code> and <code dir="auto">max</code> values in a series.</li> <li><code dir="auto">todegrees(radians)</code> - returns an approximately equivalent angle in degrees from an angle measured in radians.</li> <li><code dir="auto">toradians(degrees)</code> - returns an approximately equivalent angle in radians from an angle measured in degrees.</li> <li><code dir="auto">random(min, max, seed)</code> - returns a pseudo-random value. The function will generate a different sequence of values for each script execution. Using the same value for the optional seed argument will produce a repeatable sequence.</li> </ul> <p>New functions were added:</p> <ul> <li><code dir="auto">session.ismarket</code> - returns <code dir="auto">true</code> if the current bar is a part of the regular trading hours (i.e. market hours), <code dir="auto">false</code> otherwise.</li> <li><code dir="auto">session.ispremarket</code> - returns <code dir="auto">true</code> if the current bar is a part of the pre-market, <code dir="auto">false</code> otherwise.</li> <li><code dir="auto">session.ispostmarket</code> - returns <code dir="auto">true</code> if the current bar is a part of the post-market, <code dir="auto">false</code> otherwise.</li> <li><code dir="auto">str.format</code> - converts the values to strings based on the specified formats. Accepts certain <code dir="auto">number</code> modifiers: <code dir="auto">integer</code>, <code dir="auto">currency</code>, <code dir="auto">percent</code>.</li> </ul> <h3 id="march-2021" class="md-heading"><a href="#march-2021">March 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New assignment operators were added:</p> <ul> <li><code dir="auto">+=</code> - addition assignment</li> <li><code dir="auto">-=</code> - subtraction assignment</li> <li><code dir="auto">*=</code> - multiplication assignment</li> <li><code dir="auto">/=</code> - division assignment</li> <li><code dir="auto">%=</code> - modulus assignment</li> </ul> <p>New parameters for inputs customization were added:</p> <ul> <li><code dir="auto">inline</code> - combines all the input calls with the same inline value in one line.</li> <li><code dir="auto">group</code> - creates a header above all inputs that use the same group string value. The string is also used as the header text.</li> <li><code dir="auto">tooltip</code> - adds a tooltip icon to the <code dir="auto">Inputs</code> menu. The tooltip string is shown when hovering over the tooltip icon.</li> </ul> <p>New argument for <code dir="auto">fill</code> function was added:</p> <ul> <li><code dir="auto">fillgaps</code> - controls whether fills continue on gaps when one of the <code dir="auto">plot</code> calls returns an <code dir="auto">na</code> value.</li> </ul> <p>A new keyword was added:</p> <ul> <li><code dir="auto">varip</code> - is similar to the <code dir="auto">var</code> keyword, but variables declared with <code dir="auto">varip</code> retain their values between the updates of a real-time bar.</li> </ul> <p>New functions were added:</p> <ul> <li><code dir="auto">tonumber()</code> - converts a string value into a float.</li> <li><code dir="auto">time_close()</code> - returns the UNIX timestamp of the close of the current bar, based on the resolution and session that is passed to the function.</li> <li><code dir="auto">dividends()</code> - requests dividends data for the specified symbol.</li> <li><code dir="auto">earnings()</code> - requests earnings data for the specified symbol.</li> <li><code dir="auto">splits()</code> - requests splits data for the specified symbol.</li> </ul> <p>New arguments for the study() function were added:</p> <ul> <li><code dir="auto">resolution_gaps</code> - fills the gaps between values fetched from higher timeframes when using <code dir="auto">resolution</code>.</li> <li><code dir="auto">format.percent</code> - formats the script output values as a percentage.</li> </ul> <h3 id="february-2021" class="md-heading"><a href="#february-2021">February 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New variable was added:</p> <ul> <li><code dir="auto">time_tradingday</code> - the beginning time of the trading day the current bar belongs to.</li> </ul> <h3 id="january-2021" class="md-heading"><a href="#january-2021">January 2021<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The following functions now accept a series length parameter:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_bb">bb()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_bbw">bbw()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_cci">cci()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_cmo">cmo()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_cog">cog()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_correlation">correlation()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_dev">dev()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_falling">falling()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_mfi">mfi()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_percentile_linear_interpolation">percentile_linear_interpolation()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_percentile_nearest_rank">percentile_nearest_rank()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_percentrank">percentrank()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_rising">rising()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_roc">roc()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_stdev">stdev()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_stoch">stoch()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_variance">variance()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_wpr">wpr()</a></li> </ul> <p>A new type of alerts was added - script alerts. More information can be found in our <a href="https://www.tradingview.com/support/solutions/43000597494/">Help Center</a>.</p> <h2 id="2020" class="md-heading"><a href="#2020">2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2020" class="md-heading"><a href="#december-2020">December 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New array types were added:</p> <ul> <li><code dir="auto">array.new_line()</code></li> <li><code dir="auto">array.new_label()</code></li> <li><code dir="auto">array.new_string()</code></li> </ul> <p>New functions were added:</p> <ul> <li><code dir="auto">str.length()</code> - returns number of chars in source string.</li> <li><code dir="auto">array.join()</code> - concatenates all of the elements in the array into a string and separates these elements with the specified separator.</li> <li><code dir="auto">str.split()</code> - splits a string at a given substring separator.</li> </ul> <h3 id="november-2020" class="md-heading"><a href="#november-2020">November 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>New <code dir="auto">max_labels_count</code> and <code dir="auto">max_lines_count</code> parameters were added to the study and strategy functions. Now you can manage the number of lines and labels by setting values for these parameters from 1 to 500.</li> </ul> <p>New function was added:</p> <ul> <li><code dir="auto">array.range()</code> - return the difference between the min and max values in the array.</li> </ul> <h3 id="october-2020" class="md-heading"><a href="#october-2020">October 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>The behavior of <code dir="auto">rising()</code> and <code dir="auto">falling()</code> functions have changed. For example, <code dir="auto">rising(close,3)</code> is now calculated as following:</p> <div class="pine-colorizer not-content">close[0] > close[1] and close[1] > close[2] and close[2] > close[3]</div> <h3 id="september-2020" class="md-heading"><a href="#september-2020">September 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>Added support for <code dir="auto">input.color</code> to the <code dir="auto">input()</code> function. Now you can provide script users with color selection through the script’s “Settings/Inputs” tab with the same color widget used throughout the TradingView user interface. Learn more about this feature in our <a href="https://www.tradingview.com/blog/en/create-color-inputs-in-pine-20751/">blog</a></p> <div class="pine-colorizer not-content">//@version=4 study("My Script", overlay = true) color c_labelColor = input(color.green, "Main Color", input.color) var l = label.new(bar_index, close, yloc = yloc.abovebar, text = "Colored label") label.set_x(l, bar_index) label.set_color(l, c_labelColor)</div> <p><img src="/pine-script-docs/_astro/input_color.BV9qKm_h_2a3e7N.webp" alt="image" width="600" height="423" loading="lazy" decoding="async"></p> <p>Added support for arrays and functions for working with them. You can now use the powerful new array feature to build custom datasets. See our <a href="/pine-script-docs/language/arrays/">User Manual page on arrays</a> and our <a href="https://www.tradingview.com/blog/en/arrays-are-now-available-in-pine-script-20052/">blog</a></p> <div class="pine-colorizer not-content">//@version=4 study("My Script") a = array.new_float(0) for i = 0 to 5 array.push(a, close[i] - open[i]) plot(array.get(a, 4))</div> <p>The following functions now accept a series length parameter. Learn more about this feature in our <a href="https://www.tradingview.com/blog/en/pine-functions-support-dynamic-length-arguments-20554/">blog</a>:</p> <ul> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_alma">alma()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_change">change()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_highest">highest()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_highestbars">highestbars()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_linreg">linreg()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_lowest">lowest()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_lowestbars">lowestbars()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_mom">mom()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_sma">sma()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_sum">sum()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_vwma">vwma()</a></li> <li><a href="https://www.tradingview.com/pine-script-reference/v4/#fun_wma">wma()</a></li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script", overlay = true) length = input(10, "Length", input.integer, minval = 1, maxval = 100) avgBar = avg(highestbars(length), lowestbars(length)) float dynLen = nz(abs(avgBar) + 1, length) dynSma = sma(close, int(dynLen)) plot(dynSma)</div> <h3 id="august-2020" class="md-heading"><a href="#august-2020">August 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Optimized script compilation time. Scripts now compile 1.5 to 2 times faster.</li> </ul> <h3 id="july-2020" class="md-heading"><a href="#july-2020">July 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Minor bug fixes and improvements.</li> </ul> <h3 id="june-2020" class="md-heading"><a href="#june-2020">June 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>New <code dir="auto">resolution</code> parameter was added to the <code dir="auto">study</code> function. Now you can add MTF functionality to scripts and decide the timeframe you want the indicator to run on.</li> </ul> <p><img src="/pine-script-docs/_astro/Mtf.CuSZJR6J_1zhU1M.webp" alt="image" width="365" height="399" loading="lazy" decoding="async"></p> <p>Please note that you need to reapply the indicator in order for the [resolution] parameter to appear.</p> <ul> <li>The <code dir="auto">tooltip</code> argument was added to the <code dir="auto">label.new</code> function along with the <code dir="auto">label.set_tooltip</code> function:</li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script", overlay=true) var l=label.new(bar_index, close, yloc=yloc.abovebar, text="Label") label.set_x(l,bar_index) label.set_tooltip(l, "Label Tooltip")</div> <p><img src="/pine-script-docs/_astro/Tooltip.6OxddeKb_xxgi6.webp" alt="image" width="551" height="312" loading="lazy" decoding="async"></p> <ul> <li>Added an ability to create <a href="https://www.tradingview.com/support/solutions/43000481368">alerts on strategies</a>.</li> <li>A new function <a href="https://www.tradingview.com/pine-script-reference/v4/#fun_line%7Bdot%7Dget_price">line.get_price()</a> can be used to determine the price level at which the line is located on a certain bar.</li> <li>New <a href="https://www.tradingview.com/pine-script-reference/v4/#fun_label%7Bdot%7Dnew">label styles</a> allow you to position the label pointer in any direction.</li> </ul> <p><img src="/pine-script-docs/_astro/new_label_styles.CnpdeFiL_1DmAE3.webp" alt="image" width="584" height="316" loading="lazy" decoding="async"></p> <ul> <li>Find and Replace was added to Pine Editor. To use this, press CTRL+F (find) or CTRL+H (find and replace).</li> </ul> <p><img src="/pine-script-docs/_astro/FindReplace.COurJNjE_sFMux.webp" alt="image" width="444" height="185" loading="lazy" decoding="async"></p> <ul> <li><code dir="auto">timezone</code> argument was added for time functions. Now you can specify timezone for <code dir="auto">second</code>, <code dir="auto">minute</code>, <code dir="auto">hour</code>, <code dir="auto">year</code>, <code dir="auto">month</code>, <code dir="auto">dayofmonth</code>, <code dir="auto">dayofweek</code> functions:</li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script") plot(hour(1591012800000, "GMT+1"))</div> <ul> <li><code dir="auto">syminfo.basecurrency</code> variable was added. Returns the base currency code of the current symbol. For EURUSD symbol returns EUR.</li> </ul> <h3 id="may-2020" class="md-heading"><a href="#may-2020">May 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li><code dir="auto">else if</code> statement was added</li> <li>The behavior of <code dir="auto">security()</code> function has changed: the <code dir="auto">expression</code> parameter can be series or tuple.</li> </ul> <h3 id="april-2020" class="md-heading"><a href="#april-2020">April 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New function was added:</p> <ul> <li><code dir="auto">quandl()</code> - request quandl data for a symbol</li> </ul> <h3 id="march-2020" class="md-heading"><a href="#march-2020">March 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New function was added:</p> <ul> <li><code dir="auto">financial()</code> - request financial data for a symbol</li> </ul> <p>New functions for common indicators were added:</p> <ul> <li><code dir="auto">cmo()</code> - Chande Momentum Oscillator</li> <li><code dir="auto">mfi()</code> - Money Flow Index</li> <li><code dir="auto">bb()</code> - Bollinger Bands</li> <li><code dir="auto">bbw()</code> - Bollinger Bands Width</li> <li><code dir="auto">kc()</code> - Keltner Channels</li> <li><code dir="auto">kcw()</code> - Keltner Channels Width</li> <li><code dir="auto">dmi()</code> - DMI/ADX</li> <li><code dir="auto">wpr()</code> - Williams % R</li> <li><code dir="auto">hma()</code> - Hull Moving Average</li> <li><code dir="auto">supertrend()</code> - SuperTrend</li> </ul> <p>Added a detailed description of all the fields in the <a href="https://www.tradingview.com/support/folders/43000587044-i-d-like-to-know-more-about-values-in-the-strategy-tester-report/">Strategy Tester Report</a>.</p> <h3 id="february-2020" class="md-heading"><a href="#february-2020">February 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>New Pine Script™ indicator VWAP Anchored was added. Now you can specify the time period: Session, Month, Week, Year.</li> <li>Fixed a problem with calculating <code dir="auto">percentrank</code> function. Now it can return a zero value, which did not happen before due to an incorrect calculation.</li> <li>The default <code dir="auto">transparency</code> parameter for the <code dir="auto">plot()</code>, <code dir="auto">plotshape()</code>, and <code dir="auto">plotchar()</code> functions is now 0%.</li> <li>For the functions <code dir="auto">plot()</code>, <code dir="auto">plotshape()</code>, <code dir="auto">plotchar()</code>, <code dir="auto">plotbar()</code>, <code dir="auto">plotcandle()</code>, <code dir="auto">plotarrow()</code>, you can set the <code dir="auto">display</code> parameter, which controls the display of the plot. The following values can be assigned to it: <ul> <li><code dir="auto">display.none</code> - the plot is not displayed</li> <li><code dir="auto">display.all</code> - the plot is displayed (Default)</li> </ul> </li> <li>The <code dir="auto">textalign</code> argument was added to the <code dir="auto">label.new</code> function along with the <code dir="auto">label.set_textalign</code> function. Using those, you can control the alignment of the label’s text:</li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script", overlay = true) var l = label.new(bar_index, high, text="Right\n aligned\n text", textalign=text.align_right) label.set_xy(l, bar_index, high) .. image:: images/ReleaseNotes-Label_text_align.png</div> <h3 id="january-2020" class="md-heading"><a href="#january-2020">January 2020<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New built-in variables were added:</p> <ul> <li><code dir="auto">iii</code> - Intraday Intensity Index</li> <li><code dir="auto">wvad</code> - Williams Variable Accumulation/Distribution</li> <li><code dir="auto">wad</code> - Williams Accumulation/Distribution</li> <li><code dir="auto">obv</code> - On Balance Volume</li> <li><code dir="auto">pvt</code> - Price-Volume Trend</li> <li><code dir="auto">nvi</code> - Negative Volume Index</li> <li><code dir="auto">pvi</code> - Positive Volume Index</li> </ul> <p>New parameters were added for <code dir="auto">strategy.close()</code>:</p> <ul> <li><code dir="auto">qty</code> - the number of contracts/shares/lots/units to exit a trade with</li> <li><code dir="auto">qty_percent</code> - defines the percentage of entered contracts/shares/lots/units to exit a trade with</li> <li><code dir="auto">comment</code> - addtional notes on the order</li> </ul> <p>New parameter was added for <code dir="auto">strategy.close_all</code>:</p> <ul> <li><code dir="auto">comment</code> - additional notes on the order</li> </ul> <h2 id="2019" class="md-heading"><a href="#2019">2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2019" class="md-heading"><a href="#december-2019">December 2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li> <p>Warning messages were added.</p> <p>For example, if you don’t specify exit parameters for <code dir="auto">strategy.exit</code> - <code dir="auto">profit</code>, <code dir="auto">limit</code>, <code dir="auto">loss</code>, <code dir="auto">stop</code> or one of the following pairs: <code dir="auto">trail_offset</code> and <code dir="auto">trail_price</code> / <code dir="auto">trail_points</code> - you will see a warning message in the console in the Pine Script™ editor.</p> </li> <li> <p>Increased the maximum number of arguments in <code dir="auto">max</code>, <code dir="auto">min</code>, <code dir="auto">avg</code> functions. Now you can use up to ten arguments in these functions.</p> </li> </ul> <h3 id="october-2019" class="md-heading"><a href="#october-2019">October 2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li><code dir="auto">plotchar()</code> function now supports most of the Unicode symbols:</li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script", overlay=true) plotchar(open > close, char="🐻") .. image:: images/ReleaseNotes-Bears_in_plotchar.png</div> <ul> <li>New <code dir="auto">bordercolor</code> argument of the <code dir="auto">plotcandle()</code> function allows you to change the color of candles’ borders:</li> </ul> <div class="pine-colorizer not-content">//@version=4 study("My Script") plotcandle(open, high, low, close, title='Title', color = open < close ? color.green : color.red, wickcolor=color.black, bordercolor=color.orange)</div> <ul> <li>New variables added: <ul> <li><code dir="auto">syminfo.description</code> - returns a description of the current symbol</li> <li><code dir="auto">syminfo.currency</code> - returns the currency code of the current symbol (EUR, USD, etc.)</li> <li><code dir="auto">syminfo.type</code> - returns the type of the current symbol (stock, futures, index, etc.)</li> </ul> </li> </ul> <h3 id="september-2019" class="md-heading"><a href="#september-2019">September 2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New parameters to the <code dir="auto">strategy</code> function were added:</p> <ul> <li><code dir="auto">process_orders_on_close</code> allows the broker emulator to try to execute orders after calculating the strategy at the bar’s close</li> <li><code dir="auto">close_entries_rule</code> allows to define the sequence used for closing positions</li> </ul> <p>Some fixes were made:</p> <ul> <li><code dir="auto">fill()</code> function now works correctly with <code dir="auto">na</code> as the <code dir="auto">color</code> parameter value</li> <li><code dir="auto">sign()</code> function now calculates correctly for literals and constants</li> </ul> <p><code dir="auto">str.replace_all(source, target, replacement)</code> function was added. It replaces each occurrence of a <code dir="auto">target</code> string in the <code dir="auto">source</code> string with a <code dir="auto">replacement</code> string</p> <h3 id="july-august-2019" class="md-heading"><a href="#july-august-2019">July-August 2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <p>New variables added:</p> <ul> <li><code dir="auto">timeframe.isseconds</code> returns true when current resolution is in seconds</li> <li><code dir="auto">timeframe.isminutes</code> returns true when current resolution is in minutes</li> <li><code dir="auto">time_close</code> returns the current bar’s close time</li> </ul> <p>The behavior of some functions, variables and operators has changed:</p> <ul> <li> <p>The <code dir="auto">time</code> variable returns the correct open time of the bar for more special cases than before</p> </li> <li> <p>An optional <em>seconds</em> parameter of the <code dir="auto">timestamp()</code> function allows you to set the time to within seconds</p> </li> <li> <p><code dir="auto">security()</code> function:</p> <ul> <li> <p>Added the possibility of requesting resolutions in seconds:</p> <p>1, 5, 15, 30 seconds (chart resolution should be less than or equal to the requested resolution)</p> </li> <li> <p>Reduced the maximum value that can be requested in some of the other resolutions:</p> <p>from 1 to 1440 minutes</p> <p>from 1 to 365 days</p> <p>from 1 to 52 weeks</p> <p>from 1 to 12 months</p> </li> </ul> </li> <li> <p>Changes to the evaluation of ternary operator branches:</p> <p>In Pine Script™ v3, during the execution of a ternary operator, both its branches are calculated, so when this script is added to the chart, a long position is opened, even if the long() function is not called:</p> </li> </ul> <div class="pine-colorizer not-content">//@version=3 strategy(title = "My Strategy") long() => strategy.entry("long", true, 1, when = open > high[1]) 1 c = 0 c := true ? 1 : long() plot(c) Pine Script™ v4 contains built-in functions with side effects ( ``line.new`` and ``label.new`` ). If calls to these functions are present in both branches of a ternary operator, both function calls would be executed following v3 conventions. Thus, in Pine Script™ v4, only the branch corresponding to the evaluated condition is calculated. While this provides a viable solution in some cases, it will modify the behavior of scripts which depended on the fact that both branches of a ternary were evaluated. The solution is to pre-evaluate expressions prior to the ternary operator. The conversion utility takes this requirement into account when converting scripts from v3 to v4, so that script behavior will be identical in v3 and v4.</div> <h3 id="june-2019" class="md-heading"><a href="#june-2019">June 2019<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Support for drawing objects. Added <em>label</em> and <em>line</em> drawings</li> <li><code dir="auto">var</code> keyword for one time variable initialization</li> <li>Type system improvements: <ul> <li><em>series string</em> data type</li> <li>functions for explicit type casting</li> <li>syntax for explicit variable type declaration</li> <li>new <em>input</em> type forms</li> </ul> </li> <li>Renaming of built-ins and a version 3 to 4 converter utility</li> <li><code dir="auto">max_bars_back</code> function to control series variables internal history buffer sizes</li> <li>Pine Script™ documentation versioning</li> </ul> <h2 id="2018" class="md-heading"><a href="#2018">2018<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="october-2018" class="md-heading"><a href="#october-2018">October 2018<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>To increase the number of indicators available to the whole community, Invite-Only scripts can now be published by Premium users only.</li> </ul> <h3 id="april-2018" class="md-heading"><a href="#april-2018">April 2018<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Improved the Strategy Tester by reworking the Maximum Drawdown calculation formula.</li> </ul> <h2 id="2017" class="md-heading"><a href="#2017">2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="august-2017" class="md-heading"><a href="#august-2017">August 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>With the new argument <code dir="auto">show_last</code> in the plot-type functions, you can restrict the number of bars that the plot is displayed on.</li> </ul> <h3 id="june-2017" class="md-heading"><a href="#june-2017">June 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>A major script publishing improvement: it is now possible to update your script without publishing a new one via the Update button in the publishing dialog.</li> </ul> <h3 id="may-2017" class="md-heading"><a href="#may-2017">May 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Expanded the type system by adding a new type of constants that can be calculated during compilation.</li> </ul> <h3 id="april-2017" class="md-heading"><a href="#april-2017">April 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Expanded the keyword argument functionality: it is now possible to use keyword arguments in all built-in functions.</li> <li>A new <code dir="auto">barstate.isconfirmed</code> variable has been added to the list of variables that return bar status. It lets you create indicators that are calculated based on the closed bars only.</li> <li>The <code dir="auto">options</code> argument for the <code dir="auto">input()</code> function creates an input with a set of options defined by the script’s author.</li> </ul> <h3 id="march-2017" class="md-heading"><a href="#march-2017">March 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Pine Script™ v3 is here! Some important changes: <ul> <li>Changes to the default behavior of the <code dir="auto">security()</code> function: it can no longer access the future data by default. This can be changes with the <code dir="auto">lookahead</code> parameter.</li> <li>An implicit conversion of boolean values to numeric values was replaced with an implicit conversion of numeric values (integer and float) to boolean values.</li> <li>Self-referenced and forward-referenced variables were removed. Any PineScript code that used those language constructions can be equivalently rewritten using mutable variables.</li> </ul> </li> </ul> <h3 id="february-2017" class="md-heading"><a href="#february-2017">February 2017<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Several improvements to the strategy tester and the strategy report: <ul> <li>New Buy & Hold equity graph — a new graph that lets you compare performance of your strategy versus a “buy and hold”, i.e if you just bought a security and held onto it without trading.</li> <li>Added percentage values to the absolute currency values.</li> <li>Added Buy & Hold Return to display the final value of Buy & Hold Equity based on last price.</li> <li>Added Sharpe Ratio — it shows the relative effectiveness of the investment portfolio (security), a measure that indicates the average return minus the risk-free return divided by the standard deviation of return on an investment.</li> <li>Slippage lets you simulate a situation when orders are filled at a worse price than expected. It can be set through the Properties dialog or through the slippage argument in the <code dir="auto">strategy()</code> function.</li> <li>Commission allows yot to add commission for placed orders in percent of order value, fixed price or per contract. The amount of commission paid is shown in the Commission Paid field. The commission size and its type can be set through the Properties dialog or through the commission_type and commission_value arguments in the <code dir="auto">strategy()</code> function.</li> </ul> </li> </ul> <h2 id="2016" class="md-heading"><a href="#2016">2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="december-2016" class="md-heading"><a href="#december-2016">December 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added invite-only scripts. The invite-only indicators are visible in the Community Scripts, but nobody can use them without explicit permission from the author, and only the author can see the source code.</li> </ul> <h3 id="october-2016" class="md-heading"><a href="#october-2016">October 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Introduded indicator revisions. Each time an indicator is saved, it gets a new revision, and it is possible to easily switch to any past revision from the Pine Editor.</li> </ul> <h3 id="september-2016" class="md-heading"><a href="#september-2016">September 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>It is now possible to publish indicators with protected source code. These indicators are available in the public Script Library, and any user can use them, but only the author can see the source code.</li> </ul> <h3 id="july-2016" class="md-heading"><a href="#july-2016">July 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Improved the behavior of the <code dir="auto">fill()</code> function: one call can now support several different colors.</li> </ul> <h3 id="march-2016" class="md-heading"><a href="#march-2016">March 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Color type variables now have an additional parameter to set default transparency. The transparency can be set with the <code dir="auto">color.new()</code> function, or by adding an alpha-channel value to a hex color code.</li> </ul> <h3 id="february-2016" class="md-heading"><a href="#february-2016">February 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added <code dir="auto">for</code> loops and keywords <code dir="auto">break</code> and <code dir="auto">continue</code>.</li> <li>Pine Script™ now supports mutable variables! Use the <code dir="auto">:=</code> operator to assign a new value to a variable that has already been defined.</li> <li>Multiple improvements and bug fixes for strategies.</li> </ul> <h3 id="january-2016" class="md-heading"><a href="#january-2016">January 2016<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>A new <code dir="auto">alertcondition()</code> function allows for creating custom alert conditions in Pine Script™-based indicators.</li> </ul> <h2 id="2015" class="md-heading"><a href="#2015">2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="october-2015" class="md-heading"><a href="#october-2015">October 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Pine has graduated to v2! The new version of Pine Script™ added support for <code dir="auto">if</code> statements, making it easier to write more readable and concise code.</li> </ul> <h3 id="september-2015" class="md-heading"><a href="#september-2015">September 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added backtesting functionality to Pine Script™. It is now possible to create trading strategies, i.e. scripts that can send, modify and cancel orders to buy or sell. Strategies allow you to perform backtesting (emulation of strategy trading on historical data) and forward testing (emulation of strategy trading on real-time data) according to your algorithms. Detailed information about the strategy’s calculations and the order fills can be seen in the newly added Strategy Tester tab.</li> </ul> <h3 id="july-2015" class="md-heading"><a href="#july-2015">July 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>A new <code dir="auto">editable</code> parameter allows hiding the plot from the Style menu in the indicator settings so that it is not possible to edit its style. The parameter has been added to all the following functions: all plot-type functions, <code dir="auto">barcolor()</code>, <code dir="auto">bgcolor()</code>, <code dir="auto">hline()</code>, and <code dir="auto">fill()</code>.</li> </ul> <h3 id="june-2015" class="md-heading"><a href="#june-2015">June 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added two new functions to display custom barsets using PineScipt: <code dir="auto">plotbar()</code> and <code dir="auto">plotcandle()</code>.</li> </ul> <h3 id="april-2015" class="md-heading"><a href="#april-2015">April 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added two new shapes to the <code dir="auto">plotshape()</code> function: shape.labelup and shape.labeldown.</li> <li>PineScipt Editor has been improved and moved to a new panel at the bottom of the page.</li> <li>Added a new <code dir="auto">step</code> argument for the <code dir="auto">input()</code> function, allowing to specify the step size for the indicator’s inputs.</li> </ul> <h3 id="march-2015" class="md-heading"><a href="#march-2015">March 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added support for inputs with the <code dir="auto">source</code> type to the <code dir="auto">input()</code> function, allowing to select the data source for the indicator’s calculations from its settings.</li> </ul> <h3 id="february-2015" class="md-heading"><a href="#february-2015">February 2015<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added a new <code dir="auto">text</code> argument to <code dir="auto">plotshape()</code> and <code dir="auto">plotchar()</code> functions.</li> <li>Added four new shapes to the <code dir="auto">plotshape()</code> function: shape.arrowup, shape.arrowdown, shape.square, shape.diamond.</li> </ul> <h2 id="2014" class="md-heading"><a href="#2014">2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <h3 id="august-2014" class="md-heading"><a href="#august-2014">August 2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Improved the script sharing capabilities, changed the layout of the Indicators menu and separated published scripts from ideas.</li> </ul> <h3 id="july-2014" class="md-heading"><a href="#july-2014">July 2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added three new plotting functions, <code dir="auto">plotshape()</code>, <code dir="auto">plotchar()</code>, and <code dir="auto">plotarrow()</code> for situations when you need to highlight specific bars on a chart without drawing a line.</li> <li>Integrated QUANDL data into Pine Script™. The data can be accessed by passing the QUANDL ticker to the <code dir="auto">security</code> function.</li> </ul> <h3 id="june-2014" class="md-heading"><a href="#june-2014">June 2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added Pine Script™ sharing, enabling programmers and traders to share their scripts with the rest of the TradingView community.</li> </ul> <h3 id="april-2014" class="md-heading"><a href="#april-2014">April 2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added line wrapping.</li> </ul> <h3 id="february-2014" class="md-heading"><a href="#february-2014">February 2014<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h3> <ul> <li>Added support for inputs, allowing users to edit the indicator inputs through the properties window, without needing to edit the Pine script.</li> <li>Added self-referencing variables.</li> <li>Added support for multiline functions.</li> <li>Implemented the type-casting mechanism, automatically casting constant and simple float and int values to series when it is required.</li> <li>Added several new functions and improved the existing ones: <ul> <li><code dir="auto">barssince()</code> and <code dir="auto">valuewhen()</code> allow you to check conditions on historical data easier.</li> <li>The new <code dir="auto">barcolor()</code> function lets you specify a color for a bar based on filling of a certain condition.</li> <li>Similar to the <code dir="auto">barcolor()</code> function, the <code dir="auto">bgcolor()</code> function changes the color of the background.</li> <li>Reworked the <code dir="auto">security()</code> function, further expanding its functionality.</li> <li>Improved the <code dir="auto">fill()</code> function, enabling it to be used more than once in one script.</li> <li>Added the <code dir="auto">round()</code> function to round and convert float values to integers.</li> </ul> </li> </ul> <h2 id="2013" class="md-heading"><a href="#2013">2013<span class="icon icon-link" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 28 28"><g fill="currentColor" clip-path="url(#a)"><path d="M14.908 5.558a5.326 5.326 0 1 1 7.533 7.533l-3.236 3.236-1.061-1.061 3.236-3.236a3.826 3.826 0 1 0-5.411-5.411l-3.236 3.236-1.06-1.06 3.235-3.237ZM5.56 14.907a5.326 5.326 0 0 0 7.532 7.533l3.236-3.236-1.061-1.061-3.236 3.236a3.826 3.826 0 1 1-5.411-5.411l3.236-3.236-1.061-1.06-3.236 3.235Z"></path><path d="m16.346 10.592-5.753 5.753 1.061 1.06 5.753-5.752-1.06-1.06Z"></path></g><defs><clippath id="a"><path fill="#fff" d="M0 0h28v28H0z"></path></clippath></defs></svg></span></a></h2> <ul> <li>The first version of Pine Script™ is introduced to all TradingView users, initially as an open beta, on December 13th.</li> </ul> </div> <div class="pagination-buttons not-content" data-astro-cid-xgirumru> <a href="/pine-script-docs/error-messages" class="pagination-card" data-pagefind-ignore data-astro-cid-assl6cvf> <p data-astro-cid-assl6cvf>Previous</p> <h4 class="pagination-card-header" data-astro-cid-assl6cvf> <svg width="28" height="28" viewBox="0 0 28 28" data-astro-cid-assl6cvf data-icon="theme/arrow-back"> <use xlink:href="#ai:local:theme/arrow-back"></use> </svg> Error messages </h4> </a> <a href="/pine-script-docs/migration-guides/to-pine-version-5" class="pagination-card" data-pagefind-ignore data-astro-cid-assl6cvf> <p data-astro-cid-assl6cvf>Next</p> <h4 class="pagination-card-header" data-astro-cid-assl6cvf> To Pine Script™ version 5 <svg width="28" height="28" viewBox="0 0 28 28" data-astro-cid-assl6cvf data-icon="theme/arrow"> <symbol id="ai:local:theme/arrow"><path fill="none" stroke="var(--arrow-fill-color, #131722)" d="m11 8 6 6-6 6"/></symbol><use xlink:href="#ai:local:theme/arrow"></use> </svg> </h4> </a> </div> </main> <div id="toc" data-pagefind-ignore="all" data-astro-cid-oor6cujd><aside class="document-toc-container ml-4 w-48" data-astro-cid-oor6cujd><section id="toc-scroll-section" class="slick-scroll" data-astro-cid-oor6cujd><header data-astro-cid-oor6cujd><h2 class="toc-header" data-astro-cid-oor6cujd>On this page</h2></header><ul class="" id="toc-entries" data-astro-cid-oor6cujd><a href="#release-notes" aria-current="true" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-current data-astro-cid-oor6cujd>Overview</li></a><a href="#2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2024</li></a><a href="#november-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>November 2024</li></a><a href="#introducing-pine-script-v6" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Introducing Pine Script™ v6</li></a><a href="#october-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2024</li></a><a href="#august-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2024</li></a><a href="#june-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2024</li></a><a href="#pine-script-enums" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Script™ Enums</li></a><a href="#may-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2024</li></a><a href="#pine-profiler" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Profiler</li></a><a href="#pine-editor-improvements" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Editor improvements</li></a><a href="#april-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2024</li></a><a href="#march-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2024</li></a><a href="#february-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2024</li></a><a href="#january-2024" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2024</li></a><a href="#2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2023</li></a><a href="#december-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2023</li></a><a href="#november-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>November 2023</li></a><a href="#october-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2023</li></a><a href="#pine-script-polylines" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Script™ Polylines</li></a><a href="#september-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2023</li></a><a href="#august-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2023</li></a><a href="#pine-script-maps" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Script™ Maps</li></a><a href="#july-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2023</li></a><a href="#june-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2023</li></a><a href="#may-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2023</li></a><a href="#april-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2023</li></a><a href="#march-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2023</li></a><a href="#february-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2023</li></a><a href="#pine-script-methods" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Script™ Methods</li></a><a href="#january-2023" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2023</li></a><a href="#2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2022</li></a><a href="#december-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2022</li></a><a href="#pine-objects" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Pine Objects</li></a><a href="#november-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>November 2022</li></a><a href="#october-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2022</li></a><a href="#september-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2022</li></a><a href="#august-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2022</li></a><a href="#july-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2022</li></a><a href="#june-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2022</li></a><a href="#may-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2022</li></a><a href="#april-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2022</li></a><a href="#march-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2022</li></a><a href="#table-merging-and-cell-tooltips" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Table merging and cell tooltips</li></a><a href="#february-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2022</li></a><a href="#january-2022" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2022</li></a><a href="#2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2021</li></a><a href="#december-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2021</li></a><a href="#linefills" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Linefills</li></a><a href="#new-functions-for-string-manipulation" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>New functions for string manipulation</li></a><a href="#textboxes" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Textboxes</li></a><a href="#new-built-in-variables" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>New built-in variables</li></a><a href="#november-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>November 2021</li></a><a href="#forin" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>for…in</li></a><a href="#function-overloads" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Function overloads</li></a><a href="#currency-conversion" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Currency conversion</li></a><a href="#october-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2021</li></a><a href="#new-features" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>New features</li></a><a href="#changes" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-4" data-astro-cid-oor6cujd>Changes</li></a><a href="#september-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2021</li></a><a href="#july-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2021</li></a><a href="#june-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2021</li></a><a href="#may-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2021</li></a><a href="#april-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2021</li></a><a href="#march-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2021</li></a><a href="#february-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2021</li></a><a href="#january-2021" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2021</li></a><a href="#2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2020</li></a><a href="#december-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2020</li></a><a href="#november-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>November 2020</li></a><a href="#october-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2020</li></a><a href="#september-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2020</li></a><a href="#august-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2020</li></a><a href="#july-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2020</li></a><a href="#june-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2020</li></a><a href="#may-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2020</li></a><a href="#april-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2020</li></a><a href="#march-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2020</li></a><a href="#february-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2020</li></a><a href="#january-2020" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2020</li></a><a href="#2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2019</li></a><a href="#december-2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2019</li></a><a href="#october-2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2019</li></a><a href="#september-2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2019</li></a><a href="#july-august-2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July-August 2019</li></a><a href="#june-2019" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2019</li></a><a href="#2018" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2018</li></a><a href="#october-2018" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2018</li></a><a href="#april-2018" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2018</li></a><a href="#2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2017</li></a><a href="#august-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2017</li></a><a href="#june-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2017</li></a><a href="#may-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>May 2017</li></a><a href="#april-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2017</li></a><a href="#march-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2017</li></a><a href="#february-2017" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2017</li></a><a href="#2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2016</li></a><a href="#december-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>December 2016</li></a><a href="#october-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2016</li></a><a href="#september-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2016</li></a><a href="#july-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2016</li></a><a href="#march-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2016</li></a><a href="#february-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2016</li></a><a href="#january-2016" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>January 2016</li></a><a href="#2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2015</li></a><a href="#october-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>October 2015</li></a><a href="#september-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>September 2015</li></a><a href="#july-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2015</li></a><a href="#june-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2015</li></a><a href="#april-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2015</li></a><a href="#march-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>March 2015</li></a><a href="#february-2015" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2015</li></a><a href="#2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2014</li></a><a href="#august-2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>August 2014</li></a><a href="#july-2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>July 2014</li></a><a href="#june-2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>June 2014</li></a><a href="#april-2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>April 2014</li></a><a href="#february-2014" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-3" data-astro-cid-oor6cujd>February 2014</li></a><a href="#2013" class="document-toc-link" data-astro-cid-oor6cujd><li class="l-2" data-astro-cid-oor6cujd>2013</li></a></ul></section><div class="toc-bottom-fade" data-astro-cid-oor6cujd></div><div class="back-top-space" data-astro-cid-oor6cujd><div class="not-content" style="" data-astro-cid-pkzv2hgs> <a id="back-top-button" title="Back to top" href="#top" data-astro-cid-pkzv2hgs class="floating-button not-content stvb-base stvb-pointer stvb-gray stvb-medium stvb-secondary stvb-icon stvb-icon-force-color stvb-force-no-border"> <svg width="18" height="18" viewBox="0 0 18 18" data-astro-cid-oor6cujd data-icon="theme/arrow-up"> <symbol id="ai:local:theme/arrow-up"><g fill="none"><g clip-path="url(#a)"><path fill="currentColor" fill-rule="evenodd" d="m9 3.5.5.44 4 3.5-1 1.12-2.75-2.4V14h-1.5V6.15L5.49 8.56l-.98-1.12 4-3.5L9 3.5Z" clip-rule="evenodd"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h18v18H0z"/></clipPath></defs></g></symbol><use xlink:href="#ai:local:theme/arrow-up"></use> </svg> </a> </div> </div></aside></div> </main> </div> <footer data-astro-cid-b6pf7ola> <div class="footer-content" data-astro-cid-b6pf7ola> <ul data-astro-cid-b6pf7ola> <li data-astro-cid-b6pf7ola> <a href="https://www.tradingview.com/chat/#BfmVowG1TZkKO235" data-astro-cid-b6pf7ola>Pine Q&A chat</a> </li><li data-astro-cid-b6pf7ola> <a href="https://stackoverflow.com/questions/tagged/pine-script" data-astro-cid-b6pf7ola>Stack Overflow</a> ↗ </li><li data-astro-cid-b6pf7ola> <a href="https://t.me/PineCodersQA" data-astro-cid-b6pf7ola>Telegram</a> ↗ </li><li data-astro-cid-b6pf7ola> <a href="https://www.reddit.com/r/TradingView/" data-astro-cid-b6pf7ola>Reddit</a> ↗ </li> </ul> <div class="flex" data-astro-cid-b6pf7ola></div> <div class="copyright" data-astro-cid-b6pf7ola>Copyright © 2024 TradingView, Inc.</div> </div> </footer> </body></html>