@guihz/trading-vue-editor-tes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/README.md +30 -0
  2. package/lib/App.d.ts +3 -0
  3. package/lib/api/api.d.ts +1 -0
  4. package/lib/api/server.d.ts +8 -0
  5. package/lib/assets/parserTccWorker-CFBnUzVu.js +99 -0
  6. package/lib/assets/scriptsRunWorker-CSDMAOri.js +66 -0
  7. package/lib/components/editor/config/monarchTokens.d.ts +205 -0
  8. package/lib/components/editor/constants/contents.d.ts +40 -0
  9. package/lib/components/editor/constants/locals.d.ts +3 -0
  10. package/lib/components/editor/index.d.ts +21 -0
  11. package/lib/components/editor/parseScript/buildInConstants.d.ts +252 -0
  12. package/lib/components/editor/parseScript/buildInFuncNamespace/array.d.ts +144 -0
  13. package/lib/components/editor/parseScript/buildInFuncNamespace/color.d.ts +25 -0
  14. package/lib/components/editor/parseScript/buildInFuncNamespace/errorListener.d.ts +8 -0
  15. package/lib/components/editor/parseScript/buildInFuncNamespace/index.d.ts +12 -0
  16. package/lib/components/editor/parseScript/buildInFuncNamespace/input.d.ts +70 -0
  17. package/lib/components/editor/parseScript/buildInFuncNamespace/map.d.ts +37 -0
  18. package/lib/components/editor/parseScript/buildInFuncNamespace/math.d.ts +47 -0
  19. package/lib/components/editor/parseScript/buildInFuncNamespace/matrix.d.ts +136 -0
  20. package/lib/components/editor/parseScript/buildInFuncNamespace/string.d.ts +43 -0
  21. package/lib/components/editor/parseScript/buildInFuncNamespace/ta.d.ts +116 -0
  22. package/lib/components/editor/parseScript/buildInFuncNamespace/timeframe.d.ts +19 -0
  23. package/lib/components/editor/parseScript/buildInVariables.d.ts +122 -0
  24. package/lib/components/editor/parseScript/constants.d.ts +56 -0
  25. package/lib/components/editor/parseScript/enum.d.ts +248 -0
  26. package/lib/components/editor/parseScript/parseToJs.d.ts +44 -0
  27. package/lib/components/editor/parseScript/type.d.ts +27 -0
  28. package/lib/components/editor/parseScript/userTypeClass.d.ts +12 -0
  29. package/lib/components/editor/parseScript/utils.d.ts +8 -0
  30. package/lib/components/editor/parseScript/visitorParser.d.ts +303 -0
  31. package/lib/components/editor/parseScript/visitorUtils.d.ts +30 -0
  32. package/lib/components/editor/parseScript/workerStorage.d.ts +12 -0
  33. package/lib/components/editor/tokenizer/config.d.ts +40 -0
  34. package/lib/components/editor/tokenizer/utils.d.ts +33 -0
  35. package/lib/components/editor/type/index.d.ts +70 -0
  36. package/lib/components/editor/utils/color.d.ts +33 -0
  37. package/lib/components/editor/utils/completions.d.ts +61 -0
  38. package/lib/components/editor/utils/decorations.d.ts +23 -0
  39. package/lib/components/editor/utils/initEditor.d.ts +23 -0
  40. package/lib/components/editor/utils/overlayWidgets.d.ts +22 -0
  41. package/lib/components/editor/utils/parse.d.ts +43 -0
  42. package/lib/components/editor/utils/parserTccWorker.d.ts +25 -0
  43. package/lib/components/editor/utils/signatureHelp.d.ts +29 -0
  44. package/lib/components/editor/utils/suggestions.d.ts +18 -0
  45. package/lib/components/editor/utils/test.d.ts +22 -0
  46. package/lib/components/editor/utils/tools.d.ts +1 -0
  47. package/lib/main.d.ts +1 -0
  48. package/lib/packages/index.d.ts +5 -0
  49. package/lib/tccParser/LexerBase.d.ts +19 -0
  50. package/lib/tccParser/tccScriptParserVisitor.d.ts +486 -0
  51. package/lib/trading-vue-editor.js +64939 -0
  52. package/lib/trading-vue-editor.umd.cjs +144 -0
  53. package/package.json +53 -0
@@ -0,0 +1,144 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.line-decoration_modified,.line-decoration_added,.line-decoration_removed{left:auto!important;right:20px;transform:scale(-1);width:4px!important}.line-modified:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1;background-image:linear-gradient(-45deg,#2962ff 25%,#0000 0,#0000 50%,#2962ff 0,#2962ff 75%,#0000 0,#0000);background-size:3px 3px}.line-added:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1;background:#089950}.modified-in-monaco-diff-editor .line-modified:before,.modified-in-monaco-diff-editor .line-added:before,.modified-in-monaco-diff-editor .line-decoration_removed:after{background:none}.line-modified:hover:before,.line-added:hover:before,.line-decoration_removed:hover:before{width:5px}.line-decoration_removed:hover:before{background-color:#f23645}.line-decoration_removed:hover:after{background:none}.line-decoration_removed:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1}.line-decoration_removed:after{background:url(../src/assets/error-triangle.svg) 50% no-repeat;background-size:5px 20px;content:"";height:10px;left:-4px;position:absolute;top:-3px;transform:scale(-1);width:10px}.content-popup{position:relative;border-bottom:1px solid;display:flex;flex-direction:column;height:100%;-webkit-user-select:none;user-select:none;background-color:#1e222d}.header-popup{align-items:center;position:relative;z-index:1;border-bottom:1px solid #0000;border-left:0;border-right:0;border-top:1px solid #0000;display:flex;height:22px;justify-content:space-between;margin-top:5px;background-color:#1e222d}.title-popup{font-size:13px;font-weight:400;line-height:18px;margin-left:27px}.actions-popup{align-items:center;display:flex}.button-popup{height:24px;cursor:pointer;justify-content:center;width:24px;display:flex;padding:0 5px;align-items:center;box-sizing:border-box;transition:background-color 60ms ease,opacity 60ms ease,color 60ms ease}.icon-popup{display:flex}.triangle-popup{position:absolute;left:55px;margin-top:1px;height:8px;z-index:0;transform:rotate(-45deg);width:8px}.triangle-modified-popup{background-color:#2962ff}.header-modified-popup{border-color:#2962ff}.content-modified-popup{border-bottom-color:#2962ff}.triangle-added-popup{background-color:#089950}.header-added-popup{border-color:#089950}.content-added-popup{border-bottom-color:#089950}.triangle-removed-popup{background-color:#f23645}.header-removed-popup{border-color:#f23645}.content-removed-popup{border-bottom-color:#f23645}.monaco-editor.vs-dark .quick-input-widget{background:#1e222d!important}.monaco-editor .monaco-inputbox:focus-within,.monaco-editor.vs-dark .monaco-inputbox:focus-within{border-color:#2962ff}.monaco-editor.vs-dark .monaco-inputbox,.monaco-editor.vs-dark .monaco-inputbox.idle{border:2px solid #50535e}.monaco-editor .monaco-inputbox,.monaco-editor .monaco-inputbox.idle{border:2px solid #a3a6af;border-radius:4px;overflow:hidden}.monaco-editor .quick-input-widget .monaco-inputbox{background-color:unset!important;border:unset!important}.monaco-editor .quick-input-widget .input:active,.monaco-editor .quick-input-widget .input:focus{border:2px solid #2962ff}.monaco-editor.vs-dark .quick-input-widget .input{background-color:#1e222d!important;color:#d1d4dc!important}.monaco-editor .monaco-inputbox .input{font-size:14px;line-height:18px;outline:none}.monaco-editor .quick-input-widget .input{background-color:#fff!important;border:1px solid #d1d4dc;border-radius:6px;color:#131722!important;height:28px;padding-bottom:5px}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ (function(Ke,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("react"),require("monaco-editor"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","monaco-editor","react-dom"],F):(Ke=typeof globalThis<"u"?globalThis:Ke||self,F(Ke.vueEditor={},Ke.react,Ke["monaco-editor"],Ke["react-dom"]))})(this,function(Ke,F,pt,Nc){"use strict";var Tn=document.createElement("style");Tn.textContent=`.line-decoration_modified,.line-decoration_added,.line-decoration_removed{left:auto!important;right:20px;transform:scale(-1);width:4px!important}.line-modified:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1;background-image:linear-gradient(-45deg,#2962ff 25%,#0000 0,#0000 50%,#2962ff 0,#2962ff 75%,#0000 0,#0000);background-size:3px 3px}.line-added:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1;background:#089950}.modified-in-monaco-diff-editor .line-modified:before,.modified-in-monaco-diff-editor .line-added:before,.modified-in-monaco-diff-editor .line-decoration_removed:after{background:none}.line-modified:hover:before,.line-added:hover:before,.line-decoration_removed:hover:before{width:5px}.line-decoration_removed:hover:before{background-color:#f23645}.line-decoration_removed:hover:after{background:none}.line-decoration_removed:before{content:"";height:100%;left:0;position:absolute;top:0;transition:width .2s;width:3px;z-index:1}.line-decoration_removed:after{background:url(../src/assets/error-triangle.svg) 50% no-repeat;background-size:5px 20px;content:"";height:10px;left:-4px;position:absolute;top:-3px;transform:scale(-1);width:10px}.content-popup{position:relative;border-bottom:1px solid;display:flex;flex-direction:column;height:100%;-webkit-user-select:none;user-select:none;background-color:#1e222d}.header-popup{align-items:center;position:relative;z-index:1;border-bottom:1px solid #0000;border-left:0;border-right:0;border-top:1px solid #0000;display:flex;height:22px;justify-content:space-between;margin-top:5px;background-color:#1e222d}.title-popup{font-size:13px;font-weight:400;line-height:18px;margin-left:27px}.actions-popup{align-items:center;display:flex}.button-popup{height:24px;cursor:pointer;justify-content:center;width:24px;display:flex;padding:0 5px;align-items:center;box-sizing:border-box;transition:background-color 60ms ease,opacity 60ms ease,color 60ms ease}.icon-popup{display:flex}.triangle-popup{position:absolute;left:55px;margin-top:1px;height:8px;z-index:0;transform:rotate(-45deg);width:8px}.triangle-modified-popup{background-color:#2962ff}.header-modified-popup{border-color:#2962ff}.content-modified-popup{border-bottom-color:#2962ff}.triangle-added-popup{background-color:#089950}.header-added-popup{border-color:#089950}.content-added-popup{border-bottom-color:#089950}.triangle-removed-popup{background-color:#f23645}.header-removed-popup{border-color:#f23645}.content-removed-popup{border-bottom-color:#f23645}.monaco-editor.vs-dark .quick-input-widget{background:#1e222d!important}.monaco-editor .monaco-inputbox:focus-within,.monaco-editor.vs-dark .monaco-inputbox:focus-within{border-color:#2962ff}.monaco-editor.vs-dark .monaco-inputbox,.monaco-editor.vs-dark .monaco-inputbox.idle{border:2px solid #50535e}.monaco-editor .monaco-inputbox,.monaco-editor .monaco-inputbox.idle{border:2px solid #a3a6af;border-radius:4px;overflow:hidden}.monaco-editor .quick-input-widget .monaco-inputbox{background-color:unset!important;border:unset!important}.monaco-editor .quick-input-widget .input:active,.monaco-editor .quick-input-widget .input:focus{border:2px solid #2962ff}.monaco-editor.vs-dark .quick-input-widget .input{background-color:#1e222d!important;color:#d1d4dc!important}.monaco-editor .monaco-inputbox .input{font-size:14px;line-height:18px;outline:none}.monaco-editor .quick-input-widget .input{background-color:#fff!important;border:1px solid #d1d4dc;border-radius:6px;color:#131722!important;height:28px;padding-bottom:5px}
3
+ `,document.head.appendChild(Tn);var La=typeof document<"u"?document.currentScript:null,ea=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Gs={exports:{}},ta={};/**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */var In;function Pc(){if(In)return ta;In=1;var n=F,s=Symbol.for("react.element"),a=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function m(v,g,b){var w,k={},z=null,E=null;b!==void 0&&(z=""+b),g.key!==void 0&&(z=""+g.key),g.ref!==void 0&&(E=g.ref);for(w in g)l.call(g,w)&&!p.hasOwnProperty(w)&&(k[w]=g[w]);if(v&&v.defaultProps)for(w in g=v.defaultProps,g)k[w]===void 0&&(k[w]=g[w]);return{$$typeof:s,type:v,key:z,ref:E,props:k,_owner:u.current}}return ta.Fragment=a,ta.jsx=m,ta.jsxs=m,ta}var ra={};/**
12
+ * @license React
13
+ * react-jsx-runtime.development.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */var Dn;function Rc(){return Dn||(Dn=1,process.env.NODE_ENV!=="production"&&function(){var n=F,s=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),v=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),R=Symbol.iterator,L="@@iterator";function J(y){if(y===null||typeof y!="object")return null;var S=R&&y[R]||y[L];return typeof S=="function"?S:null}var de=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function ee(y){{for(var S=arguments.length,N=new Array(S>1?S-1:0),H=1;H<S;H++)N[H-1]=arguments[H];De("error",y,N)}}function De(y,S,N){{var H=de.ReactDebugCurrentFrame,ce=H.getStackAddendum();ce!==""&&(S+="%s",N=N.concat([ce]));var pe=N.map(function(se){return String(se)});pe.unshift("Warning: "+S),Function.prototype.apply.call(console[y],console,pe)}}var ne=!1,Y=!1,le=!1,K=!1,Ne=!1,_e;_e=Symbol.for("react.module.reference");function re(y){return!!(typeof y=="string"||typeof y=="function"||y===l||y===p||Ne||y===u||y===b||y===w||K||y===E||ne||Y||le||typeof y=="object"&&y!==null&&(y.$$typeof===z||y.$$typeof===k||y.$$typeof===m||y.$$typeof===v||y.$$typeof===g||y.$$typeof===_e||y.getModuleId!==void 0))}function yt(y,S,N){var H=y.displayName;if(H)return H;var ce=S.displayName||S.name||"";return ce!==""?N+"("+ce+")":N}function kt(y){return y.displayName||"Context"}function Pe(y){if(y==null)return null;if(typeof y.tag=="number"&&ee("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case l:return"Fragment";case a:return"Portal";case p:return"Profiler";case u:return"StrictMode";case b:return"Suspense";case w:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case v:var S=y;return kt(S)+".Consumer";case m:var N=y;return kt(N._context)+".Provider";case g:return yt(y,y.render,"ForwardRef");case k:var H=y.displayName||null;return H!==null?H:Pe(y.type)||"Memo";case z:{var ce=y,pe=ce._payload,se=ce._init;try{return Pe(se(pe))}catch{return null}}}return null}var we=Object.assign,W=0,ye,Re,Me,Ot,jt,V,ge;function Le(){}Le.__reactDisabledLog=!0;function Ut(){{if(W===0){ye=console.log,Re=console.info,Me=console.warn,Ot=console.error,jt=console.group,V=console.groupCollapsed,ge=console.groupEnd;var y={configurable:!0,enumerable:!0,value:Le,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}W++}}function $e(){{if(W--,W===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:we({},y,{value:ye}),info:we({},y,{value:Re}),warn:we({},y,{value:Me}),error:we({},y,{value:Ot}),group:we({},y,{value:jt}),groupCollapsed:we({},y,{value:V}),groupEnd:we({},y,{value:ge})})}W<0&&ee("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var sr=de.ReactCurrentDispatcher,da;function Et(y,S,N){{if(da===void 0)try{throw Error()}catch(ce){var H=ce.stack.trim().match(/\n( *(at )?)/);da=H&&H[1]||""}return`
20
+ `+da+y}}var Wt=!1,Nr;{var Pr=typeof WeakMap=="function"?WeakMap:Map;Nr=new Pr}function _r(y,S){if(!y||Wt)return"";{var N=Nr.get(y);if(N!==void 0)return N}var H;Wt=!0;var ce=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var pe;pe=sr.current,sr.current=null,Ut();try{if(S){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(Ze){H=Ze}Reflect.construct(y,[],se)}else{try{se.call()}catch(Ze){H=Ze}y.call(se.prototype)}}else{try{throw Error()}catch(Ze){H=Ze}y()}}catch(Ze){if(Ze&&H&&typeof Ze.stack=="string"){for(var te=Ze.stack.split(`
21
+ `),Be=H.stack.split(`
22
+ `),ke=te.length-1,qe=Be.length-1;ke>=1&&qe>=0&&te[ke]!==Be[qe];)qe--;for(;ke>=1&&qe>=0;ke--,qe--)if(te[ke]!==Be[qe]){if(ke!==1||qe!==1)do if(ke--,qe--,qe<0||te[ke]!==Be[qe]){var Qe=`
23
+ `+te[ke].replace(" at new "," at ");return y.displayName&&Qe.includes("<anonymous>")&&(Qe=Qe.replace("<anonymous>",y.displayName)),typeof y=="function"&&Nr.set(y,Qe),Qe}while(ke>=1&&qe>=0);break}}}finally{Wt=!1,sr.current=pe,$e(),Error.prepareStackTrace=ce}var qt=y?y.displayName||y.name:"",ns=qt?Et(qt):"";return typeof y=="function"&&Nr.set(y,ns),ns}function Qa(y,S,N){return _r(y,!1)}function st(y){var S=y.prototype;return!!(S&&S.isReactComponent)}function Mt(y,S,N){if(y==null)return"";if(typeof y=="function")return _r(y,st(y));if(typeof y=="string")return Et(y);switch(y){case b:return Et("Suspense");case w:return Et("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case g:return Qa(y.render);case k:return Mt(y.type,S,N);case z:{var H=y,ce=H._payload,pe=H._init;try{return Mt(pe(ce),S,N)}catch{}}}return""}var Rr=Object.prototype.hasOwnProperty,ht={},pa=de.ReactDebugCurrentFrame;function Or(y){if(y){var S=y._owner,N=Mt(y.type,y._source,S?S.type:null);pa.setExtraStackFrame(N)}else pa.setExtraStackFrame(null)}function gr(y,S,N,H,ce){{var pe=Function.call.bind(Rr);for(var se in y)if(pe(y,se)){var te=void 0;try{if(typeof y[se]!="function"){var Be=Error((H||"React class")+": "+N+" type `"+se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Be.name="Invariant Violation",Be}te=y[se](S,se,H,N,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ke){te=ke}te&&!(te instanceof Error)&&(Or(ce),ee("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",H||"React class",N,se,typeof te),Or(null)),te instanceof Error&&!(te.message in ht)&&(ht[te.message]=!0,Or(ce),ee("Failed %s type: %s",N,te.message),Or(null))}}}var it=Array.isArray;function Ht(y){return it(y)}function Er(y){{var S=typeof Symbol=="function"&&Symbol.toStringTag,N=S&&y[Symbol.toStringTag]||y.constructor.name||"Object";return N}}function ii(y){try{return ir(y),!1}catch{return!0}}function ir(y){return""+y}function Za(y){if(ii(y))return ee("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Er(y)),ir(y)}var At=de.ReactCurrentOwner,nr={key:!0,ref:!0,__self:!0,__source:!0},Mr,Lr,br;br={};function ma(y){if(Rr.call(y,"ref")){var S=Object.getOwnPropertyDescriptor(y,"ref").get;if(S&&S.isReactWarning)return!1}return y.ref!==void 0}function fa(y){if(Rr.call(y,"key")){var S=Object.getOwnPropertyDescriptor(y,"key").get;if(S&&S.isReactWarning)return!1}return y.key!==void 0}function ya(y,S){if(typeof y.ref=="string"&&At.current&&S&&At.current.stateNode!==S){var N=Pe(At.current.type);br[N]||(ee('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Pe(At.current.type),y.ref),br[N]=!0)}}function ha(y,S){{var N=function(){Mr||(Mr=!0,ee("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",S))};N.isReactWarning=!0,Object.defineProperty(y,"key",{get:N,configurable:!0})}}function _a(y,S){{var N=function(){Lr||(Lr=!0,ee("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",S))};N.isReactWarning=!0,Object.defineProperty(y,"ref",{get:N,configurable:!0})}}var ga=function(y,S,N,H,ce,pe,se){var te={$$typeof:s,type:y,key:S,ref:N,props:se,_owner:pe};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:H}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ce}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function ni(y,S,N,H,ce){{var pe,se={},te=null,Be=null;N!==void 0&&(Za(N),te=""+N),fa(S)&&(Za(S.key),te=""+S.key),ma(S)&&(Be=S.ref,ya(S,ce));for(pe in S)Rr.call(S,pe)&&!nr.hasOwnProperty(pe)&&(se[pe]=S[pe]);if(y&&y.defaultProps){var ke=y.defaultProps;for(pe in ke)se[pe]===void 0&&(se[pe]=ke[pe])}if(te||Be){var qe=typeof y=="function"?y.displayName||y.name||"Unknown":y;te&&ha(se,qe),Be&&_a(se,qe)}return ga(y,te,Be,ce,H,At.current,se)}}var ba=de.ReactCurrentOwner,Ja=de.ReactDebugCurrentFrame;function Vt(y){if(y){var S=y._owner,N=Mt(y.type,y._source,S?S.type:null);Ja.setExtraStackFrame(N)}else Ja.setExtraStackFrame(null)}var Fr;Fr=!1;function xa(y){return typeof y=="object"&&y!==null&&y.$$typeof===s}function es(){{if(ba.current){var y=Pe(ba.current.type);if(y)return`
24
+
25
+ Check the render method of \``+y+"`."}return""}}function oi(y){{if(y!==void 0){var S=y.fileName.replace(/^.*[\\\/]/,""),N=y.lineNumber;return`
26
+
27
+ Check your code at `+S+":"+N+"."}return""}}var ts={};function rs(y){{var S=es();if(!S){var N=typeof y=="string"?y:y.displayName||y.name;N&&(S=`
28
+
29
+ Check the top-level render call using <`+N+">.")}return S}}function as(y,S){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var N=rs(S);if(ts[N])return;ts[N]=!0;var H="";y&&y._owner&&y._owner!==ba.current&&(H=" It was passed a child from "+Pe(y._owner.type)+"."),Vt(y),ee('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',N,H),Vt(null)}}function ss(y,S){{if(typeof y!="object")return;if(Ht(y))for(var N=0;N<y.length;N++){var H=y[N];xa(H)&&as(H,S)}else if(xa(y))y._store&&(y._store.validated=!0);else if(y){var ce=J(y);if(typeof ce=="function"&&ce!==y.entries)for(var pe=ce.call(y),se;!(se=pe.next()).done;)xa(se.value)&&as(se.value,S)}}}function li(y){{var S=y.type;if(S==null||typeof S=="string")return;var N;if(typeof S=="function")N=S.propTypes;else if(typeof S=="object"&&(S.$$typeof===g||S.$$typeof===k))N=S.propTypes;else return;if(N){var H=Pe(S);gr(N,y.props,"prop",H,y)}else if(S.PropTypes!==void 0&&!Fr){Fr=!0;var ce=Pe(S);ee("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ce||"Unknown")}typeof S.getDefaultProps=="function"&&!S.getDefaultProps.isReactClassApproved&&ee("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function va(y){{for(var S=Object.keys(y.props),N=0;N<S.length;N++){var H=S[N];if(H!=="children"&&H!=="key"){Vt(y),ee("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",H),Vt(null);break}}y.ref!==null&&(Vt(y),ee("Invalid attribute `ref` supplied to `React.Fragment`."),Vt(null))}}function is(y,S,N,H,ce,pe){{var se=re(y);if(!se){var te="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(te+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Be=oi(ce);Be?te+=Be:te+=es();var ke;y===null?ke="null":Ht(y)?ke="array":y!==void 0&&y.$$typeof===s?(ke="<"+(Pe(y.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):ke=typeof y,ee("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ke,te)}var qe=ni(y,S,N,ce,pe);if(qe==null)return qe;if(se){var Qe=S.children;if(Qe!==void 0)if(H)if(Ht(Qe)){for(var qt=0;qt<Qe.length;qt++)ss(Qe[qt],y);Object.freeze&&Object.freeze(Qe)}else ee("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ss(Qe,y)}return y===l?va(qe):li(qe),qe}}function wa(y,S,N){return is(y,S,N,!0)}function ci(y,S,N){return is(y,S,N,!1)}var ui=ci,di=wa;ra.Fragment=l,ra.jsx=ui,ra.jsxs=di}()),ra}process.env.NODE_ENV==="production"?Gs.exports=Pc():Gs.exports=Rc();var mt=Gs.exports;function Oc(n,s,a){return s in n?Object.defineProperty(n,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[s]=a,n}function kn(n,s){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);s&&(l=l.filter(function(u){return Object.getOwnPropertyDescriptor(n,u).enumerable})),a.push.apply(a,l)}return a}function An(n){for(var s=1;s<arguments.length;s++){var a=arguments[s]!=null?arguments[s]:{};s%2?kn(Object(a),!0).forEach(function(l){Oc(n,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):kn(Object(a)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(a,l))})}return n}function Ec(n,s){if(n==null)return{};var a={},l=Object.keys(n),u,p;for(p=0;p<l.length;p++)u=l[p],!(s.indexOf(u)>=0)&&(a[u]=n[u]);return a}function Mc(n,s){if(n==null)return{};var a=Ec(n,s),l,u;if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(n);for(u=0;u<p.length;u++)l=p[u],!(s.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(n,l)&&(a[l]=n[l])}return a}function Lc(n,s){return Fc(n)||Bc(n,s)||jc(n,s)||Uc()}function Fc(n){if(Array.isArray(n))return n}function Bc(n,s){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(n)))){var a=[],l=!0,u=!1,p=void 0;try{for(var m=n[Symbol.iterator](),v;!(l=(v=m.next()).done)&&(a.push(v.value),!(s&&a.length===s));l=!0);}catch(g){u=!0,p=g}finally{try{!l&&m.return!=null&&m.return()}finally{if(u)throw p}}return a}}function jc(n,s){if(n){if(typeof n=="string")return qn(n,s);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(n);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return qn(n,s)}}function qn(n,s){(s==null||s>n.length)&&(s=n.length);for(var a=0,l=new Array(s);a<s;a++)l[a]=n[a];return l}function Uc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
30
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wc(n,s,a){return s in n?Object.defineProperty(n,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[s]=a,n}function Cn(n,s){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);s&&(l=l.filter(function(u){return Object.getOwnPropertyDescriptor(n,u).enumerable})),a.push.apply(a,l)}return a}function Sn(n){for(var s=1;s<arguments.length;s++){var a=arguments[s]!=null?arguments[s]:{};s%2?Cn(Object(a),!0).forEach(function(l){Wc(n,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):Cn(Object(a)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(a,l))})}return n}function Hc(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return function(l){return s.reduceRight(function(u,p){return p(u)},l)}}function aa(n){return function s(){for(var a=this,l=arguments.length,u=new Array(l),p=0;p<l;p++)u[p]=arguments[p];return u.length>=n.length?n.apply(this,u):function(){for(var m=arguments.length,v=new Array(m),g=0;g<m;g++)v[g]=arguments[g];return s.apply(a,[].concat(u,v))}}}function Fa(n){return{}.toString.call(n).includes("Object")}function Vc(n){return!Object.keys(n).length}function sa(n){return typeof n=="function"}function $c(n,s){return Object.prototype.hasOwnProperty.call(n,s)}function Gc(n,s){return Fa(s)||tr("changeType"),Object.keys(s).some(function(a){return!$c(n,a)})&&tr("changeField"),s}function Xc(n){sa(n)||tr("selectorType")}function Yc(n){sa(n)||Fa(n)||tr("handlerType"),Fa(n)&&Object.values(n).some(function(s){return!sa(s)})&&tr("handlersType")}function Kc(n){n||tr("initialIsRequired"),Fa(n)||tr("initialType"),Vc(n)&&tr("initialContent")}function Qc(n,s){throw new Error(n[s]||n.default)}var Zc={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},tr=aa(Qc)(Zc),Ba={changes:Gc,selector:Xc,handler:Yc,initial:Kc};function Jc(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ba.initial(n),Ba.handler(s);var a={current:n},l=aa(ru)(a,s),u=aa(tu)(a),p=aa(Ba.changes)(n),m=aa(eu)(a);function v(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(w){return w};return Ba.selector(b),b(a.current)}function g(b){Hc(l,u,p,m)(b)}return[v,g]}function eu(n,s){return sa(s)?s(n.current):s}function tu(n,s){return n.current=Sn(Sn({},n.current),s),s}function ru(n,s,a){return sa(s)?s(n.current):Object.keys(a).forEach(function(l){var u;return(u=s[l])===null||u===void 0?void 0:u.call(s,n.current[l])}),a}var au={create:Jc},su={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function iu(n){return function s(){for(var a=this,l=arguments.length,u=new Array(l),p=0;p<l;p++)u[p]=arguments[p];return u.length>=n.length?n.apply(this,u):function(){for(var m=arguments.length,v=new Array(m),g=0;g<m;g++)v[g]=arguments[g];return s.apply(a,[].concat(u,v))}}}function nu(n){return{}.toString.call(n).includes("Object")}function ou(n){return n||Nn("configIsRequired"),nu(n)||Nn("configType"),n.urls?(lu(),{paths:{vs:n.urls.monacoBase}}):n}function lu(){console.warn(zn.deprecation)}function cu(n,s){throw new Error(n[s]||n.default)}var zn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
31
+ You are using deprecated way of configuration.
32
+
33
+ Instead of using
34
+ monaco.config({ urls: { monacoBase: '...' } })
35
+ use
36
+ monaco.config({ paths: { vs: '...' } })
37
+
38
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
39
+ `},Nn=iu(cu)(zn),uu={config:ou},du=function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return function(u){return a.reduceRight(function(p,m){return m(p)},u)}};function Pn(n,s){return Object.keys(s).forEach(function(a){s[a]instanceof Object&&n[a]&&Object.assign(s[a],Pn(n[a],s[a]))}),An(An({},n),s)}var pu={type:"cancelation",msg:"operation is manually canceled"};function Xs(n){var s=!1,a=new Promise(function(l,u){n.then(function(p){return s?u(pu):l(p)}),n.catch(u)});return a.cancel=function(){return s=!0},a}var mu=au.create({config:su,isInitialized:!1,resolve:null,reject:null,monaco:null}),Rn=Lc(mu,2),ia=Rn[0],ja=Rn[1];function fu(n){var s=uu.config(n),a=s.monaco,l=Mc(s,["monaco"]);ja(function(u){return{config:Pn(u.config,l),monaco:a}})}function yu(){var n=ia(function(s){var a=s.monaco,l=s.isInitialized,u=s.resolve;return{monaco:a,isInitialized:l,resolve:u}});if(!n.isInitialized){if(ja({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),Xs(Ys);if(window.monaco&&window.monaco.editor)return On(window.monaco),n.resolve(window.monaco),Xs(Ys);du(hu,gu)(bu)}return Xs(Ys)}function hu(n){return document.body.appendChild(n)}function _u(n){var s=document.createElement("script");return n&&(s.src=n),s}function gu(n){var s=ia(function(l){var u=l.config,p=l.reject;return{config:u,reject:p}}),a=_u("".concat(s.config.paths.vs,"/loader.js"));return a.onload=function(){return n()},a.onerror=s.reject,a}function bu(){var n=ia(function(a){var l=a.config,u=a.resolve,p=a.reject;return{config:l,resolve:u,reject:p}}),s=window.require;s.config(n.config),s(["vs/editor/editor.main"],function(a){On(a),n.resolve(a)},function(a){n.reject(a)})}function On(n){ia().monaco||ja({monaco:n})}function xu(){return ia(function(n){var s=n.monaco;return s})}var Ys=new Promise(function(n,s){return ja({resolve:n,reject:s})}),En={config:fu,init:yu,__getMonacoInstance:xu},vu={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ks=vu,wu={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Tu=wu;function Iu({children:n}){return F.createElement("div",{style:Tu.container},n)}var Du=Iu,ku=Du;function Au({width:n,height:s,isEditorReady:a,loading:l,_ref:u,className:p,wrapperProps:m}){return F.createElement("section",{style:{...Ks.wrapper,width:n,height:s},...m},!a&&F.createElement(ku,null,l),F.createElement("div",{ref:u,style:{...Ks.fullWidth,...!a&&Ks.hide},className:p}))}var qu=Au,Mn=F.memo(qu);function Cu(n){F.useEffect(n,[])}var Ln=Cu;function Su(n,s,a=!0){let l=F.useRef(!0);F.useEffect(l.current||!a?()=>{l.current=!1}:n,s)}var at=Su;function na(){}function Cr(n,s,a,l){return zu(n,l)||Nu(n,s,a,l)}function zu(n,s){return n.editor.getModel(Fn(n,s))}function Nu(n,s,a,l){return n.editor.createModel(s,a,l?Fn(n,l):void 0)}function Fn(n,s){return n.Uri.parse(s)}function Pu({original:n,modified:s,language:a,originalLanguage:l,modifiedLanguage:u,originalModelPath:p,modifiedModelPath:m,keepCurrentOriginalModel:v=!1,keepCurrentModifiedModel:g=!1,theme:b="light",loading:w="Loading...",options:k={},height:z="100%",width:E="100%",className:R,wrapperProps:L={},beforeMount:J=na,onMount:de=na}){let[ee,De]=F.useState(!1),[ne,Y]=F.useState(!0),le=F.useRef(null),K=F.useRef(null),Ne=F.useRef(null),_e=F.useRef(de),re=F.useRef(J),yt=F.useRef(!1);Ln(()=>{let W=En.init();return W.then(ye=>(K.current=ye)&&Y(!1)).catch(ye=>(ye==null?void 0:ye.type)!=="cancelation"&&console.error("Monaco initialization: error:",ye)),()=>le.current?we():W.cancel()}),at(()=>{if(le.current&&K.current){let W=le.current.getOriginalEditor(),ye=Cr(K.current,n||"",l||a||"text",p||"");ye!==W.getModel()&&W.setModel(ye)}},[p],ee),at(()=>{if(le.current&&K.current){let W=le.current.getModifiedEditor(),ye=Cr(K.current,s||"",u||a||"text",m||"");ye!==W.getModel()&&W.setModel(ye)}},[m],ee),at(()=>{let W=le.current.getModifiedEditor();W.getOption(K.current.editor.EditorOption.readOnly)?W.setValue(s||""):s!==W.getValue()&&(W.executeEdits("",[{range:W.getModel().getFullModelRange(),text:s||"",forceMoveMarkers:!0}]),W.pushUndoStop())},[s],ee),at(()=>{var W,ye;(ye=(W=le.current)==null?void 0:W.getModel())==null||ye.original.setValue(n||"")},[n],ee),at(()=>{let{original:W,modified:ye}=le.current.getModel();K.current.editor.setModelLanguage(W,l||a||"text"),K.current.editor.setModelLanguage(ye,u||a||"text")},[a,l,u],ee),at(()=>{var W;(W=K.current)==null||W.editor.setTheme(b)},[b],ee),at(()=>{var W;(W=le.current)==null||W.updateOptions(k)},[k],ee);let kt=F.useCallback(()=>{var Re;if(!K.current)return;re.current(K.current);let W=Cr(K.current,n||"",l||a||"text",p||""),ye=Cr(K.current,s||"",u||a||"text",m||"");(Re=le.current)==null||Re.setModel({original:W,modified:ye})},[a,s,u,n,l,p,m]),Pe=F.useCallback(()=>{var W;!yt.current&&Ne.current&&(le.current=K.current.editor.createDiffEditor(Ne.current,{automaticLayout:!0,...k}),kt(),(W=K.current)==null||W.editor.setTheme(b),De(!0),yt.current=!0)},[k,b,kt]);F.useEffect(()=>{ee&&_e.current(le.current,K.current)},[ee]),F.useEffect(()=>{!ne&&!ee&&Pe()},[ne,ee,Pe]);function we(){var ye,Re,Me,Ot;let W=(ye=le.current)==null?void 0:ye.getModel();v||((Re=W==null?void 0:W.original)==null||Re.dispose()),g||((Me=W==null?void 0:W.modified)==null||Me.dispose()),(Ot=le.current)==null||Ot.dispose()}return F.createElement(Mn,{width:E,height:z,isEditorReady:ee,loading:w,_ref:Ne,className:R,wrapperProps:L})}var Ru=Pu;F.memo(Ru);function Ou(n){let s=F.useRef();return F.useEffect(()=>{s.current=n},[n]),s.current}var Eu=Ou,Ua=new Map;function Mu({defaultValue:n,defaultLanguage:s,defaultPath:a,value:l,language:u,path:p,theme:m="light",line:v,loading:g="Loading...",options:b={},overrideServices:w={},saveViewState:k=!0,keepCurrentModel:z=!1,width:E="100%",height:R="100%",className:L,wrapperProps:J={},beforeMount:de=na,onMount:ee=na,onChange:De,onValidate:ne=na}){let[Y,le]=F.useState(!1),[K,Ne]=F.useState(!0),_e=F.useRef(null),re=F.useRef(null),yt=F.useRef(null),kt=F.useRef(ee),Pe=F.useRef(de),we=F.useRef(),W=F.useRef(l),ye=Eu(p),Re=F.useRef(!1),Me=F.useRef(!1);Ln(()=>{let V=En.init();return V.then(ge=>(_e.current=ge)&&Ne(!1)).catch(ge=>(ge==null?void 0:ge.type)!=="cancelation"&&console.error("Monaco initialization: error:",ge)),()=>re.current?jt():V.cancel()}),at(()=>{var ge,Le,Ut,$e;let V=Cr(_e.current,n||l||"",s||u||"",p||a||"");V!==((ge=re.current)==null?void 0:ge.getModel())&&(k&&Ua.set(ye,(Le=re.current)==null?void 0:Le.saveViewState()),(Ut=re.current)==null||Ut.setModel(V),k&&(($e=re.current)==null||$e.restoreViewState(Ua.get(p))))},[p],Y),at(()=>{var V;(V=re.current)==null||V.updateOptions(b)},[b],Y),at(()=>{!re.current||l===void 0||(re.current.getOption(_e.current.editor.EditorOption.readOnly)?re.current.setValue(l):l!==re.current.getValue()&&(Me.current=!0,re.current.executeEdits("",[{range:re.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),re.current.pushUndoStop(),Me.current=!1))},[l],Y),at(()=>{var ge,Le;let V=(ge=re.current)==null?void 0:ge.getModel();V&&u&&((Le=_e.current)==null||Le.editor.setModelLanguage(V,u))},[u],Y),at(()=>{var V;v!==void 0&&((V=re.current)==null||V.revealLine(v))},[v],Y),at(()=>{var V;(V=_e.current)==null||V.editor.setTheme(m)},[m],Y);let Ot=F.useCallback(()=>{var V;if(!(!yt.current||!_e.current)&&!Re.current){Pe.current(_e.current);let ge=p||a,Le=Cr(_e.current,l||n||"",s||u||"",ge||"");re.current=(V=_e.current)==null?void 0:V.editor.create(yt.current,{model:Le,automaticLayout:!0,...b},w),k&&re.current.restoreViewState(Ua.get(ge)),_e.current.editor.setTheme(m),v!==void 0&&re.current.revealLine(v),le(!0),Re.current=!0}},[n,s,a,l,u,p,b,w,k,m,v]);F.useEffect(()=>{Y&&kt.current(re.current,_e.current)},[Y]),F.useEffect(()=>{!K&&!Y&&Ot()},[K,Y,Ot]),W.current=l,F.useEffect(()=>{var V,ge;Y&&De&&((V=we.current)==null||V.dispose(),we.current=(ge=re.current)==null?void 0:ge.onDidChangeModelContent(Le=>{Me.current||De(re.current.getValue(),Le)}))},[Y,De]),F.useEffect(()=>{if(Y){let V=_e.current.editor.onDidChangeMarkers(ge=>{var Ut;let Le=(Ut=re.current.getModel())==null?void 0:Ut.uri;if(Le&&ge.find($e=>$e.path===Le.path)){let $e=_e.current.editor.getModelMarkers({resource:Le});ne==null||ne($e)}});return()=>{V==null||V.dispose()}}return()=>{}},[Y,ne]);function jt(){var V,ge;(V=we.current)==null||V.dispose(),z?k&&Ua.set(p,re.current.saveViewState()):(ge=re.current.getModel())==null||ge.dispose(),re.current.dispose()}return F.createElement(Mn,{width:E,height:R,isEditorReady:Y,loading:g,_ref:yt,className:L,wrapperProps:J})}var Lu=Mu,Fu=F.memo(Lu);const Bn={keywords:[{name:"or",desc:["Logical OR. Applicable to boolean expressions."],syntax:["expr1 or expr2"],returns:["Boolean value, or series of boolean values."]},{name:"and",desc:["Logical AND. Applicable to boolean expressions."],syntax:["expr1 and expr2"],returns:["Boolean value, or series of boolean values."]},{name:"not",desc:["Logical negation (NOT). Applicable to boolean expressions."],syntax:["not expr1"],returns:["Boolean value, or series of boolean values."]},{name:"if",desc:["If statement defines what block of statements must be executed when conditions of the expression are satisfied.","To have access to and use the if statement, one should specify the version >= 2 of Pine Script® language in the very first line of code, for example: //@version=5","The 4th version of Pine Script® Language allows you to use “else if” syntax.","General code form:"],syntax:[`var_declarationX = if condition
40
+ var_decl_then0
41
+ var_decl_then1
42
+
43
+ var_decl_thenN
44
+ else if [optional block]
45
+ var_decl_else0
46
+ var_decl_else1
47
+
48
+ var_decl_elseN
49
+ else
50
+ var_decl_else0
51
+ var_decl_else1
52
+
53
+ var_decl_elseN
54
+ return_expression_else`],detailedDesc:[{desc:["where","**var_declarationX** — this variable gets the value of the if statement","**condition** — if the condition is true, the logic from the block 'then' (var_decl_then0, var_decl_then1, etc.) is used.","If the condition is false, the logic from the block 'else' (var_decl_else0, var_decl_else1, etc.) is used.","**return_expression_then**, **return_expression_else** — the last expression from the block then or from the block else will return the final value of the statement. If declaration of the variable is in the end, its value will be the result.","The type of returning value of the if statement depends on return_expression_then and return_expression_else type (their types must match: it is not possible to return an integer value from then, while you have a string value in else block)."],examples:["//@version=5",'indicator("if")',"// This code compiles","x = if close > open"," close","else"," open","","// This code doesn’t compile","// y = if close > open","// close","// else",'// "open"',"plot(x)"]},{desc:["It is possible to omit the `else` block. In this case if the condition is false, an “empty” value (na, false, or “”) will be assigned to the var_declarationX variable:"],examples:["//@version=5",'indicator("if")',"x = if close > open"," close","// If current close > current open, then x = close.","// Otherwise the x = na.","plot(x)"]},{desc:["It is possible to use either multiple “else if” blocks or none at all. The blocks “then”, “else if”, “else” are shifted by four spaces:"],examples:["//@version=5",'indicator("if")',"x = if open > close"," 5","else if high > low"," close","else"," open","plot(x)"]},{desc:["It is possible to ignore the resulting value of an `if` statement (“var_declarationX=“ can be omitted). It may be useful if you need the side effect of the expression, for example in strategy trading:"],examples:["//@version=5",'strategy("if")',"if (ta.crossover(high, low))",' strategy.entry("BBandLE", strategy.long, stop=low, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="BBandLE")',"else",' strategy.cancel(id="BBandLE")']},{desc:["If statements can include each other:"],examples:["//@version=5",'indicator("if")',"float x = na","if close > open"," if close > close[1]"," x := close"," else"," x := close[1]","else"," x := open","plot(x)"]}]},{name:"switch",desc:["The switch operator transfers control to one of the several statements, depending on the values of a condition and expressions."],syntax:[`[variable_declaration = ] switch expression
55
+ value1 => local_block
56
+ value2 => local_block
57
+
58
+ => default_local_block
59
+
60
+ [variable_declaration = ] switch
61
+ condition1 => local_block
62
+ condition2 => local_block
63
+
64
+ => default_local_block`],detailedDesc:[{desc:["Switch with an expression:"],examples:["//@version=5",'indicator("Switch using an expression")',"",'string i_maType = input.string("EMA", "MA type", options = ["EMA", "SMA", "RMA", "WMA"])',"","float ma = switch i_maType",' "EMA" => ta.ema(close, 10)',' "SMA" => ta.sma(close, 10)',' "RMA" => ta.rma(close, 10)'," // Default used when the three first cases do not match."," => ta.wma(close, 10)","","plot(ma)"]},{desc:["Switch without an expression:"],examples:["//@version=5",'strategy("Switch without an expression", overlay = true)',"","bool longCondition = ta.crossover( ta.sma(close, 14), ta.sma(close, 28))","bool shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))","","switch",' longCondition => strategy.entry("Long ID", strategy.long)',' shortCondition => strategy.entry("Short ID", strategy.short)']}],returns:["The value of the last expression in the local block of statements that is executed."],remarks:"Only one of the `local_block` instances or the `default_local_block` can be executed. The `default_local_block` is introduced with the `=>` token alone and is only executed when none of the preceding blocks are executed. If the result of the `switch` statement is assigned to a variable and a `default_local_block` is not specified, the statement returns `na` if no `local_block` is executed. When assigning the result of the `switch` statement to a variable, all `local_block` instances must return the same type of value.",seeAlso:["[if](#op_if)","[?:](#op_?:)"]},{name:"for",desc:["The 'for' structure allows the repeated execution of a number of statements:"],syntax:[`[var_declaration =] for counter = from_num to to_num [by step_num]
65
+ statements | continue | break
66
+ return_expression`],detailedDesc:[{desc:["**var_declaration** - An optional variable declaration that will be assigned the value of the loop's return_expression.","**counter** - A variable holding the value of the loop's counter, which is incremented/decremented by 1 or by the step_num value on each iteration of the loop.",'**from_num** - The starting value of the counter. "series int/float" values/expressions are allowed.',`**to_num** - The end value of the counter. When the counter becomes greater than to_num (or less than to_num in cases where from_num > to_num) the loop is broken. "series int/float" values/expressions are allowed, but they are evaluated only on the loop's first iteration.`,"**step_num** - The increment/decrement value of the counter. It is optional. The default value is +1 or -1, depending on which of from_num or to_num is the greatest. When a value is used, the counter is also incremented/decremented depending on which of from_num or to_num is the greatest, so the +/- sign of step_num is optional.","**statements | continue | break** - Any number of statements, or the 'continue' or 'break' keywords, indented by 4 spaces or a tab.","**return_expression** - The loop's return value which is assigned to the variable in var_declaration if one is present. If the loop exits because of a 'continue' or 'break' keyword, the loop's return value is that of the last variable assigned a value before the loop's exit.","**continue** - A keyword that can only be used in loops. It causes the next iteration of the loop to be executed.","**break** - A keyword that exits the loop."],examples:["//@version=5",'indicator("for")',"// Here, we count the quantity of bars in a given 'lookback' length which closed above the current bar's close","qtyOfHigherCloses(lookback) =>"," int result = 0"," for i = 1 to lookback"," if close[i] > close"," result += 1"," result","plot(qtyOfHigherCloses(14))"]},{desc:[],examples:["//@version=5",'indicator("`for` loop with a step")',"","a = array.from(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)","sum = 0.0","","for i = 0 to 9 by 5"," // Because the step is set to 5, we are adding only the first (0) and the sixth (5) value from the array `a`."," sum += array.get(a, i)","","plot(sum)"]}],seeAlso:["[for...in](#op_for...in)","[while](#op_while)"]},{name:"for...in",desc:["The `for...in` structure allows the repeated execution of a number of statements for each element in an array. It can be used with either one argument: `array_element`, or with two: `[index, array_element]`. The second form doesn't affect the functionality of the loop. It tracks the current iteration's index in the tuple's first variable."],syntax:[`[var_declaration =] for array_element in array_id
67
+ statements | continue | break
68
+ return_expression
69
+
70
+ [var_declaration =] for [index, array_element] in array_id
71
+ statements | continue | break
72
+ return_expression`],detailedDesc:[{desc:["**var_declaration** - An optional variable declaration that will be assigned the value of the loop's `return_expression`.","**index** - An optional variable that tracks the current iteration's index. Indexing starts at 0. The variable is immutable in the loop's body. When used, it must be included in a tuple also containing `array_element`.","**array_element** - A variable containing each successive array element to be processed in the loop. The variable is immutable in the loop's body.","**array_id** - The ID of the array over which the loop is iterated.","**statements | continue | break** - Any number of statements, or the 'continue' or 'break' keywords, indented by 4 spaces or a tab.","**return_expression** - The loop's return value assigned to the variable in `var_declaration`, if one is present. If the loop exits because of a 'continue' or 'break' keyword, the loop's return value is that of the last variable assigned a value before the loop's exit.","**continue** - A keyword that can only be used in loops. It causes the next iteration of the loop to be executed.","**break** - A keyword that exits the loop.","It is allowed to modify the array's elements or its size inside the loop."]},{desc:["Here, we use the single-argument form of `for...in` to determine on each bar how many of the bar's OHLC values are greater than the SMA of 'close' values:"],examples:["//@version=5",'indicator("for...in")',"// Here we determine on each bar how many of the bar's OHLC values are greater than the SMA of 'close' values","float[] ohlcValues = array.from(open, high, low, close)","qtyGreaterThan(value, array) =>"," int result = 0"," for currentElement in array"," if currentElement > value"," result += 1"," result","plot(qtyGreaterThan(ta.sma(close, 20), ohlcValues))"]},{desc:["Here, we use the two-argument form of [for...in](#op_for...in) to set the values of our `isPos` array to `true` when their corresponding value in our `valuesArray` array is positive:"],examples:["//@version=5",'indicator("for...in")',"var valuesArray = array.from(4, -8, 11, 78, -16, 34, 7, 99, 0, 55)","var isPos = array.new_bool(10, false)","","for [index, value] in valuesArray"," if value > 0"," array.set(isPos, index, true)","","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(isPos))"]},{desc:["Iterate through matrix rows as arrays."],examples:["//@version=5",'indicator("`for ... in` matrix Example")',"","// Create a 2x3 matrix with values `4`.","matrix1 = matrix.new<int>(2, 3, 4)","","sum = 0.0","// Loop through every row of the matrix.","for rowArray in matrix1"," // Sum values of the every row "," sum += array.sum(rowArray)","","plot(sum)"]}],seeAlso:["[for](#op_for)","[while](#op_while)","[array.sum](#fun_array.sum)","[array.min](#fun_array.min)","[array.max](#fun_array.max)"]},{name:"while",desc:["The `while` statement allows the conditional iteration of a local code block."],syntax:[`variable_declaration = while condition
73
+
74
+ continue
75
+
76
+ break
77
+
78
+ return_expression`],detailedDesc:[{desc:["where:","**variable_declaration** - An optional variable declaration. The `return expression` can provide the initialization value for this variable.","**condition** - when true, the local block of the `while` statement is executed. When false, execution of the script resumes after the `while` statement.","**continue** - The `continue` keyword causes the loop to branch to its next iteration.","**break** - The `break` keyword causes the loop to terminate. The script's execution resumes after the `while` statement.","**return_expression** - An optional line providing the `while` statement's returning value."],examples:["//@version=5",'indicator("while")',"// This is a simple example of calculating a factorial using a while loop.",'int i_n = input.int(10, "Factorial Size", minval=0)',"int counter = i_n","int factorial = 1","while counter > 0"," factorial := factorial * counter"," counter := counter - 1","","plot(factorial)"]}],remarks:"The local code block after the initial `while` line must be indented with four spaces or a tab. For the `while` loop to terminate, the boolean expression following `while` must eventually become false, or a `break` must be executed."},{name:"var",desc:["**var** is the keyword used for assigning and one-time initializing of the variable.","Normally, a syntax of assignment of variables, which doesn’t include the keyword var, results in the value of the variable being overwritten with every update of the data. Contrary to that, when assigning variables with the keyword var, they can “keep the state” despite the data updating, only changing it when conditions within if-expressions are met."],syntax:["var variable_name = expression"],detailedDesc:[{desc:["where:","**variable_name** - any name of the user’s variable that’s allowed in Pine Script® (can contain capital and lowercase Latin characters, numbers, and underscores (_), but can’t start with a number).","**expression** - any arithmetic expression, just as with defining a regular variable. The expression will be calculated and assigned to a variable once."],examples:["//@version=5",'indicator("Var keyword example")',"var a = close","var b = 0.0","var c = 0.0","var green_bars_count = 0","if close > open"," var x = close"," b := x"," green_bars_count := green_bars_count + 1"," if green_bars_count >= 10"," var y = close"," c := y","plot(a)","plot(b)","plot(c)"]},{desc:["The variable 'a' keeps the closing price of the first bar for each bar in the series.",`The variable 'b' keeps the closing price of the first "green" bar in the series.`,`The variable 'c' keeps the closing price of the tenth "green" bar in the series.`]}]},{name:"varip",desc:["**varip** (var intrabar persist) is the keyword used for the assignment and one-time initialization of a variable or a field of a user-defined [type](#op_type). It’s similar to the [var](#op_var) keyword, but variables and fields declared with [varip](#op_varip) retain their values between executions of the script on the same bar."],syntax:[`varip [<variable_type> ]<variable_name> = <expression>
79
+
80
+ [export ]type <UDT_identifier>
81
+ varip <field_type> <field_name> [= <value>]`],detailedDesc:[{desc:["where:","**variable_type** - An optional fundamental type ([int](#op_int), [float](#op_float), [bool](#op_bool), [color](#op_color), [string](#op_string)) or a user-defined type, or an array or matrix of one of those types. Special types are not compatible with this keyword.","**variable_name** - A [valid identifier](https://www.tradingview.com/pine-script-docs/en/v5/language/Identifiers.html). The variable can also be an object created from a UDT.","**expression** - Any arithmetic expression, just as when defining a regular variable. The expression will be calculated and assigned to the variable only once, on the first bar.","**UDT_identifier, field_type, field_name, value** - Constructs related to user-defined types as described in the [type](#op_type) section."],examples:["//@version=5",'indicator("varip")',"varip int v = -1","v := v + 1","plot(v)"]},{desc:["With [var](#op_var), `v` would equal the value of the [bar_index](#var_bar_index). On historical bars, where the script calculates only once per chart bar, the value of `v` is the same as with [var](#op_var). However, on realtime bars, the script will evaluate the expression on each new chart update, producing a different result."],examples:["//@version=5",'indicator("varip with types")',"type barData"," int index = -1"," varip int ticks = -1","","var currBar = barData.new()","currBar.index += 1","currBar.ticks += 1","","// Will be equal to bar_index on all bars","plot(currBar.index)","// In real time, will increment per every tick on the chart","plot(currBar.ticks)"]},{desc:["The same [+=](#op_+=) operation applied to both the `index` and `ticks` fields results in different real-time values because `ticks` increases on every chart update, while `index` only does so once per bar. Note how the `currBar` object does not use the [varip](#op_varip) keyword. The `ticks` field of the object can increment on every tick, but the reference itself is defined once and then stays unchanged. If we were to declare `currBar` using [varip](#op_varip), the behavior of `index` would remain unchanged because while the reference to the type instance would persist between chart updates, the `index` field of the object would not."]}],remarks:["When using [varip](#op_varip) to declare variables in strategies that may execute more than once per historical chart bar, the values of such variables are preserved across successive iterations of the script on the same bar.","The effect of [varip](#op_varip) eliminates the [rollback](https://www.tradingview.com/pine-script-docs/en/v5/language/Execution_model.html#calculation-based-on-realtime-bars) of variables before each successive execution of a script on the same bar."]},{name:"import",desc:["Used to load an external [library](#fun_library) into a script and bind its functions to a namespace. The importing script can be an indicator, a strategy, or another library. A library must be published (privately or publicly) before it can be imported."],args:[{name:"username",desc:"User name of the library's author.",displayType:"literal string"},{name:"libraryName",desc:"Name of the imported library, which corresponds to the `title` argument used by the author in his library script.",displayType:"literal string"},{name:"libraryVersion",desc:"Version number of the imported library.",displayType:"literal int"},{name:"alias",desc:"A non-numeric identifier used as a namespace to refer to the library's functions. Optional. The default is the `libraryName` string.",displayType:"literal string"}],syntax:["import {username}/{libraryName}/{libraryVersion} as {alias}"],examples:["//@version=5",'indicator("num_methods import")','// Import the first version of the username’s "num_methods" library and assign it to the "m" namespace",',"import username/num_methods/1 as m","// Call the “sinh()” function from the imported library","y = m.sinh(3.14)",'// Plot value returned by the "sinh()" function",',"plot(y)"],remarks:["Using an alias that replaces a built-in namespace such as math.* or strategy.* is allowed, but if the library contains function names that shadow Pine Script®'s built-in functions, the built-ins will become unavailable. The same version of a library can only be imported once. Aliases must be distinct for each imported library. When calling library functions, casting their arguments to types other than their declared type is not allowed. An import statement cannot use 'as' or 'import' as `username`, `libraryName`, or `alias` identifiers."],seeAlso:["[library](#fun_library)","[export](#op_export)"]},{name:"export",desc:["Used in libraries to prefix the declaration of functions or user-defined type definitions that will be available from other scripts importing the library."],examples:["//@version=5","//@description Library of debugging functions.",'library("Debugging_library", overlay = true)',"//@function Displays a string as a table cell for debugging purposes.","//@param txt String to display.","//@returns Void.","export print(string txt) => "," var table t = table.new(position.middle_right, 1, 1)"," table.cell(t, 0, 0, txt, bgcolor = color.yellow)","// Using the function from inside the library to show an example on the published chart.","// This has no impact on scripts using the library.",'print("Library Test")'],remarks:["Each library must have at least one exported function or user-defined type (UDT).","Exported functions cannot use variables from the global scope if they are arrays, mutable variables (reassigned with `:=`), or variables of 'input' form.","Exported functions cannot use `request.*()` functions.","Exported functions must explicitly declare each parameter's type and all parameters must be used in the function's body. By default, all arguments passed to exported functions are of the [series](#op_series) form, unless they are explicitly specified as [simple](#op_simple) in the function's signature.","The @description, @function, @param, @type, @field, and @returns compiler annotations are used to automatically generate the library's description and release notes, and in the Pine Script® Editor's tooltips."],seeAlso:["[library](#fun_library)","[import](#op_import)","[simple](#op_simple)","[series](#op_series)","[type](#op_type)"]},{name:"type",desc:["This keyword allows the declaration of user-defined types (UDT) from which scripts can instantiate objects. UDTs are composite types that contain an arbitrary number of fields of any built-in or user-defined type, including the defined UDT itself. The syntax to define a UDT is:"],syntax:[`[export ]type <UDT_identifier>
82
+ [varip ]<field_type> <field_name> [= <value>]
83
+ …`],detailedDesc:[{desc:["Once a UDT is defined, scripts can instantiate objects from it with the `UDT_identifier.new()` construct. When creating a new type instance, the fields of the resulting object will initialize with the default values from the UDT's definition. Any type fields without specified defaults will initialize as [na](#var_na). Alternatively, users can pass initial values as arguments in the `*.new()` method to override the type's defaults. For example, `newFooObject = foo.new(x = true)` assigns a new `foo` object to the `newFooObject` variable with its `x` field initialized using a value of [true](#var_true).","Field declarations can include the [varip](#op_varip) keyword, in which case the field values persist between successive script iterations on the same bar.","For more information see the User Manual's sections on [defining UDTs](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#user-defined-types) and [using objects](https://www.tradingview.com/pine-script-docs/en/v5/language/Objects.html).","Libraries can export UDTs. See the[Libraries](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Libraries.html#user-defined-types-and-objects) page of our User Manual to learn more."],examples:["//@version=5",'indicator("Multi Time Period Chart", overlay = true)',"",'timeframeInput = input.timeframe("1D")',"","type bar"," float o = open"," float h = high"," float l = low"," float c = close"," int t = time","","drawBox(bar b, right) =>"," bar s = bar.new()"," color boxColor = b.c >= b.o ? color.green : color.red"," box.new(b.t, b.h, right, b.l, boxColor, xloc = xloc.bar_time, bgcolor = color.new(boxColor, 90))","","updateBox(box boxId, bar b) =>"," color boxColor = b.c >= b.o ? color.green : color.red"," box.set_border_color(boxId, boxColor)"," box.set_bgcolor(boxId, color.new(boxColor, 90))"," box.set_top(boxId, b.h)"," box.set_bottom(boxId, b.l)"," box.set_right(boxId, time)","","secBar = request.security(syminfo.tickerid, timeframeInput, bar.new())","","if not na(secBar)"," // To avoid a runtime error, only process data when an object exists."," if not barstate.islast"," if timeframe.change(timeframeInput)"," // On historical bars, draw a new box in the past when the HTF closes."," drawBox(secBar, time[1])"," else"," var box lastBox = na"," if na(lastBox) or timeframe.change(timeframeInput)"," // On the last bar, only draw a new current box the first time we get there or when HTF changes."," lastBox := drawBox(secBar, time)"," else"," // On other chart updates, use setters to modify the current box."," updateBox(lastBox, secBar)"]}]},{name:"method",desc:["This keyword is used to prefix a function declaration, indicating it can then be invoked using dot notation by appending its name to a variable of the type of its first parameter and omitting that first parameter. Alternatively, functions declared as methods can also be invoked like normal user-defined functions. In that case, an argument must be supplied for its first parameter.","The first parameter of a method declaration must be explicitly typified."],syntax:[`[export] method <functionName>(<paramType> <paramName> [= <defaultValue>], …) =>
84
+ <functionBlock>`],examples:["//@version=5",'indicator("")',"","var prices = array.new<float>()","","//@function Pushes a new value into the array and removes the first one if the resulting array is greater than `maxSize`. Can be used as a method.","method maintainArray(array<float> id, maxSize, value) =>"," id.push(value)"," if id.size() > maxSize"," id.shift()","","prices.maintainArray(50, close)","// The method can also be called like a function, without using dot notation.","// In this case an argument must be supplied for its first parameter.","// maintainArray(prices, 50, close)","","// This calls the `array.avg()` built-in using dot notation with the `prices` array.","// It is possible because built-in functions belonging to some namespaces that are a special Pine type","// can be invoked with method notation when the function's first parameter is an ID of that type.","// Those namespaces are: `array`, `matrix`, `line`, `linefill`, `label`, `box`, and `table`.","plot(prices.avg())"]},{name:"else"},{name:"to"},{name:"by"},{name:"break"},{name:"continue"},{name:"as"},{name:"in"}],operators:[{name:"?:",desc:["Ternary conditional operator."],syntax:["expr1 ? expr2 : expr3"],examples:["//@version=5",'indicator("?:")',"// Draw circles at the bars where open crosses close","s2 = ta.cross(open, close) ? math.avg(open,close) : na","plot(s2, style=plot.style_circles, linewidth=2, color=color.red)","","// Combination of ?: operators for 'switch'-like logic","c = timeframe.isintraday ? color.red : timeframe.isdaily ? color.green : timeframe.isweekly ? color.blue : color.gray","plot(hl2, color=c)"],returns:["expr2 if expr1 is evaluated to true, expr3 otherwise. Zero value (0 and also NaN, +Infinity, -Infinity) is considered to be false, any other value is true."],remarks:["Use [na](#var_na) for 'else' branch if you do not need it.","You can combine two or more [?:](#op_?:) operators to achieve the equivalent of a 'switch'-like statement (see examples above).","You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."],seeAlso:["[na](#var_na)"]},{name:"+",desc:["Addition or unary plus. Applicable to numerical expressions or strings."],syntax:["expr1 + expr2"],returns:["Binary `+` for strings returns concatenation of expr1 and expr2","For numbers returns integer or float value, or series of values:","Binary `+` returns expr1 plus expr2.","Unary `+` returns expr (does nothing added just for the symmetry with the unary - operator)."],remarks:["You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."]},{name:"+",desc:["Addition or unary plus. Applicable to numerical expressions or strings."],syntax:["+ expr"],returns:["Binary `+` for strings returns concatenation of expr1 and expr2","For numbers returns integer or float value, or series of values:","Binary `+` returns expr1 plus expr2.","Unary `+` returns expr (does nothing added just for the symmetry with the unary - operator)."],remarks:["You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."]},{name:"-",desc:["Subtraction or unary minus. Applicable to numerical expressions."],syntax:["expr1 - expr2"],returns:["Returns integer or float value, or series of values:","Binary `-` returns expr1 minus expr2.","Unary `-` returns the negation of expr."],remarks:["You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."]},{name:"-",desc:["Subtraction or unary minus. Applicable to numerical expressions."],syntax:["- expr"],returns:["Returns integer or float value, or series of values:","Binary `-` returns expr1 minus expr2.","Unary `-` returns the negation of expr."],remarks:["You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."]},{name:"[]",desc:["Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down."],syntax:["expr1[expr2]"],examples:["//@version=5",'indicator("[]")','// [] can be used to "save" variable value between bars',"a = 0.0 // declare `a`","a := a[1] // immediately set current value to the same as previous. `na` in the beginning of history","if high == low // if some condition - change `a` value to another"," a := low","plot(a)"],returns:["A series of values."],seeAlso:["[math.floor](#fun_math.floor)"]},{name:":=",desc:["Reassignment operator. It is used to assign a new value to a previously declared variable."],syntax:["<var_name> := <new_value>"],examples:["//@version=5",'indicator("My script")',"","myVar = 10","","if close > open"," // Modifies the existing global scope `myVar` variable by changing its value from 10 to 20."," myVar := 20"," // Creates a new `myVar` variable local to the `if` condition and unreachable from the global scope."," // Does not affect the `myVar` declared in global scope."," myVar = 30","","plot(myVar)"]},{name:"==",desc:["Equal to. Applicable to expressions of any type."],syntax:["expr1 == expr2"],returns:["Boolean value, or series of boolean values."]},{name:"!=",desc:["Not equal to. Applicable to expressions of any type."],syntax:["expr1 != expr2"],returns:["Boolean value, or series of boolean values."]},{name:">",desc:["Greater than. Applicable to numerical expressions."],syntax:["expr1 > expr2"],returns:["Boolean value, or series of boolean values."]},{name:"<",desc:["Less than. Applicable to numerical expressions."],syntax:["expr1 < expr2"],returns:["Boolean value, or series of boolean values."]},{name:">=",desc:["Greater than or equal to. Applicable to numerical expressions."],syntax:["expr1 >= expr2"],returns:["Boolean value, or series of boolean values."]},{name:"<=",desc:["Less than or equal to. Applicable to numerical expressions."],syntax:["expr1 <= expr2"],returns:["Boolean value, or series of boolean values."]},{name:"*",desc:["Multiplication. Applicable to numerical expressions."],syntax:["expr1 * expr2"],returns:["Integer or float value, or series of values."]},{name:"/",desc:["Division. Applicable to numerical expressions."],syntax:["expr1 / expr2"],returns:["Integer or float value, or series of values."]},{name:"%",desc:["Modulo (integer remainder). Applicable to numerical expressions."],syntax:["expr1 % expr2"],returns:["Integer or float value, or series of values."],remarks:["In Pine Script®, when the integer remainder is calculated, the quotient is truncated, i.e. rounded towards the lowest absolute value. The resulting value will have the same sign as the dividend.","Example: -1 % 9 = -1 - 9 * truncate(-1/9) = -1 - 9 * truncate(-0.111) = -1 - 9 * 0 = -1."]},{name:"+=",desc:["Addition assignment. Applicable to numerical expressions or strings."],syntax:["expr1 += expr2"],examples:["//@version=5",'indicator("+=")',"// Equals to expr1 = expr1 + expr2.","a = 2","b = 3","a += b","// Result: a = 5.","plot(a)"],returns:["For strings returns concatenation of expr1 and expr2. For numbers returns integer or float value, or series of values."],remarks:["You may use arithmetic operators with numbers as well as with series variables. In case of usage with series the operators are applied elementwise."]},{name:"-=",desc:["Subtraction assignment. Applicable to numerical expressions."],syntax:["expr1 -= expr2"],examples:["//@version=5",'indicator("-=")',"// Equals to expr1 = expr1 - expr2.","a = 2","b = 3","a -= b","// Result: a = -1.","plot(a)"],returns:["Integer or float value, or series of values."]},{name:"*=",desc:["Multiplication assignment. Applicable to numerical expressions."],syntax:["expr1 *= expr2"],examples:["//@version=5",'indicator("*=")',"// Equals to expr1 = expr1 * expr2.","a = 2","b = 3","a *= b","// Result: a = 6.","plot(a)"],returns:["Integer or float value, or series of values."]},{name:"/=",desc:["Division assignment. Applicable to numerical expressions."],syntax:["expr1 /= expr2"],examples:["//@version=5",'indicator("/=")',"// Equals to expr1 = expr1 / expr2.","a = 3","b = 3","a /= b","// Result: a = 1.","plot(a)"],returns:["Integer or float value, or series of values."]},{name:"%=",desc:["Modulo assignment. Applicable to numerical expressions."],syntax:["expr1 %= expr2"],examples:["//@version=5",'indicator("%=")',"// Equals to expr1 = expr1 % expr2.","a = 3","b = 3","a %= b","// Result: a = 0.","plot(a)"],returns:["Integer or float value, or series of values."]},{name:"=>",desc:["The '=>' operator is used in user-defined function declarations and in [switch](#op_switch) statements.","The function declaration syntax is:"],syntax:[`<identifier>([<parameter_name>[=<default_value>]], ...) =>
85
+ <local_block>
86
+ <function_result>`],detailedDesc:[{desc:["A <local_block> is zero or more Pine Script® statements.","The <function_result> is a variable, an expression, or a tuple."],examples:["//@version=5",'indicator("=>")',"// single-line function","f1(x, y) => x + y","// multi-line function","f2(x, y) => "," sum = x + y"," sumChange = ta.change(sum, 10)"," // Function automatically returns the last expression used in it","plot(f1(30, 8) + f2(1, 3))"]}],remarks:["You can learn more about user-defined functions in the User Manual's pages on [Declaring functions](https://www.tradingview.com/pine-script-docs/en/v5/language/User-defined_functions.html) and [Libraries](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Libraries.html)."]}],variables:[{name:"session.isfirstbar",type:"series bool",desc:["Returns [true](#var_true) if the current bar is the first bar of the day's session, `false` otherwise. If extended session information is used, only returns [true](#var_true) on the first bar of the pre-market bars."]},{name:"session.islastbar",type:"series bool",desc:["Returns [true](#var_true) if the current bar is the last bar of the day's session, `false` otherwise. If extended session information is used, only returns [true](#var_true) on the last bar of the post-market bars."],remarks:["This variable is not guaranteed to return [true](#var_true) once in every session because the last bar of the session might not exist if no trades occur during what should be the session's last bar.","This variable is not guaranteed to work as expected on non-standard chart types, e.g., Renko."]},{name:"session.isfirstbar_regular",type:"series bool",desc:["Returns [true](#var_true) on the first regular session bar of the day, `false` otherwise. The result is the same whether extended session information is used or not."]},{name:"session.islastbar_regular",type:"series bool",desc:["Returns [true](#var_true) on the last regular session bar of the day, `false` otherwise. The result is the same whether extended session information is used or not."],remarks:["This variable is not guaranteed to return [true](#var_true) once in every session because the last bar of the session might not exist if no trades occur during what should be the session's last bar.","This variable is not guaranteed to work as expected on non-standard chart types, e.g., Renko."]},{name:"bar_index",type:"series int",desc:["Current bar index. Numbering is zero-based, index of the first bar is 0."],examples:["//@version=5",'indicator("bar_index")',"plot(bar_index)","plot(bar_index > 5000 ? close : 0)"],remarks:["Note that **bar_index** has replaced **n** variable in version 4.","Note that bar indexing starts from 0 on the first historical bar.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[last_bar_index](#var_last_bar_index)","[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.isrealtime](#var_barstate.isrealtime)"]},{name:"last_bar_index",type:"series int",desc:["Bar index of the last chart bar. Bar indices begin at zero on the first bar."],examples:["//@version=5",'strategy("Mark Last X Bars For Backtesting", overlay = true, calc_on_every_tick = true)','lastBarsFilterInput = input.int(100, "Bars Count:")',"// Here, we store the 'last_bar_index' value that is known from the beginning of the script's calculation.","// The 'last_bar_index' will change when new real-time bars appear, so we declare 'lastbar' with the 'var' keyword.","var lastbar = last_bar_index","// Check if the current bar_index is 'lastBarsFilterInput' removed from the last bar on the chart, or the chart is traded in real-time.","allowedToTrade = (lastbar - bar_index <= lastBarsFilterInput) or barstate.isrealtime","bgcolor(allowedToTrade ? color.new(color.green, 80) : na)"],returns:["Last historical bar index for closed markets, or the real-time bar index for open markets."],remarks:["Please note that using this variable can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[bar_index](#var_bar_index)","[last_bar_time](#var_last_bar_time)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)"]},{name:"last_bar_time",type:"series int",desc:["Time in UNIX format of the last chart bar. It is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],remarks:["Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html).","Note that this variable returns the timestamp based on the time of the bar's open."],seeAlso:["[time](#var_time)","[timenow](#var_timenow)","[timestamp](#fun_timestamp)","[last_bar_index](#var_last_bar_index)"]},{name:"na",type:"simple na",desc:['A keyword signifying "not available", indicating that a variable has no assigned value.'],examples:["//@version=5",'indicator("na")',"// CORRECT","// Plot no value when on bars zero to nine. Plot `close` on other bars.","plot(bar_index < 10 ? na : close)","// CORRECT ALTERNATIVE","// Initialize `a` to `na`. Reassign `close` to `a` on bars 10 and later.","float a = na","if bar_index >= 10"," a := close","plot(a)","","// INCORRECT","// Trying to test the preceding bar's `close` for `na`.","// Will not work correctly on bar zero, when `close[1]` is `na`.","plot(close[1] == na ? close : close[1])","// CORRECT","// Use the `na()` function to test for `na`.","plot(na(close[1]) ? close : close[1])","// CORRECT ALTERNATIVE","// `nz()` tests `close[1]` for `na`. It returns `close[1]` if it is not `na`, and `close` if it is.","plot(nz(close[1], close))"],remarks:["Do not use this variable with [comparison operators](https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#comparison-operators) to test values for `na`, as it might lead to unexpected behavior. Instead, use the [na](#fun_na) function. Note that `na` can be used to initialize variables when the initialization statement also specifies the variable's type."],seeAlso:["[na](#fun_na)","[nz](#fun_nz)","[fixnan](#fun_fixnan)"]},{name:"volume",type:"series float",desc:["Current bar volume."],remarks:["Previous values may be accessed with square brackets operator [], e.g. volume[1], volume[2]."],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[close](#var_close)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"open",type:"series float",desc:["Current open price."],remarks:["Previous values may be accessed with square brackets operator [], e.g. open[1], open[2]."],seeAlso:["[high](#var_high)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"high",type:"series float",desc:["Current high price."],remarks:["Previous values may be accessed with square brackets operator [], e.g. high[1], high[2]."],seeAlso:["[open](#var_open)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"low",type:"series float",desc:["Current low price."],remarks:["Previous values may be accessed with square brackets operator [], e.g. low[1], low[2]."],seeAlso:["[open](#var_open)","[high](#var_high)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"close",type:"series float",desc:["Close price of the current bar when it has closed, or last traded price of a yet incomplete, realtime bar."],remarks:["Previous values may be accessed with square brackets operator [], e.g. close[1], close[2]."],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"hl2",type:"series float",desc:["Is a shortcut for (high + low)/2"],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"hlc3",type:"series float",desc:["Is a shortcut for (high + low + close)/3"],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlcc4](#var_hlcc4)","[ohlc4](#var_ohlc4)"]},{name:"hlcc4",type:"series float",desc:["Is a shortcut for (high + low + close + close)/4"],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[ohlc4](#var_ohlc4)"]},{name:"ohlc4",type:"series float",desc:["Is a shortcut for (open + high + low + close)/4"],seeAlso:["[open](#var_open)","[high](#var_high)","[low](#var_low)","[close](#var_close)","[volume](#var_volume)","[time](#fun_time)","[hl2](#var_hl2)","[hlc3](#var_hlc3)","[hlcc4](#var_hlcc4)"]},{name:"ta.vwap",type:"series float",desc:["Volume Weighted Average Price. It uses [hlc3](#var_hlc3) as its source series."],seeAlso:["[ta.vwap](#fun_ta.vwap) (function)"]},{name:"ta.accdist",type:"series float",desc:["Accumulation/distribution index."]},{name:"ta.tr",type:"series float",desc:["True range, equivalent to `ta.tr(handle_na = false)`. It is calculated as `math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))`."],seeAlso:["[ta.tr](#fun_ta.tr)","[ta.atr](#fun_ta.atr)"]},{name:"ta.iii",type:"series float",desc:["Intraday Intensity Index."],examples:["//@version=5",'indicator("Intraday Intensity Index")',"plot(ta.iii, color=color.yellow)","","// the same on pine","f_iii() =>"," (2 * close - high - low) / ((high - low) * volume)","","plot(f_iii())"]},{name:"ta.wvad",type:"series float",desc:["Williams Variable Accumulation/Distribution."],examples:["//@version=5",'indicator("Williams Variable Accumulation/Distribution")',"plot(ta.wvad, color=color.yellow)","","// the same on pine","f_wvad() =>"," (close - open) / (high - low) * volume","","plot(f_wvad())"]},{name:"ta.wad",type:"series float",desc:["Williams Accumulation/Distribution."],examples:["//@version=5",'indicator("Williams Accumulation/Distribution")',"plot(ta.wad, color=color.yellow)","","// the same on pine","f_wad() =>"," trueHigh = math.max(high, close[1])"," trueLow = math.min(low, close[1])"," mom = ta.change(close)"," gain = (mom > 0) ? close - trueLow : (mom < 0) ? close - trueHigh : 0"," ta.cum(gain)","","plot(f_wad())"]},{name:"ta.obv",type:"series float",desc:["On Balance Volume."],examples:["//@version=5",'indicator("On Balance Volume")',"plot(ta.obv, color=color.yellow)","","// the same on pine","f_obv() =>"," ta.cum(math.sign(ta.change(close)) * volume)","","plot(f_obv())"]},{name:"ta.pvt",type:"series float",desc:["Price-Volume Trend."],examples:["//@version=5",'indicator("Price-Volume Trend")',"plot(ta.pvt, color=color.yellow)","","// the same on pine","f_pvt() =>"," ta.cum((ta.change(close) / close[1]) * volume)","","plot(f_pvt())"]},{name:"ta.nvi",type:"series float",desc:["Negative Volume Index."],examples:["//@version=5",'indicator("Negative Volume Index")',"","plot(ta.nvi, color=color.yellow)","","// the same on pine","f_nvi() =>"," float ta_nvi = 1.0"," float prevNvi = (nz(ta_nvi[1], 0.0) == 0.0) ? 1.0: ta_nvi[1]"," if nz(close, 0.0) == 0.0 or nz(close[1], 0.0) == 0.0"," ta_nvi := prevNvi"," else"," ta_nvi := (volume < nz(volume[1], 0.0)) ? prevNvi + ((close - close[1]) / close[1]) * prevNvi : prevNvi"," result = ta_nvi","","plot(f_nvi())"]},{name:"ta.pvi",type:"series float",desc:["Positive Volume Index."],examples:["//@version=5",'indicator("Positive Volume Index")',"","plot(ta.pvi, color=color.yellow)","","// the same on pine","f_pvi() =>"," float ta_pvi = 1.0"," float prevPvi = (nz(ta_pvi[1], 0.0) == 0.0) ? 1.0: ta_pvi[1]"," if nz(close, 0.0) == 0.0 or nz(close[1], 0.0) == 0.0"," ta_pvi := prevPvi"," else"," ta_pvi := (volume > nz(volume[1], 0.0)) ? prevPvi + ((close - close[1]) / close[1]) * prevPvi : prevPvi"," result = ta_pvi","","plot(f_pvi())"]},{name:"syminfo.ticker",type:"simple string",desc:["Symbol name without exchange prefix, e.g. 'MSFT'."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[timeframe.period](#var_timeframe.period)","[timeframe.multiplier](#var_timeframe.multiplier)","[syminfo.root](#var_syminfo.root)"]},{name:"syminfo.tickerid",type:"simple string",desc:['Returns the full form of the ticker ID representing a symbol, for use as an argument in functions with a `ticker` or `symbol` parameter. It always includes the prefix (exchange) and ticker separated by a colon ("NASDAQ:AAPL"), but it can also include other symbol data such as dividend adjustment, chart type, currency conversion, etc.'],remarks:[`Because the value of this variable does not always use a simple "prefix:ticker" format, it is a poor candidate for use in boolean comparisons or string manipulation functions. In those contexts, run the variable's result through [ticker.standard](#fun_ticker.standard) to purify it. This will remove any extraneous information and return a ticker ID consistently formatted using the "prefix:ticker" structure.`],seeAlso:["[ticker.new](#fun_ticker.new) (function)","[syminfo.ticker](#var_syminfo.ticker)","[timeframe.period](#var_timeframe.period)","[timeframe.multiplier](#var_timeframe.multiplier)","[syminfo.root](#var_syminfo.root)"]},{name:"syminfo.minmove",type:"simple int",desc:["Returns a whole number used to calculate the smallest increment between a symbol's price movements ([syminfo.mintick](#var_syminfo.mintick)). It is the numerator in the [syminfo.mintick](#var_syminfo.mintick) formula: `syminfo.minmove / syminfo.pricescale = syminfo.mintick`."],seeAlso:["[ticker.new](#fun_ticker.new) (function)","[syminfo.ticker](#var_syminfo.ticker)","[timeframe.period](#var_timeframe.period)","[timeframe.multiplier](#var_timeframe.multiplier)","[syminfo.root](#var_syminfo.root)"]},{name:"syminfo.pricescale",type:"simple int",desc:["Returns a whole number used to calculate the smallest increment between a symbol's price movements ([syminfo.mintick](#var_syminfo.mintick)). It is the denominator in the [syminfo.mintick](#var_syminfo.mintick) formula: `syminfo.minmove / syminfo.pricescale = syminfo.mintick`."],seeAlso:["[ticker.new](#fun_ticker.new) (function)","[syminfo.ticker](#var_syminfo.ticker)","[timeframe.period](#var_timeframe.period)","[timeframe.multiplier](#var_timeframe.multiplier)","[syminfo.root](#var_syminfo.root)"]},{name:"timeframe.period",type:"simple string",desc:[`A string representation of the chart's timeframe. The returned string's format is "[<quantity>][<units>]", where <quantity> and <units> are in some cases absent. <quantity> is the number of units, but it is absent if that number is 1. <unit> is "S" for seconds, "D" for days, "W" for weeks, "M" for months, but it is absent for minutes. No <unit> exists for hours.`,'The variable will return: "10S" for 10 seconds, "60" for 60 minutes, "D" for one day, "2W" for two weeks, "3M" for one quarter.',"Can be used as an argument with any function containing a `timeframe` parameter."],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)","[timeframe.multiplier](#var_timeframe.multiplier)"]},{name:"syminfo.root",type:"simple string",desc:["Root for derivatives like futures contract. For other symbols returns the same value as [syminfo.ticker](#var_syminfo.ticker)."],examples:["//@version=5",'indicator("syminfo.root")',"","// If the current chart symbol is continuous futures ('ES1!'), it would display 'ES'.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, syminfo.root)"],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)"]},{name:"syminfo.prefix",type:"simple string",desc:["Prefix of current symbol name (i.e. for 'CME_EOD:TICKER' prefix is 'CME_EOD')."],examples:["//@version=5",'indicator("syminfo.prefix")',"","// If current chart symbol is 'BATS:MSFT' then syminfo.prefix is 'BATS'.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, text=syminfo.prefix)"],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)"]},{name:"syminfo.mintick",type:"simple float",desc:["Min tick value for the current symbol."],seeAlso:["[syminfo.pointvalue](#var_syminfo.pointvalue)"]},{name:"syminfo.pointvalue",type:"simple float",desc:["Point value for the current symbol."],seeAlso:["[syminfo.mintick](#var_syminfo.mintick)"]},{name:"syminfo.session",type:"simple string",desc:["Session type of the chart main series. Possible values are [session.regular](#var_session.regular), [session.extended](#var_session.extended)."],seeAlso:["[session.regular](#var_session.regular)","[session.extended](#var_session.extended)."]},{name:"syminfo.timezone",type:"simple string",desc:["Timezone of the exchange of the chart main series. Possible values see in [timestamp](#fun_timestamp)."],seeAlso:["[timestamp](#fun_timestamp)"]},{name:"syminfo.description",type:"simple string",desc:["Description for the current symbol."],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.prefix](#var_syminfo.prefix)"]},{name:"syminfo.currency",type:"simple string",desc:["Currency for the current symbol. Returns currency code: 'USD', 'EUR', etc."],seeAlso:["[syminfo.basecurrency](#var_syminfo.basecurrency)","[syminfo.ticker](#var_syminfo.ticker)","[currency.USD](#var_currency.USD)","[currency.EUR](#var_currency.EUR)"]},{name:"syminfo.basecurrency",type:"simple string",desc:["Base currency for the symbol. For the symbol 'BTCUSD' returns 'BTC'."],seeAlso:["[syminfo.currency](#var_syminfo.currency)","[syminfo.ticker](#var_syminfo.ticker)"]},{name:"syminfo.type",type:"simple string",desc:['The type of market the symbol belongs to. The values are "stock", "fund", "dr", "right", "bond", "warrant", "structured", "index", "forex", "futures", "spread", "economic", "fundamental", "crypto", "spot", "swap", "option", "commodity".'],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)"]},{name:"syminfo.sector",type:"simple string",desc:[`Returns the sector of the symbol, or [na](#var_na) if the symbol has no sector. Example: "Electronic Technology", "Technology services", "Energy Minerals", "Consumer Durables", etc. These are the same values one can see in the chart's "Symbol info" window.`],remarks:['A sector is a broad section of the economy. An industry is a narrower classification. NASDAQ:CAT (Caterpillar, Inc.) for example, belongs to the "Producer Manufacturing" sector and the "Trucks/Construction/Farm Machinery" industry.']},{name:"syminfo.industry",type:"simple string",desc:[`Returns the industry of the symbol, or [na](#var_na) if the symbol has no industry. Example: "Internet Software/Services", "Packaged software", "Integrated Oil", "Motor Vehicles", etc. These are the same values one can see in the chart's "Symbol info" window.`],remarks:['A sector is a broad section of the economy. An industry is a narrower classification. NASDAQ:CAT (Caterpillar, Inc.) for example, belongs to the "Producer Manufacturing" sector and the "Trucks/Construction/Farm Machinery" industry.']},{name:"syminfo.country",type:"simple string",desc:['Returns the two-letter code of the country where the symbol is traded, in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format, or [na](#var_na) if the exchange is not directly tied to a specific country. For example, on "NASDAQ:AAPL" it will return "US", on "LSE:AAPL" it will return "GB", and on "BITSTAMP:BTCUSD it will return [na](#var_na).']},{name:"syminfo.volumetype",type:"simple string",desc:['Volume type of the current symbol. Possible values are: "base" for base currency, "quote" for quote currency, "tick" for the number of transactions, and "n/a" when there is no volume or its type is not specified.'],remarks:["Only some data feed suppliers provide information qualifying volume. As a result, the variable will return a value on some symbols only, mostly in the crypto sector."],seeAlso:["[syminfo.type](#var_syminfo.type)"]},{name:"syminfo.employees",type:"simple int",desc:["The number of employees the company has."],seeAlso:["[syminfo.shareholders](#var_syminfo.shareholders)","[syminfo.shares_outstanding_float](#var_syminfo.shares_outstanding_float)","[syminfo.shares_outstanding_total](#var_syminfo.shares_outstanding_total)"],examples:["//@version=5",'indicator("syminfo simple")',"//@variable A table containing information about a company's employees, shareholders, and shares.","var result_table = table.new(position = position.top_right, columns = 2, rows = 5, border_width = 1)","if barstate.islastconfirmedhistory"," // Add header cells",' table.cell(table_id = result_table, column = 0, row = 0, text = "name")',' table.cell(table_id = result_table, column = 1, row = 0, text = "value")'," // Add employee info cells.",' table.cell(table_id = result_table, column = 0, row = 1, text = "employees")'," table.cell(table_id = result_table, column = 1, row = 1, text = str.tostring(syminfo.employees))"," // Add shareholder cells.",' table.cell(table_id = result_table, column = 0, row = 2, text = "shareholders")'," table.cell(table_id = result_table, column = 1, row = 2, text = str.tostring(syminfo.shareholders))"," // Add float shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 3, text = "shares_outstanding_float")'," table.cell(table_id = result_table, column = 1, row = 3, text = str.tostring(syminfo.shares_outstanding_float))"," // Add total shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 4, text = "shares_outstanding_total")'," table.cell(table_id = result_table, column = 1, row = 4, text = str.tostring(syminfo.shares_outstanding_total))"]},{name:"syminfo.shareholders",type:"simple int",desc:["The number of shareholders the company has."],seeAlso:["[syminfo.employees](#var_syminfo.employees)","[syminfo.shares_outstanding_float](#var_syminfo.shares_outstanding_float)","[syminfo.shares_outstanding_total](#var_syminfo.shares_outstanding_total)"],examples:["//@version=5",'indicator("syminfo simple")',"//@variable A table containing information about a company's employees, shareholders, and shares.","var result_table = table.new(position = position.top_right, columns = 2, rows = 5, border_width = 1)","if barstate.islastconfirmedhistory"," // Add header cells",' table.cell(table_id = result_table, column = 0, row = 0, text = "name")',' table.cell(table_id = result_table, column = 1, row = 0, text = "value")'," // Add employee info cells.",' table.cell(table_id = result_table, column = 0, row = 1, text = "employees")'," table.cell(table_id = result_table, column = 1, row = 1, text = str.tostring(syminfo.employees))"," // Add shareholder cells.",' table.cell(table_id = result_table, column = 0, row = 2, text = "shareholders")'," table.cell(table_id = result_table, column = 1, row = 2, text = str.tostring(syminfo.shareholders))"," // Add float shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 3, text = "shares_outstanding_float")'," table.cell(table_id = result_table, column = 1, row = 3, text = str.tostring(syminfo.shares_outstanding_float))"," // Add total shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 4, text = "shares_outstanding_total")'," table.cell(table_id = result_table, column = 1, row = 4, text = str.tostring(syminfo.shares_outstanding_total))"]},{name:"syminfo.shares_outstanding_float",type:"simple float",desc:["The total number of shares outstanding a company has available, excluding any of its restricted shares."],seeAlso:["[syminfo.employees](#var_syminfo.employees)","[syminfo.shareholders](#var_syminfo.shareholders)","[syminfo.shares_outstanding_total](#var_syminfo.shares_outstanding_total)"],examples:["//@version=5",'indicator("syminfo simple")',"//@variable A table containing information about a company's employees, shareholders, and shares.","var result_table = table.new(position = position.top_right, columns = 2, rows = 5, border_width = 1)","if barstate.islastconfirmedhistory"," // Add header cells",' table.cell(table_id = result_table, column = 0, row = 0, text = "name")',' table.cell(table_id = result_table, column = 1, row = 0, text = "value")'," // Add employee info cells.",' table.cell(table_id = result_table, column = 0, row = 1, text = "employees")'," table.cell(table_id = result_table, column = 1, row = 1, text = str.tostring(syminfo.employees))"," // Add shareholder cells.",' table.cell(table_id = result_table, column = 0, row = 2, text = "shareholders")'," table.cell(table_id = result_table, column = 1, row = 2, text = str.tostring(syminfo.shareholders))"," // Add float shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 3, text = "shares_outstanding_float")'," table.cell(table_id = result_table, column = 1, row = 3, text = str.tostring(syminfo.shares_outstanding_float))"," // Add total shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 4, text = "shares_outstanding_total")'," table.cell(table_id = result_table, column = 1, row = 4, text = str.tostring(syminfo.shares_outstanding_total))"]},{name:"syminfo.shares_outstanding_total",type:"simple int",desc:["The total number of shares outstanding a company has available, including restricted shares held by insiders, major shareholders, and employees."],seeAlso:["[syminfo.employees](#var_syminfo.employees)","[syminfo.shareholders](#var_syminfo.shareholders)","[syminfo.shares_outstanding_float](#var_syminfo.shares_outstanding_float)"],examples:["//@version=5",'indicator("syminfo simple")',"//@variable A table containing information about a company's employees, shareholders, and shares.","var result_table = table.new(position = position.top_right, columns = 2, rows = 5, border_width = 1)","if barstate.islastconfirmedhistory"," // Add header cells",' table.cell(table_id = result_table, column = 0, row = 0, text = "name")',' table.cell(table_id = result_table, column = 1, row = 0, text = "value")'," // Add employee info cells.",' table.cell(table_id = result_table, column = 0, row = 1, text = "employees")'," table.cell(table_id = result_table, column = 1, row = 1, text = str.tostring(syminfo.employees))"," // Add shareholder cells.",' table.cell(table_id = result_table, column = 0, row = 2, text = "shareholders")'," table.cell(table_id = result_table, column = 1, row = 2, text = str.tostring(syminfo.shareholders))"," // Add float shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 3, text = "shares_outstanding_float")'," table.cell(table_id = result_table, column = 1, row = 3, text = str.tostring(syminfo.shares_outstanding_float))"," // Add total shares outstanding cells.",' table.cell(table_id = result_table, column = 0, row = 4, text = "shares_outstanding_total")'," table.cell(table_id = result_table, column = 1, row = 4, text = str.tostring(syminfo.shares_outstanding_total))"]},{name:"syminfo.target_price_average",type:"series float",desc:["The average of the last yearly price targets for the symbol predicted by analysts."],seeAlso:["[syminfo.target_price_date](#var_syminfo.target_price_date)","[syminfo.target_price_estimates](#var_syminfo.target_price_estimates)","[syminfo.target_price_high](#var_syminfo.target_price_high)","[syminfo.target_price_low](#var_syminfo.target_price_low)","[syminfo.target_price_median](#var_syminfo.target_price_median)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.target_price_date",type:"series int",desc:["The starting date of the last price target prediction for the current symbol."],seeAlso:["[syminfo.target_price_average](#var_syminfo.target_price_average)","[syminfo.target_price_estimates](#var_syminfo.target_price_estimates)","[syminfo.target_price_high](#var_syminfo.target_price_high)","[syminfo.target_price_low](#var_syminfo.target_price_low)","[syminfo.target_price_median](#var_syminfo.target_price_median)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.target_price_estimates",type:"series float",desc:["The latest total number of price target predictions for the current symbol."],seeAlso:["[syminfo.target_price_average](#var_syminfo.target_price_average)","[syminfo.target_price_date](#var_syminfo.target_price_date)","[syminfo.target_price_high](#var_syminfo.target_price_high)","[syminfo.target_price_low](#var_syminfo.target_price_low)","[syminfo.target_price_median](#var_syminfo.target_price_median)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.target_price_high",type:"series float",desc:["The last highest yearly price target for the symbol predicted by analysts."],seeAlso:["[syminfo.target_price_average](#var_syminfo.target_price_average)","[syminfo.target_price_date](#var_syminfo.target_price_date)","[syminfo.target_price_estimates](#var_syminfo.target_price_estimates)","[syminfo.target_price_low](#var_syminfo.target_price_low)","[syminfo.target_price_median](#var_syminfo.target_price_median)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.target_price_low",type:"series float",desc:["The last lowest yearly price target for the symbol predicted by analysts."],seeAlso:["[syminfo.target_price_average](#var_syminfo.target_price_average)","[syminfo.target_price_date](#var_syminfo.target_price_date)","[syminfo.target_price_estimates](#var_syminfo.target_price_estimates)","[syminfo.target_price_high](#var_syminfo.target_price_high)","[syminfo.target_price_median](#var_syminfo.target_price_median)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.target_price_median",type:"series float",desc:["The median of the last yearly price targets for the symbol predicted by analysts."],seeAlso:["[syminfo.target_price_average](#var_syminfo.target_price_average)","[syminfo.target_price_date](#var_syminfo.target_price_date)","[syminfo.target_price_estimates](#var_syminfo.target_price_estimates)","[syminfo.target_price_high](#var_syminfo.target_price_high)","[syminfo.target_price_low](#var_syminfo.target_price_low)"],examples:["//@version=5",'indicator("syminfo target_price")',"if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," //@variable A line connecting the current `close` to the highest yearly price estimate."," highLine = line.new(time, close, YTD, syminfo.target_price_high, color = color.green, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the lowest yearly price estimate."," lowLine = line.new(time, close, YTD, syminfo.target_price_low, color = color.red, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the median yearly price estimate."," medianLine = line.new(time, close, YTD, syminfo.target_price_median, color = color.gray, xloc = xloc.bar_time)"," //@variable A line connecting the current `close` to the average yearly price estimate."," averageLine = line.new(time, close, YTD, syminfo.target_price_average, color = color.orange, xloc = xloc.bar_time)"," // Fill the space between targets"," linefill.new(lowLine, medianLine, color.new(color.red, 90))"," linefill.new(medianLine, highLine, color.new(color.green, 90))"," // Create a label displaying the total number of analyst estimates.",' string estimatesText = str.format("Number of estimates: {0}", syminfo.target_price_estimates)'," label.new(bar_index, close, estimatesText, textcolor = color.white, size = size.large)"]},{name:"syminfo.recommendations_buy",type:"series int",desc:['The number of analysts who gave the current symbol a "Buy" rating.'],seeAlso:["[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_buy_strong",type:"series int",desc:['The number of analysts who gave the current symbol a "Strong Buy" rating.'],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_date",type:"series int",desc:["The starting date of the last set of recommendations for the current symbol."],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_hold",type:"series int",desc:['The number of analysts who gave the current symbol a "Hold" rating.'],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_total",type:"series int",desc:["The total number of recommendations for the current symbol."],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_sell",type:"series int",desc:['The number of analysts who gave the current symbol a "Sell" rating.'],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell_strong](#var_syminfo.recommendations_sell_strong)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"syminfo.recommendations_sell_strong",type:"series int",desc:['The number of analysts who gave the current symbol a "Strong Sell" rating.'],seeAlso:["[syminfo.recommendations_buy](#var_syminfo.recommendations_buy)","[syminfo.recommendations_buy_strong](#var_syminfo.recommendations_buy_strong)","[syminfo.recommendations_date](#var_syminfo.recommendations_date)","[syminfo.recommendations_hold](#var_syminfo.recommendations_hold)","[syminfo.recommendations_total](#var_syminfo.recommendations_total)","[syminfo.recommendations_sell](#var_syminfo.recommendations_sell)"],examples:["//@version=5",'indicator("syminfo recommendations", overlay = true)',"//@variable A table containing information about analyst recommendations.","var table ratings = table.new(position.top_right, 8, 2, frame_color = #000000)","if barstate.islastconfirmedhistory"," //@variable The time value one year from the date of the last analyst recommendations.",' int YTD = syminfo.target_price_date + timeframe.in_seconds("12M") * 1000'," // Add header cells.",' table.cell(ratings, 0, 0, "Start Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 1, 0, "End Date", bgcolor = color.gray, text_color = #000000, text_size = size.large)',' table.cell(ratings, 2, 0, "Buy", bgcolor = color.teal, text_color = #000000, text_size = size.large)',' table.cell(ratings, 3, 0, "Strong Buy", bgcolor = color.lime, text_color = #000000, text_size = size.large)',' table.cell(ratings, 4, 0, "Sell", bgcolor = color.maroon, text_color = #000000, text_size = size.large)',' table.cell(ratings, 5, 0, "Strong Sell", bgcolor = color.red, text_color = #000000, text_size = size.large)',' table.cell(ratings, 6, 0, "Hold", bgcolor = color.orange, text_color = #000000, text_size = size.large)',' table.cell(ratings, 7, 0, "Total", bgcolor = color.silver, text_color = #000000, text_size = size.large)'," // Recommendation strings",' string startDate = str.format_time(syminfo.recommendations_date, "yyyy-MM-dd")',' string endDate = str.format_time(YTD, "yyyy-MM-dd")'," string buyRatings = str.tostring(syminfo.recommendations_buy)"," string strongBuyRatings = str.tostring(syminfo.recommendations_buy_strong)"," string sellRatings = str.tostring(syminfo.recommendations_sell)"," string strongSellRatings = str.tostring(syminfo.recommendations_sell_strong)"," string holdRatings = str.tostring(syminfo.recommendations_hold)"," string totalRatings = str.tostring(syminfo.recommendations_total)"," // Add value cells"," table.cell(ratings, 0, 1, startDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 1, 1, endDate, bgcolor = color.gray, text_color = #000000, text_size = size.large)"," table.cell(ratings, 2, 1, buyRatings, bgcolor = color.teal, text_color = #000000, text_size = size.large)"," table.cell(ratings, 3, 1, strongBuyRatings, bgcolor = color.lime, text_color = #000000, text_size = size.large)"," table.cell(ratings, 4, 1, sellRatings, bgcolor = color.maroon, text_color = #000000, text_size = size.large)"]},{name:"timeframe.multiplier",type:"simple int",desc:["Multiplier of resolution, e.g. '60' - 60, 'D' - 1, '5D' - 5, '12M' - 12."],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)","[timeframe.period](#var_timeframe.period)"]},{name:"timeframe.isdwm",type:"simple bool",desc:["Returns true if current resolution is a daily or weekly or monthly resolution, false otherwise."],seeAlso:["[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.isweekly](#var_timeframe.isweekly)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timeframe.isintraday",type:"simple bool",desc:["Returns true if current resolution is an intraday (minutes or seconds) resolution, false otherwise."],seeAlso:["[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.isweekly](#var_timeframe.isweekly)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timeframe.isdaily",type:"simple bool",desc:["Returns true if current resolution is a daily resolution, false otherwise."],seeAlso:["[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isweekly](#var_timeframe.isweekly)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timeframe.isweekly",type:"simple bool",desc:["Returns true if current resolution is a weekly resolution, false otherwise."],seeAlso:["[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timeframe.ismonthly",type:"simple bool",desc:["Returns true if current resolution is a monthly resolution, false otherwise."],seeAlso:["[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.isweekly](#var_timeframe.isweekly)"]},{name:"timeframe.isminutes",type:"simple bool",desc:["Returns true if current resolution is a minutes resolution, false otherwise."],seeAlso:["[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isseconds](#var_timeframe.isseconds)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.isweekly](#var_timeframe.isweekly)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timeframe.isseconds",type:"simple bool",desc:["Returns true if current resolution is a seconds resolution, false otherwise."],seeAlso:["[timeframe.isdwm](#var_timeframe.isdwm)","[timeframe.isintraday](#var_timeframe.isintraday)","[timeframe.isminutes](#var_timeframe.isminutes)","[timeframe.isdaily](#var_timeframe.isdaily)","[timeframe.isweekly](#var_timeframe.isweekly)","[timeframe.ismonthly](#var_timeframe.ismonthly)"]},{name:"timenow",type:"series int",desc:["Current time in UNIX format. It is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],remarks:["Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[timestamp](#fun_timestamp)","[time](#var_time) (variable)","[time_close](#var_time_close)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"time",type:"series int",desc:["Current bar time in UNIX format. It is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],remarks:["Note that this variable returns the timestamp based on the time of the bar's open. Because of that, for overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this variable can return time before the specified date of the trading day. For example, on EURUSD, `dayofmonth(time)` can be lower by 1 than the date of the trading day, because the bar for the current day actually opens one day prior."],seeAlso:["[time](#fun_time) (function)","[time_close](#var_time_close)","[timenow](#var_timenow)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"time_close",type:"series int",desc:["The time of the current bar's close in UNIX format. It represents the number of milliseconds elapsed since 00:00:00 UTC, 1 January 1970. On non-standard price-based chart types (Renko, Line break, Kagi, Point & Figure, and Range), this variable returns [na](#var_na) on the chart's realtime bars."],seeAlso:["[time](#var_time)","[timenow](#var_timenow)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"time_tradingday",type:"series int",desc:["The beginning time of the trading day the current bar belongs to, in UNIX format (the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970)."],remarks:["The variable is useful for overnight sessions, where the current day's session can start on the previous calendar day (e.g., on EURUSD the Monday session will start on Sunday, 17:00). Unlike `time`, which would return the timestamp for Sunday at 17:00 for the Monday daily bar, `time_tradingday` will return the timestamp for Monday, 00:00.","When used on timeframes higher than 1D, `time_tradingday` returns the trading day of the last day inside the bar (e.g. on 1W, it will return the last trading day of the week)."],seeAlso:["[time](#var_time)","[time_close](#var_time_close)"]},{name:"year",type:"series int",desc:["Current bar year in exchange timezone."],remarks:["Note that this variable returns the year based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the year of the trading day."],seeAlso:["[year](#fun_year) (function)","[time](#var_time)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"month",type:"series int",desc:["Current bar month in exchange timezone."],remarks:["Note that this variable returns the month based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the month of the trading day."],seeAlso:["[month](#fun_month) (function)","[time](#var_time)","[year](#var_year)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"weekofyear",type:"series int",desc:["Week number of current bar time in exchange timezone."],remarks:["Note that this variable returns the week based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the week of the trading day."],seeAlso:["[weekofyear](#fun_weekofyear) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"dayofmonth",type:"series int",desc:["Date of current bar time in exchange timezone."],remarks:["Note that this variable returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day."],seeAlso:["[dayofmonth](#fun_dayofmonth) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"dayofweek",type:"series int",desc:["Day of week for current bar time in exchange timezone."],remarks:["Note that this variable returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day.","You can use [dayofweek.sunday](#var_dayofweek.sunday), [dayofweek.monday](#var_dayofweek.monday), [dayofweek.tuesday](#var_dayofweek.tuesday), [dayofweek.wednesday](#var_dayofweek.wednesday), [dayofweek.thursday](#var_dayofweek.thursday), [dayofweek.friday](#var_dayofweek.friday) and [dayofweek.saturday](#var_dayofweek.saturday) variables for comparisons."],seeAlso:["[dayofweek](#fun_dayofweek) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[hour](#var_hour)","[minute](#var_minute)","[second](#var_second)"]},{name:"hour",type:"series int",desc:["Current bar hour in exchange timezone."],seeAlso:["[hour](#fun_hour) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[minute](#var_minute)","[second](#var_second)"]},{name:"minute",type:"series int",desc:["Current bar minute in exchange timezone."],seeAlso:["[minute](#fun_minute) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[second](#var_second)"]},{name:"second",type:"series int",desc:["Current bar second in exchange timezone."],seeAlso:["[second](#fun_second) (function)","[time](#var_time)","[year](#var_year)","[month](#var_month)","[weekofyear](#var_weekofyear)","[dayofmonth](#var_dayofmonth)","[dayofweek](#var_dayofweek)","[hour](#var_hour)","[minute](#var_minute)"]},{name:"strategy.position_size",type:"series float",desc:["Direction and size of the current market position. If the value is > 0, the market position is long. If the value is < 0, the market position is short. The absolute value is the number of contracts/shares/lots/units in trade (position size)."],seeAlso:["[strategy.position_avg_price](#var_strategy.position_avg_price)"]},{name:"strategy.position_avg_price",type:"series float",desc:["Average entry price of current market position. If the market position is flat, 'NaN' is returned."],seeAlso:["[strategy.position_size](#var_strategy.position_size)"]},{name:"strategy.openprofit",type:"series float",desc:["Current unrealized profit or loss for all open positions."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.position_size](#var_strategy.position_size)"]},{name:"strategy.netprofit",type:"series float",desc:["Total currency value of all completed trades."],seeAlso:["[strategy.openprofit](#var_strategy.openprofit)","[strategy.position_size](#var_strategy.position_size)","[strategy.grossprofit](#var_strategy.grossprofit)","[strategy.grossloss](#var_strategy.grossloss)"]},{name:"strategy.equity",type:"series float",desc:["Current equity ([strategy.initial_capital](#var_strategy.initial_capital) + [strategy.netprofit](#var_strategy.netprofit) + [strategy.openprofit](#var_strategy.openprofit))."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.openprofit](#var_strategy.openprofit)","[strategy.position_size](#var_strategy.position_size)"]},{name:"strategy.position_entry_name",type:"series string",desc:["Name of the order that initially opened current market position."],seeAlso:["[strategy.position_size](#var_strategy.position_size)"]},{name:"strategy.grossprofit",type:"series float",desc:["Total currency value of all completed winning trades."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.grossloss](#var_strategy.grossloss)"]},{name:"strategy.grossloss",type:"series float",desc:["Total currency value of all completed losing trades."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.grossprofit](#var_strategy.grossprofit)"]},{name:"strategy.max_drawdown",type:"series float",desc:["Maximum equity drawdown value for the whole trading interval."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.equity](#var_strategy.equity)","[strategy.max_runup](#var_strategy.max_runup)"]},{name:"strategy.max_runup",type:"series float",desc:["Maximum equity run-up value for the whole trading interval."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)","[strategy.equity](#var_strategy.equity)","[strategy.max_drawdown](#var_strategy.max_drawdown)"]},{name:"strategy.grossloss_percent",type:"series float",desc:["The total value of all completed losing trades, expressed as a percentage of the initial capital."],seeAlso:["[strategy.grossloss](#var_strategy.grossloss)"]},{name:"strategy.max_runup_percent",type:"series float",desc:["The maximum equity run-up value for the whole trading interval, expressed as a percentage and calculated by formula: `Highest Value During Trade / (Entry Price x Quantity) * 100`."],seeAlso:["[strategy.max_runup](#var_strategy.max_runup)"]},{name:"strategy.netprofit_percent",type:"series float",desc:["The total value of all completed trades, expressed as a percentage of the initial capital."],seeAlso:["[strategy.netprofit](#var_strategy.netprofit)"]},{name:"strategy.openprofit_percent",type:"series float",desc:["The current unrealized profit or loss for all open positions, expressed as a percentage and calculated by formula: `openPL / realizedEquity * 100`."],seeAlso:["[strategy.openprofit](#var_strategy.openprofit)"]},{name:"strategy.grossprofit_percent",type:"series float",desc:["The total currency value of all completed winning trades, expressed as a percentage of the initial capital."],seeAlso:["[strategy.grossprofit](#var_strategy.grossprofit)"]},{name:"strategy.max_drawdown_percent",type:"series float",desc:["The maximum equity drawdown value for the whole trading interval, expressed as a percentage and calculated by formula: `Lowest Value During Trade / (Entry Price x Quantity) * 100`."],seeAlso:["[strategy.max_drawdown](#var_strategy.max_drawdown)"]},{name:"strategy.max_contracts_held_all",type:"series float",desc:["Maximum number of contracts/shares/lots/units in one trade for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.max_contracts_held_long](#var_strategy.max_contracts_held_long)","[strategy.max_contracts_held_short](#var_strategy.max_contracts_held_short)"]},{name:"strategy.max_contracts_held_long",type:"series float",desc:["Maximum number of contracts/shares/lots/units in one long trade for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.max_contracts_held_all](#var_strategy.max_contracts_held_all)","[strategy.max_contracts_held_short](#var_strategy.max_contracts_held_short)"]},{name:"strategy.max_contracts_held_short",type:"series float",desc:["Maximum number of contracts/shares/lots/units in one short trade for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.max_contracts_held_all](#var_strategy.max_contracts_held_all)","[strategy.max_contracts_held_long](#var_strategy.max_contracts_held_long)"]},{name:"strategy.opentrades",type:"series int",desc:["Number of market position entries, which were not closed and remain opened. If there is no open market position, 0 is returned."],seeAlso:["[strategy.position_size](#var_strategy.position_size)"]},{name:"strategy.closedtrades",type:"series int",desc:["Number of trades, which were closed for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.opentrades](#var_strategy.opentrades)","[strategy.wintrades](#var_strategy.wintrades)","[strategy.losstrades](#var_strategy.losstrades)","[strategy.eventrades](#var_strategy.eventrades)"]},{name:"strategy.wintrades",type:"series int",desc:["Number of profitable trades for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.opentrades](#var_strategy.opentrades)","[strategy.closedtrades](#var_strategy.closedtrades)","[strategy.losstrades](#var_strategy.losstrades)","[strategy.eventrades](#var_strategy.eventrades)"]},{name:"strategy.losstrades",type:"series int",desc:["Number of unprofitable trades for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.opentrades](#var_strategy.opentrades)","[strategy.closedtrades](#var_strategy.closedtrades)","[strategy.wintrades](#var_strategy.wintrades)","[strategy.eventrades](#var_strategy.eventrades)"]},{name:"strategy.eventrades",type:"series int",desc:["Number of breakeven trades for the whole trading interval."],seeAlso:["[strategy.position_size](#var_strategy.position_size)","[strategy.opentrades](#var_strategy.opentrades)","[strategy.closedtrades](#var_strategy.closedtrades)","[strategy.wintrades](#var_strategy.wintrades)","[strategy.losstrades](#var_strategy.losstrades)"]},{name:"strategy.initial_capital",type:"series float",desc:["The amount of initial capital set in the strategy properties."],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.account_currency",type:"simple string",desc:["Returns the currency used to calculate results, which can be set in the strategy's properties."],seeAlso:["[strategy](#fun_strategy)","[strategy.convert_to_account](#fun_strategy.convert_to_account)","[strategy.convert_to_symbol](#fun_strategy.convert_to_symbol)"]},{name:"strategy.long",type:"const strategy_direction",desc:["Long position entry."],seeAlso:["[strategy.entry](#fun_strategy.entry)","[strategy.exit](#fun_strategy.exit)","[strategy.order](#fun_strategy.order)"]},{name:"strategy.short",type:"const strategy_direction",desc:["Short position entry."],seeAlso:["[strategy.entry](#fun_strategy.entry)","[strategy.exit](#fun_strategy.exit)","[strategy.order](#fun_strategy.order)"]},{name:"strategy.margin_liquidation_price",type:"series float",desc:["When margin is used in a strategy, returns the price point where a simulated margin call will occur and liquidate enough of the position to meet the margin requirements."],remarks:["The variable returns [na](#var_na) if the strategy does not use margin, i.e., the [strategy](#fun_strategy) declaration statement does not specify an argument for the `margin_long` or `margin_short` parameter."],examples:["//@version=5",'strategy("Margin call management", overlay = true, margin_long = 25, margin_short = 25, '," default_qty_type = strategy.percent_of_equity, default_qty_value = 395)","","float maFast = ta.sma(close, 14)","float maSlow = ta.sma(close, 28)","","if ta.crossover(maFast, maSlow)",' strategy.entry("Long", strategy.long)',"","if ta.crossunder(maFast, maSlow)",' strategy.entry("Short", strategy.short)',"","changePercent(v1, v2) => "," float result = (v1 - v2) * 100 / math.abs(v2)","","// exit when we're 10% away from a margin call, to prevent it.","if math.abs(changePercent(close, strategy.margin_liquidation_price)) <= 10",' strategy.close("Long")',' strategy.close("Short")']},{name:"barstate.isfirst",type:"series bool",desc:["Returns true if current bar is first bar in barset, false otherwise."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.islast](#var_barstate.islast)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isnew](#var_barstate.isnew)","[barstate.isconfirmed](#var_barstate.isconfirmed)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.islast",type:"series bool",desc:["Returns true if current bar is the last bar in barset, false otherwise. This condition is true for all real-time bars in barset."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isnew](#var_barstate.isnew)","[barstate.isconfirmed](#var_barstate.isconfirmed)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.ishistory",type:"series bool",desc:["Returns true if current bar is a historical bar, false otherwise."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isnew](#var_barstate.isnew)","[barstate.isconfirmed](#var_barstate.isconfirmed)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.isrealtime",type:"series bool",desc:["Returns true if current bar is a real-time bar, false otherwise."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isnew](#var_barstate.isnew)","[barstate.isconfirmed](#var_barstate.isconfirmed)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.isnew",type:"series bool",desc:["Returns true if script is currently calculating on new bar, false otherwise. This variable is true when calculating on historical bars or on first update of a newly generated real-time bar."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isconfirmed](#var_barstate.isconfirmed)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.isconfirmed",type:"series bool",desc:["Returns true if the script is calculating the last (closing) update of the current bar. The next script calculation will be on the new bar data."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","It is NOT recommended to use [barstate.isconfirmed](#var_barstate.isconfirmed) in [request.security](#fun_request.security) expression. Its value requested from [request.security](#fun_request.security) is unpredictable.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isnew](#var_barstate.isnew)","[barstate.islastconfirmedhistory](#var_barstate.islastconfirmedhistory)"]},{name:"barstate.islastconfirmedhistory",type:"series bool",desc:["Returns true 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 false otherwise."],remarks:["Pine Script® code that uses this variable could calculate differently on history and real-time data.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[barstate.isfirst](#var_barstate.isfirst)","[barstate.islast](#var_barstate.islast)","[barstate.ishistory](#var_barstate.ishistory)","[barstate.isrealtime](#var_barstate.isrealtime)","[barstate.isnew](#var_barstate.isnew)"]},{name:"session.ismarket",type:"series bool",desc:["Returns true if the current bar is a part of the regular trading hours (i.e. market hours), false otherwise"],seeAlso:["[session.ispremarket](#var_session.ispremarket)","[session.ispostmarket](#var_session.ispostmarket)"]},{name:"session.ispremarket",type:"series bool",desc:["Returns true if the current bar is a part of the pre-market, false otherwise. On non-intraday charts always returns false."],seeAlso:["[session.ismarket](#var_session.ismarket)","[session.ispostmarket](#var_session.ispostmarket)"]},{name:"session.ispostmarket",type:"series bool",desc:["Returns true if the current bar is a part of the post-market, false otherwise. On non-intraday charts always returns false."],seeAlso:["[session.ismarket](#var_session.ismarket)","[session.ispremarket](#var_session.ispremarket)"]},{name:"label.all",type:"label[]",desc:["Returns an array filled with all the current labels drawn by the script."],examples:["//@version=5",'indicator("label.all")',"//delete all labels","label.new(bar_index, close)","a_allLabels = label.all","if array.size(a_allLabels) > 0"," for i = 0 to array.size(a_allLabels) - 1"," label.delete(array.get(a_allLabels, i))"],remarks:["The array is read-only. Index zero of the array is the ID of the oldest object on the chart."],seeAlso:["[label.new](#fun_label.new)","[line.all](#var_line.all)","[box.all](#var_box.all)","[table.all](#var_table.all)."]},{name:"line.all",type:"line[]",desc:["Returns an array filled with all the current lines drawn by the script."],examples:["//@version=5",'indicator("line.all")',"//delete all lines","line.new(bar_index - 10, close, bar_index, close)","a_allLines = line.all","if array.size(a_allLines) > 0"," for i = 0 to array.size(a_allLines) - 1"," line.delete(array.get(a_allLines, i))"],remarks:["The array is read-only. Index zero of the array is the ID of the oldest object on the chart."],seeAlso:["[line.new](#fun_line.new)","[label.all](#var_label.all)","[box.all](#var_box.all)","[table.all](#var_table.all)."]},{name:"linefill.all",type:"linefill[]",desc:["Returns an array filled with all the current linefill objects drawn by the script."],remarks:["The array is read-only. Index zero of the array is the ID of the oldest object on the chart."]},{name:"box.all",type:"box[]",desc:["Returns an array filled with all the current boxes drawn by the script."],examples:["//@version=5",'indicator("box.all")',"//delete all boxes","box.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, border_style=line.style_dashed)","a_allBoxes = box.all","if array.size(a_allBoxes) > 0"," for i = 0 to array.size(a_allBoxes) - 1"," box.delete(array.get(a_allBoxes, i))"],remarks:["The array is read-only. Index zero of the array is the ID of the oldest object on the chart."],seeAlso:["[box.new](#fun_box.new)","[line.all](#var_line.all)","[label.all](#var_label.all)","[table.all](#var_table.all)."]},{name:"table.all",type:"table[]",desc:["Returns an array filled with all the current tables drawn by the script."],examples:["//@version=5",'indicator("table.all")',"//delete all tables","table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)","a_allTables = table.all","if array.size(a_allTables) > 0"," for i = 0 to array.size(a_allTables) - 1"," table.delete(array.get(a_allTables, i))"],remarks:["The array is read-only. Index zero of the array is the ID of the oldest object on the chart."],seeAlso:["[table.new](#fun_table.new)","[line.all](#var_line.all)","[label.all](#var_label.all)","[box.all](#var_box.all)."]},{name:"chart.bg_color",type:"input color",desc:[`Returns the color of the chart's background from the "Chart settings/Appearance/Background" field. When a gradient is selected, the middle point of the gradient is returned.`],seeAlso:["[chart.fg_color](#var_chart.fg_color)"]},{name:"chart.fg_color",type:"input color",desc:["Returns a color providing optimal contrast with [chart.bg_color](#var_chart.bg_color)."],seeAlso:["[chart.bg_color](#var_chart.bg_color)"]},{name:"chart.left_visible_bar_time",type:"input int",desc:["The [time](#var_time) of the leftmost bar currently visible on the chart."],remarks:["Scripts using this variable will automatically re-execute when its value updates to reflect changes in the chart, which can be caused by users scrolling the chart, or new real-time bars.","Alerts created on a script that includes this variable will only use the value assigned to the variable at the moment of the alert's creation, regardless of whether the value changes afterward, which may lead to repainting."],seeAlso:["[chart.right_visible_bar_time](#var_chart.right_visible_bar_time)"]},{name:"chart.right_visible_bar_time",type:"input int",desc:["The [time](#var_time) of the rightmost bar currently visible on the chart."],remarks:["Scripts using this variable will automatically re-execute when its value updates to reflect changes in the chart, which can be caused by users scrolling the chart, or new real-time bars.","Alerts created on a script that includes this variable will only use the value assigned to the variable at the moment of the alert's creation, regardless of whether the value changes afterward, which may lead to repainting."],seeAlso:["[chart.left_visible_bar_time](#var_chart.left_visible_bar_time)"]},{name:"chart.is_heikinashi",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Heikin Ashi, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_range](#var_chart.is_range)"]},{name:"chart.is_renko",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Renko, [false](#var_false) otherwise."],seeAlso:["[chart.is_heikinashi](#var_chart.is_heikinashi)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_range](#var_chart.is_range)"]},{name:"chart.is_linebreak",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Line break, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_heikinashi](#var_chart.is_heikinashi)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_range](#var_chart.is_range)"]},{name:"chart.is_kagi",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Kagi, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_heikinashi](#var_chart.is_heikinashi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_range](#var_chart.is_range)"]},{name:"chart.is_pnf",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Point & figure, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_heikinashi](#var_chart.is_heikinashi)","[chart.is_range](#var_chart.is_range)"]},{name:"chart.is_range",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is Range, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_heikinashi](#var_chart.is_heikinashi)"]},{name:"chart.is_standard",type:"simple bool",returns:["Returns [true](#var_true) if the chart type is bars, candles, hollow candles, line, area or baseline, [false](#var_false) otherwise."],seeAlso:["[chart.is_renko](#var_chart.is_renko)","[chart.is_linebreak](#var_chart.is_linebreak)","[chart.is_kagi](#var_chart.is_kagi)","[chart.is_pnf](#var_chart.is_pnf)","[chart.is_range](#var_chart.is_range)","[chart.is_heikinashi](#var_chart.is_heikinashi)"]},{name:"earnings.future_time",type:"series int",desc:["Returns a UNIX timestamp indicating the expected time of the next earnings report, or [na](#var_na) if this data isn't available."],returns:["UNIX time, expressed in milliseconds."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"earnings.future_period_end_time",type:"series int",desc:["Checks the data for the next earnings report and returns the UNIX timestamp of the day when the financial period covered by those earnings ends, or [na](#var_na) if this data isn't available."],returns:["UNIX time, expressed in milliseconds."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"earnings.future_eps",type:"series float",desc:["Returns the estimated Earnings per Share of the next earnings report in the currency of the instrument, or [na](#var_na) if this data isn't available."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"earnings.future_revenue",type:"series float",desc:["Returns the estimated Revenue of the next earnings report in the currency of the instrument, or [na](#var_na) if this data isn't available."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"polyline.all",type:"polyline[]",desc:["Returns an array containing all current [polyline](#op_polyline) instances drawn by the script."],remarks:["The array is read-only. Index zero of the array references the ID of the oldest polyline object on the chart."]}],constants:[{name:"math.pi",type:"const float",desc:["Is a named constant for [Archimedes' constant](https://en.wikipedia.org/wiki/Pi). It is equal to 3.1415926535897932."],seeAlso:["[math.e](#var_math.e)","[math.phi](#var_math.phi)","[math.rphi](#var_math.rphi)"]},{name:"math.phi",type:"const float",desc:["Is a named constant for the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio). It is equal to 1.6180339887498948."],seeAlso:["[math.e](#var_math.e)","[math.pi](#var_math.pi)","[math.rphi](#var_math.rphi)"]},{name:"math.rphi",type:"const float",desc:["Is a named constant for the [golden ratio conjugate](https://en.wikipedia.org/wiki/Golden_ratio#Golden_ratio_conjugate). It is equal to 0.6180339887498948."],seeAlso:["[math.e](#var_math.e)","[math.pi](#var_math.pi)","[math.phi](#var_math.phi)"]},{name:"math.e",type:"const float",desc:["Is a named constant for [Euler's number](https://en.wikipedia.org/wiki/E_(mathematical_constant)). It is equal to 2.7182818284590452."],seeAlso:["[math.phi](#var_math.phi)","[math.pi](#var_math.pi)","[math.rphi](#var_math.rphi)"]},{name:"session.regular",type:"const string",desc:["Constant for regular session type (no extended hours data)."],seeAlso:["[session.extended](#var_session.extended)","[syminfo.session](#var_syminfo.session)"]},{name:"session.extended",type:"const string",desc:["Constant for extended session type (with extended hours data)."],seeAlso:["[session.regular](#var_session.regular)","[syminfo.session](#var_syminfo.session)"]},{name:"adjustment.none",type:"const string",desc:["Constant for none adjustment type (no adjustment is applied)."],seeAlso:["[adjustment.splits](#var_adjustment.splits)","[adjustment.dividends](#var_adjustment.dividends)","[ticker.new](#fun_ticker.new)"]},{name:"adjustment.splits",type:"const string",desc:["Constant for splits adjustment type (splits adjustment is applied)."],seeAlso:["[adjustment.none](#var_adjustment.none)","[adjustment.dividends](#var_adjustment.dividends)","[ticker.new](#fun_ticker.new)"]},{name:"adjustment.dividends",type:"const string",desc:["Constant for dividends adjustment type (dividends adjustment is applied)."],seeAlso:["[adjustment.none](#var_adjustment.none)","[adjustment.splits](#var_adjustment.splits)","[ticker.new](#fun_ticker.new)"]},{name:"hline.style_solid",type:"const hline_style",desc:["Is a named constant for solid linestyle of [hline](#fun_hline) function."],seeAlso:["[hline.style_dotted](#var_hline.style_dotted)","[hline.style_dashed](#var_hline.style_dashed)"]},{name:"hline.style_dotted",type:"const hline_style",desc:["Is a named constant for dotted linestyle of [hline](#fun_hline) function."],seeAlso:["[hline.style_solid](#var_hline.style_solid)","[hline.style_dashed](#var_hline.style_dashed)"]},{name:"hline.style_dashed",type:"const hline_style",desc:["Is a named constant for dashed linestyle of [hline](#fun_hline) function."],seeAlso:["[hline.style_solid](#var_hline.style_solid)","[hline.style_dotted](#var_hline.style_dotted)"]},{name:"position.top_left",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the upper-left edge."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.top_center",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the top edge in the center."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.top_right",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the upper-right edge."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.middle_left",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the left side of the screen."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.middle_center",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the center of the screen."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.middle_right",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the right side of the screen."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.bottom_left",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the bottom left of the screen."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.bottom_center",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the bottom edge in the center."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left), [position.bottom_right](#var_position.bottom_right)"]},{name:"position.bottom_right",type:"const string",desc:["Table position is used in [table.new](#fun_table.new), [table.cell](#fun_table.cell) functions.","Binds the table to the bottom right of the screen."],seeAlso:["[table.new](#fun_table.new)","[table.cell](#fun_table.cell)","[table.set_position](#fun_table.set_position)","[position.top_left](#var_position.top_left)","[position.top_center](#var_position.top_center)","[position.top_right](#var_position.top_right)","[position.middle_left](#var_position.middle_left)","[position.middle_center](#var_position.middle_center)","[position.middle_right](#var_position.middle_right)","[position.bottom_left](#var_position.bottom_left)","[position.bottom_center](#var_position.bottom_center)"]},{name:"size.auto",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape automatically adapts to the size of the bars."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.large](#var_size.large)","[size.huge](#var_size.huge)"]},{name:"size.tiny",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape constantly tiny."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.auto](#var_size.auto)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.large](#var_size.large)","[size.huge](#var_size.huge)"]},{name:"size.small",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape constantly small."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.normal](#var_size.normal)","[size.large](#var_size.large)","[size.huge](#var_size.huge)"]},{name:"size.normal",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape constantly normal."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.large](#var_size.large)","[size.huge](#var_size.huge)"]},{name:"size.large",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape constantly large."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.huge](#var_size.huge)"]},{name:"size.huge",type:"const string",desc:["Size value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. The size of the shape constantly huge."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[label.set_size](#fun_label.set_size)","[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.large](#var_size.large)"]},{name:"plot.style_line",type:"const plot_style",desc:["A named constant for the 'Line' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_linebr",type:"const plot_style",desc:["A named constant for the 'Line With Breaks' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function. Similar to [plot.style_line](#var_plot.style_line), except the gaps in the data are not filled."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_stepline",type:"const plot_style",desc:["A named constant for the 'Step Line' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_line](#var_plot.style_line)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_stepline_diamond",type:"const plot_style",desc:["A named constant for the 'Step Line With Diamonds' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function. Similar to [plot.style_stepline](#var_plot.style_stepline), except the data changes are also marked with the Diamond shapes."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_histogram",type:"const plot_style",desc:["A named constant for the 'Histogram' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_cross",type:"const plot_style",desc:["A named constant for the 'Cross' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_area",type:"const plot_style",desc:["A named constant for the 'Area' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_cross](#var_plot.style_cross)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_areabr",type:"const plot_style",desc:["A named constant for the 'Area With Breaks' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function. Similar to [plot.style_area](#var_plot.style_area), except the gaps in the data are not filled."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_columns](#var_plot.style_columns)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_columns",type:"const plot_style",desc:["A named constant for the 'Columns' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_circles](#var_plot.style_circles)"]},{name:"plot.style_circles",type:"const plot_style",desc:["A named constant for the 'Circles' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_steplinebr](#var_plot.style_steplinebr)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)"]},{name:"plot.style_steplinebr",type:"const plot_style",desc:["A named constant for the 'Step line with Breaks' style, to be used as an argument for the `style` parameter in the [plot](#fun_plot) function."],seeAlso:["[plot](#fun_plot)","[plot.style_circles](#var_plot.style_circles)","[plot.style_line](#var_plot.style_line)","[plot.style_linebr](#var_plot.style_linebr)","[plot.style_stepline](#var_plot.style_stepline)","[plot.style_stepline_diamond](#var_plot.style_stepline_diamond)","[plot.style_histogram](#var_plot.style_histogram)","[plot.style_cross](#var_plot.style_cross)","[plot.style_area](#var_plot.style_area)","[plot.style_areabr](#var_plot.style_areabr)","[plot.style_columns](#var_plot.style_columns)"]},{name:"format.inherit",type:"const string",desc:["Is a named constant for selecting the formatting of the script output values from the parent series in the [indicator](#fun_indicator) function."],seeAlso:["[indicator](#fun_indicator)","[format.price](#var_format.price)","[format.volume](#var_format.volume)","[format.percent](#var_format.percent)"]},{name:"format.price",type:"const string",desc:["Is a named constant for selecting the formatting of the script output values as prices in the [indicator](#fun_indicator) function."],remarks:["If format is format.price, default precision value is set. You can use the precision argument of indicator function to change the precision value."],seeAlso:["[indicator](#fun_indicator)","[format.inherit](#var_format.inherit)","[format.volume](#var_format.volume)","[format.percent](#var_format.percent)"]},{name:"format.volume",type:"const string",desc:["Is a named constant for selecting the formatting of the script output values as volume in the [indicator](#fun_indicator) function, e.g. '5183' will be formatted as '5.183K'."],seeAlso:["[indicator](#fun_indicator)","[format.inherit](#var_format.inherit)","[format.price](#var_format.price)","[format.percent](#var_format.percent)"]},{name:"format.percent",type:"const string",desc:["Is a named constant for selecting the formatting of the script output values as a percentage in the indicator function. It adds a percent sign after values."],remarks:["The default precision is 2, regardless of the precision of the chart itself. This can be changed with the 'precision' argument of the [indicator](#fun_indicator) function."],seeAlso:["[indicator](#fun_indicator)","[format.inherit](#var_format.inherit)","[format.price](#var_format.price)","[format.volume](#var_format.volume)"]},{name:"format.mintick",type:"const string",desc:["Is a named constant to use with the [str.tostring](#fun_str.tostring) function. Passing a number to [str.tostring](#fun_str.tostring) with this argument rounds the number to the nearest value that can be divided by [syminfo.mintick](#var_syminfo.mintick), without the remainder, with ties rounding up, and returns the string version of said value with trailing zeros."],seeAlso:["[indicator](#fun_indicator)","[format.inherit](#var_format.inherit)","[format.price](#var_format.price)","[format.volume](#var_format.volume)"]},{name:"dayofweek.sunday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.friday](#var_dayofweek.friday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.monday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.friday](#var_dayofweek.friday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.tuesday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.friday](#var_dayofweek.friday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.wednesday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.friday](#var_dayofweek.friday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.thursday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.friday](#var_dayofweek.friday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.friday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.saturday](#var_dayofweek.saturday)"]},{name:"dayofweek.saturday",type:"const int",desc:["Is a named constant for return value of [dayofweek](#fun_dayofweek) function and value of [dayofweek](#var_dayofweek) variable."],seeAlso:["[dayofweek.sunday](#var_dayofweek.sunday)","[dayofweek.monday](#var_dayofweek.monday)","[dayofweek.tuesday](#var_dayofweek.tuesday)","[dayofweek.wednesday](#var_dayofweek.wednesday)","[dayofweek.thursday](#var_dayofweek.thursday)","[dayofweek.friday](#var_dayofweek.friday)"]},{name:"shape.xcross",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.cross",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.circle",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.triangleup",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.triangledown",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.flag",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.arrowup",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.arrowdown",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.labelup",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.labeldown",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.square",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"shape.diamond",type:"const string",desc:["Shape style for [plotshape](#fun_plotshape) function."],seeAlso:["[plotshape](#fun_plotshape)"]},{name:"location.abovebar",type:"const string",desc:["Location value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. Shape is plotted above main series bars."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[location.belowbar](#var_location.belowbar)","[location.top](#var_location.top)","[location.bottom](#var_location.bottom)","[location.absolute](#var_location.absolute)"]},{name:"location.belowbar",type:"const string",desc:["Location value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. Shape is plotted below main series bars."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[location.abovebar](#var_location.abovebar)","[location.top](#var_location.top)","[location.bottom](#var_location.bottom)","[location.absolute](#var_location.absolute)"]},{name:"location.top",type:"const string",desc:["Location value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. Shape is plotted near the top chart border."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[location.abovebar](#var_location.abovebar)","[location.belowbar](#var_location.belowbar)","[location.bottom](#var_location.bottom)","[location.absolute](#var_location.absolute)"]},{name:"location.bottom",type:"const string",desc:["Location value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. Shape is plotted near the bottom chart border."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[location.abovebar](#var_location.abovebar)","[location.belowbar](#var_location.belowbar)","[location.top](#var_location.top)","[location.absolute](#var_location.absolute)"]},{name:"location.absolute",type:"const string",desc:["Location value for [plotshape](#fun_plotshape), [plotchar](#fun_plotchar) functions. Shape is plotted on chart using indicator value as a price coordinate."],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[location.abovebar](#var_location.abovebar)","[location.belowbar](#var_location.belowbar)","[location.top](#var_location.top)","[location.bottom](#var_location.bottom)"]},{name:"scale.right",type:"const scale_type",desc:["Scale value for [indicator](#fun_indicator) function. Indicator is added to the right price scale."],seeAlso:["[indicator](#fun_indicator)"]},{name:"scale.left",type:"const scale_type",desc:["Scale value for [indicator](#fun_indicator) function. Indicator is added to the left price scale."],seeAlso:["[indicator](#fun_indicator)"]},{name:"scale.none",type:"const scale_type",desc:["Scale value for [indicator](#fun_indicator) function. Indicator is added in 'No Scale' mode. Can be used only with 'overlay=true'."],seeAlso:["[indicator](#fun_indicator)"]},{name:"strategy.oca.none",type:"const string",desc:["OCA type value for strategy's functions. The parameter determines that an order should not belong to any particular OCO group."],seeAlso:["[strategy.entry](#fun_strategy.entry)","[strategy.exit](#fun_strategy.exit)","[strategy.order](#fun_strategy.order)"]},{name:"strategy.oca.cancel",type:"const string",desc:["OCA type value for strategy's functions. The parameter determines that an order should belong to an OCO group, where as soon as an order is filled, all other orders of the same group are cancelled. Note: if more than 1 guaranteed-to-be-executed orders of the same OCA group are placed at once, all those orders are filled."],seeAlso:["[strategy.entry](#fun_strategy.entry)","[strategy.exit](#fun_strategy.exit)","[strategy.order](#fun_strategy.order)"]},{name:"strategy.oca.reduce",type:"const string",desc:["OCA type value for strategy's functions. The parameter determines that an order should belong to an OCO group, where if X number of contracts of an order is filled, number of contracts for each other order of the same OCO group is decreased by X. Note: if more than 1 guaranteed-to-be-executed orders of the same OCA group are placed at once, all those orders are filled."],seeAlso:["[strategy.entry](#fun_strategy.entry)","[strategy.exit](#fun_strategy.exit)","[strategy.order](#fun_strategy.order)"]},{name:"strategy.commission.percent",type:"const string",desc:["Commission type for an order. A percentage of the cash volume of order."],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.commission.cash_per_contract",type:"const string",desc:["Commission type for an order. Money displayed in the account currency per contract."],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.commission.cash_per_order",type:"const string",desc:["Commission type for an order. Money displayed in the account currency per order."],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.fixed",type:"const string",desc:["This is one of the arguments that can be supplied to the `default_qty_type` parameter in the [strategy](#fun_strategy) declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in [strategy.entry](#fun_strategy.entry) or [strategy.order](#fun_strategy.order) function calls. It specifies that a number of contracts/shares/lots will be used to enter trades."],examples:["//@version=5",'strategy("strategy.fixed", overlay = true, default_qty_value = 50, default_qty_type = strategy.fixed, initial_capital = 1000000)',"","if bar_index == 0"," // As ‘qty’ is not defined, the previously defined values for the `default_qty_type` and `default_qty_value` parameters are used to enter trades, namely 50 contracts."," // qty = 50",' strategy.entry("EN", strategy.long)',"if bar_index == 2",' strategy.close("EN")'],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.cash",type:"const string",desc:["This is one of the arguments that can be supplied to the `default_qty_type` parameter in the [strategy](#fun_strategy) declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in [strategy.entry](#fun_strategy.entry) or [strategy.order](#fun_strategy.order) function calls. It specifies that an amount of cash in the `strategy.account_currency` will be used to enter trades."],examples:["//@version=5",'strategy("strategy.cash", overlay = true, default_qty_value = 50, default_qty_type = strategy.cash, initial_capital = 1000000)',"","if bar_index == 0"," // As ‘qty’ is not defined, the previously defined values for the `default_qty_type` and `default_qty_value` parameters are used to enter trades, namely 50 units of cash in the currency of `strategy.account_currency`."," // `qty` is calculated as (default_qty_value)/(close price). If current price is $5, then qty = 50/5 = 10.",' strategy.entry("EN", strategy.long)',"if bar_index == 2",' strategy.close("EN")'],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.percent_of_equity",type:"const string",desc:["This is one of the arguments that can be supplied to the `default_qty_type` parameter in the [strategy](#fun_strategy) declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in [strategy.entry](#fun_strategy.entry) or [strategy.order](#fun_strategy.order) function calls. It specifies that a percentage (0-100) of equity will be used to enter trades."],examples:["//@version=5",'strategy("strategy.percent_of_equity", overlay = false, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, initial_capital = 1000000)',"","// As ‘qty’ is not defined, the previously defined values for the `default_qty_type` and `default_qty_value` parameters are used to enter trades, namely 100% of available equity.","if bar_index == 0",' strategy.entry("EN", strategy.long)',"if bar_index == 2",' strategy.close("EN")',"plot(strategy.equity)",""," // The ‘qty’ parameter is set to 10. Entering position with fixed size of 10 contracts and entry market price = (10 * close).","if bar_index == 4",' strategy.entry("EN", strategy.long, qty = 10)',"if bar_index == 6",' strategy.close("EN")'],seeAlso:["[strategy](#fun_strategy)"]},{name:"strategy.direction.all",type:"const string",desc:["It allows strategy to open both long and short positions."],seeAlso:["[strategy.risk.allow_entry_in](#fun_strategy.risk.allow_entry_in)"]},{name:"strategy.direction.long",type:"const string",desc:["It allows strategy to open only long positions."],seeAlso:["[strategy.risk.allow_entry_in](#fun_strategy.risk.allow_entry_in)"]},{name:"strategy.direction.short",type:"const string",desc:["It allows strategy to open only short positions."],seeAlso:["[strategy.risk.allow_entry_in](#fun_strategy.risk.allow_entry_in)"]},{name:"currency.NONE",type:"const string",desc:["Unspecified currency."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.USD",type:"const string",desc:["United States dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.EUR",type:"const string",desc:["Euro."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.AUD",type:"const string",desc:["Australian dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.GBP",type:"const string",desc:["Pound sterling."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.NZD",type:"const string",desc:["New Zealand dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.CAD",type:"const string",desc:["Canadian dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.CHF",type:"const string",desc:["Swiss franc."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.HKD",type:"const string",desc:["Hong Kong dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.JPY",type:"const string",desc:["Japanese yen."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.NOK",type:"const string",desc:["Norwegian krone."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.SEK",type:"const string",desc:["Swedish krona."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.SGD",type:"const string",desc:["Singapore dollar."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.TRY",type:"const string",desc:["Turkish lira."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.ZAR",type:"const string",desc:["South African rand."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.RUB",type:"const string",desc:["Russian ruble."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.BTC",type:"const string",desc:["Bitcoin."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.ETH",type:"const string",desc:["Ethereum."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.MYR",type:"const string",desc:["Malaysian ringgit."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.KRW",type:"const string",desc:["South Korean won."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.USDT",type:"const string",desc:["Tether."],seeAlso:["[strategy](#fun_strategy)"]},{name:"currency.INR",type:"const string",desc:["Indian rupee."],seeAlso:["[strategy](#fun_strategy)"]},{name:"barmerge.lookahead_off",type:"const barmerge_lookahead",desc:['Merge strategy for the requested data position. Requested barset is merged with current barset in the order of sorting bars by their close time. This merge strategy disables effect of getting data from "future" on calculation on history.'],seeAlso:["[request.security](#fun_request.security)","[barmerge.lookahead_on](#var_barmerge.lookahead_on)"]},{name:"barmerge.lookahead_on",type:"const barmerge_lookahead",desc:['Merge strategy for the requested data position. Requested barset is merged with current barset in the order of sorting bars by their opening time. This merge strategy can lead to undesirable effect of getting data from "future" on calculation on history. This is unacceptable in backtesting strategies, but can be useful in indicators.'],seeAlso:["[request.security](#fun_request.security)","[barmerge.lookahead_off](#var_barmerge.lookahead_off)"]},{name:"barmerge.gaps_off",type:"const barmerge_gaps",desc:["Merge strategy for requested data. Data is merged continuously without gaps, all the gaps are filled with the previous nearest existing value."],seeAlso:["[request.security](#fun_request.security)","[barmerge.gaps_on](#var_barmerge.gaps_on)"]},{name:"barmerge.gaps_on",type:"const barmerge_gaps",desc:["Merge strategy for requested data. Data is merged with possible gaps ([na](#var_na) values)."],seeAlso:["[request.security](#fun_request.security)","[barmerge.gaps_off](#var_barmerge.gaps_off)"]},{name:"xloc.bar_index",type:"const string",desc:["A constant that specifies how functions that create and modify Pine drawings interpret x-coordinates. If `xloc = xloc.bar_index`, the drawing object treats each x-coordinate as a `bar_index` value."],seeAlso:["[xloc.bar_time](#var_xloc.bar_time)","[line.new](#fun_line.new)","[label.new](#fun_label.new)","[box.new](#fun_box.new)","[polyline.new](#fun_polyline.new)","[line.set_xloc](#fun_line.set_xloc)","[label.set_xloc](#fun_label.set_xloc)"]},{name:"xloc.bar_time",type:"const string",desc:["A constant that specifies how functions that create and modify Pine drawings interpret x-coordinates. If `xloc = xloc.bar_time`, the drawing object treats each x-coordinate as a UNIX timestamp, expressed in milliseconds."],seeAlso:["[xloc.bar_index](#var_xloc.bar_index)","[line.new](#fun_line.new)","[label.new](#fun_label.new)","[box.new](#fun_box.new)","[polyline.new](#fun_polyline.new)","[line.set_xloc](#fun_line.set_xloc)","[label.set_xloc](#fun_label.set_xloc)","[xloc.bar_index](#var_xloc.bar_index)"]},{name:"yloc.price",type:"const string",desc:["A named constant that specifies the algorithm of interpretation of y-value in function [label.new](#fun_label.new)."],seeAlso:["[label.new](#fun_label.new)","[label.set_yloc](#fun_label.set_yloc)","[yloc.abovebar](#var_yloc.abovebar)","[yloc.belowbar](#var_yloc.belowbar)"]},{name:"yloc.abovebar",type:"const string",desc:["A named constant that specifies the algorithm of interpretation of y-value in function [label.new](#fun_label.new)."],seeAlso:["[label.new](#fun_label.new)","[label.set_yloc](#fun_label.set_yloc)","[yloc.price](#var_yloc.price)","[yloc.belowbar](#var_yloc.belowbar)"]},{name:"yloc.belowbar",type:"const string",desc:["A named constant that specifies the algorithm of interpretation of y-value in function [label.new](#fun_label.new)."],seeAlso:["[label.new](#fun_label.new)","[label.set_yloc](#fun_label.set_yloc)","[yloc.price](#var_yloc.price)","[yloc.abovebar](#var_yloc.abovebar)"]},{name:"extend.none",type:"const string",desc:["A named constant for [line.new](#fun_line.new) and [line.set_extend](#fun_line.set_extend) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_extend](#fun_line.set_extend)","[extend.left](#var_extend.left)","[extend.right](#var_extend.right)","[extend.both](#var_extend.both)"]},{name:"extend.left",type:"const string",desc:["A named constant for [line.new](#fun_line.new) and [line.set_extend](#fun_line.set_extend) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_extend](#fun_line.set_extend)","[extend.none](#var_extend.none)","[extend.right](#var_extend.right)","[extend.both](#var_extend.both)"]},{name:"extend.right",type:"const string",desc:["A named constant for [line.new](#fun_line.new) and [line.set_extend](#fun_line.set_extend) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_extend](#fun_line.set_extend)","[extend.none](#var_extend.none)","[extend.left](#var_extend.left)","[extend.both](#var_extend.both)"]},{name:"extend.both",type:"const string",desc:["A named constant for [line.new](#fun_line.new) and [line.set_extend](#fun_line.set_extend) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_extend](#fun_line.set_extend)","[extend.none](#var_extend.none)","[extend.left](#var_extend.left)","[extend.right](#var_extend.right)"]},{name:"label.style_none",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_xcross",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_cross",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_triangleup",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_triangledown",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_flag",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_circle",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_arrowup",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_arrowdown",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_up",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_down",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_left",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_right",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_lower_left",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_lower_right",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_upper_left",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_upper_right",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_label_center",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_square",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_diamond](#var_label.style_diamond)"]},{name:"label.style_diamond",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)"]},{name:"label.style_text_outline",type:"const string",desc:["Label style for [label.new](#fun_label.new) and [label.set_style](#fun_label.set_style) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[label.set_textalign](#fun_label.set_textalign)","[label.style_none](#var_label.style_none)","[label.style_xcross](#var_label.style_xcross)","[label.style_cross](#var_label.style_cross)","[label.style_triangleup](#var_label.style_triangleup)","[label.style_triangledown](#var_label.style_triangledown)","[label.style_flag](#var_label.style_flag)","[label.style_circle](#var_label.style_circle)","[label.style_arrowup](#var_label.style_arrowup)","[label.style_arrowdown](#var_label.style_arrowdown)","[label.style_label_up](#var_label.style_label_up)","[label.style_label_down](#var_label.style_label_down)","[label.style_label_left](#var_label.style_label_left)","[label.style_label_right](#var_label.style_label_right)","[label.style_label_lower_left](#var_label.style_label_lower_left)","[label.style_label_lower_right](#var_label.style_label_lower_right)","[label.style_label_upper_left](#var_label.style_label_upper_left)","[label.style_label_upper_right](#var_label.style_label_upper_right)","[label.style_label_center](#var_label.style_label_center)","[label.style_square](#var_label.style_square)","[label.style_diamond](#var_label.style_diamond)"]},{name:"display.none",type:"const plot_simple_display",desc:["A named constant for use with the `display` parameter of `plot*()` and `input*()` functions. `plot*()` functions using this will not display their plotted values anywhere. However, alert template messages and [fill](#fun_fill) functions can still use the values, and they will appear in exported chart data. `input*()` functions using this constant will only display their values within the script's settings."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"display.pane",type:"const plot_display",desc:["A named constant for use with the `display` parameter of `plot*()` functions. Displays plotted values in the chart pane used by the script."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"display.data_window",type:"const plot_display",desc:["A named constant for use with the `display` parameter of `plot*()` and `input*()` functions. Displays plotted or input values in the Data Window, a menu accessible from the chart's right sidebar."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"display.price_scale",type:"const plot_display",desc:["A named constant for use with the `display` parameter of `plot*()` functions. Displays the plot’s label and value on the price scale if the chart's settings allow it."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"display.status_line",type:"const plot_display",desc:["A named constant for use with the `display` parameter of `plot*()` and `input*()` functions. Displays plotted or input values in the status line next to the script's name on the chart if the chart's settings allow it."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"display.all",type:"const plot_simple_display",desc:["A named constant for use with the `display` parameter of `plot*()` and `input*()` functions. Displays plotted or input values in all possible locations."],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[plotbar](#fun_plotbar)","[plotcandle](#fun_plotcandle)"]},{name:"line.style_solid",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)"]},{name:"line.style_dotted",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_solid](#var_line.style_solid)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)"]},{name:"line.style_dashed",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)"]},{name:"line.style_arrow_left",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions. Solid line with arrow on the first point."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)"]},{name:"line.style_arrow_right",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions. Solid line with arrow on the second point."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_both](#var_line.style_arrow_both)"]},{name:"line.style_arrow_both",type:"const string",desc:["Line style for [line.new](#fun_line.new) and [line.set_style](#fun_line.set_style) functions. Solid line with arrows on both points."],seeAlso:["[line.new](#fun_line.new)","[line.set_style](#fun_line.set_style)","[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)"]},{name:"text.align_center",type:"const string",desc:["Text alignment for [box.new](#fun_box.new), [box.set_text_halign](#fun_box.set_text_halign), [box.set_text_valign](#fun_box.set_text_valign), [label.new](#fun_label.new) and [label.set_textalign](#fun_label.set_textalign) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[text.align_left](#var_text.align_left)","[text.align_right](#var_text.align_right)."]},{name:"text.align_left",type:"const string",desc:["Horizontal text alignment for [box.new](#fun_box.new), [box.set_text_halign](#fun_box.set_text_halign), [label.new](#fun_label.new) and [label.set_textalign](#fun_label.set_textalign) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[text.align_center](#var_text.align_center)","[text.align_right](#var_text.align_right)."]},{name:"text.align_right",type:"const string",desc:["Horizontal text alignment for [box.new](#fun_box.new), [box.set_text_halign](#fun_box.set_text_halign), [label.new](#fun_label.new) and [label.set_textalign](#fun_label.set_textalign) functions."],seeAlso:["[label.new](#fun_label.new)","[label.set_style](#fun_label.set_style)","[text.align_center](#var_text.align_center)","[text.align_left](#var_text.align_left)."]},{name:"text.align_top",type:"const string",desc:["Vertical text alignment for [box.new](#fun_box.new), [box.set_text_valign](#fun_box.set_text_valign), [table.cell](#fun_table.cell) and [table.cell_set_text_valign](#fun_table.cell_set_text_valign) functions."],seeAlso:["[table.cell](#fun_table.cell)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[text.align_center](#var_text.align_center)","[text.align_left](#var_text.align_left)","[text.align_right](#var_text.align_right)."]},{name:"text.align_bottom",type:"const string",desc:["Vertical text alignment for [box.new](#fun_box.new), [box.set_text_valign](#fun_box.set_text_valign), [table.cell](#fun_table.cell) and [table.cell_set_text_valign](#fun_table.cell_set_text_valign) functions."],seeAlso:["[table.cell](#fun_table.cell)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[text.align_center](#var_text.align_center)","[text.align_left](#var_text.align_left)","[text.align_right](#var_text.align_right)."]},{name:"font.family_default",type:"const string",desc:["Default text font for [box.new](#fun_box.new), [box.set_text_font_family](#fun_box.set_text_font_family), [label.new](#fun_label.new), [label.set_text_font_family](#fun_label.set_text_font_family), [table.cell](#fun_table.cell) and [table.cell_set_text_font_family](#fun_table.cell_set_text_font_family) functions."],seeAlso:["[box.new](#fun_box.new)","[box.set_text_font_family](#fun_box.set_text_font_family)","[label.new](#fun_label.new)","[label.set_text_font_family](#fun_label.set_text_font_family)","[table.cell](#fun_table.cell)","[table.cell_set_text_font_family](#fun_table.cell_set_text_font_family)","[font.family_monospace](#var_font.family_monospace)"]},{name:"font.family_monospace",type:"const string",desc:["Monospace text font for [box.new](#fun_box.new), [box.set_text_font_family](#fun_box.set_text_font_family), [label.new](#fun_label.new), [label.set_text_font_family](#fun_label.set_text_font_family), [table.cell](#fun_table.cell) and [table.cell_set_text_font_family](#fun_table.cell_set_text_font_family) functions."],seeAlso:["[box.new](#fun_box.new)","[box.set_text_font_family](#fun_box.set_text_font_family)","[label.new](#fun_label.new)","[label.set_text_font_family](#fun_label.set_text_font_family)","[table.cell](#fun_table.cell)","[table.cell_set_text_font_family](#fun_table.cell_set_text_font_family)","[font.family_default](#var_font.family_default)"]},{name:"text.wrap_auto",type:"const string",desc:["Automatic wrapping mode for [box.new](#fun_box.new) and [box.set_text_wrap](#fun_box.set_text_wrap) functions."],seeAlso:["[box.new](#fun_box.new)","[box.set_text](#fun_box.set_text)","[box.set_text_wrap](#fun_box.set_text_wrap)"]},{name:"text.wrap_none",type:"const string",desc:["Disabled wrapping mode for [box.new](#fun_box.new) and [box.set_text_wrap](#fun_box.set_text_wrap) functions."],seeAlso:["[box.new](#fun_box.new)","[box.set_text](#fun_box.set_text)","[box.set_text_wrap](#fun_box.set_text_wrap)"]},{name:"order.ascending",type:"const sort_order",desc:["Determines the sort order of the array from the smallest to the largest value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sort](#fun_array.sort)."]},{name:"order.descending",type:"const sort_order",desc:["Determines the sort order of the array from the largest to the smallest value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sort](#fun_array.sort)."]},{name:"alert.freq_all",type:"const string",desc:["A named constant for use with the `freq` parameter of the alert() function.","All function calls trigger the alert."],seeAlso:["[alert](#fun_alert)."]},{name:"alert.freq_once_per_bar",type:"const string",desc:["A named constant for use with the `freq` parameter of the alert() function.","The first function call during the bar triggers the alert."],seeAlso:["[alert](#fun_alert)."]},{name:"alert.freq_once_per_bar_close",type:"const string",desc:["A named constant for use with the `freq` parameter of the alert() function.","The function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes."],seeAlso:["[alert](#fun_alert)."]},{name:"earnings.actual",type:"const string",desc:["A named constant for the [request.earnings](#fun_request.earnings) function. Is used to request the earnings value as it was reported."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"earnings.estimate",type:"const string",desc:["A named constant for the [request.earnings](#fun_request.earnings) function. Is used to request the estimated earnings value."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"earnings.standardized",type:"const string",desc:["A named constant for the [request.earnings](#fun_request.earnings) function. Is used to request the standardized earnings value."],seeAlso:["[request.earnings](#fun_request.earnings)."]},{name:"dividends.net",type:"const string",desc:["A named constant for the [request.dividends](#fun_request.dividends) function. Is used to request the dividends return on a stock after deductions."],seeAlso:["[request.dividends](#fun_request.dividends)."]},{name:"dividends.gross",type:"const string",desc:["A named constant for the [request.dividends](#fun_request.dividends) function. Is used to request the dividends return on a stock before deductions."],seeAlso:["[request.dividends](#fun_request.dividends)."]},{name:"dividends.future_amount",type:"series float",desc:["Returns the payment amount of the upcoming dividend in the currency of the current instrument, or [na](#var_na) if this data isn't available."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend."]},{name:"dividends.future_ex_date",type:"series int",returns:["UNIX time, expressed in milliseconds."],desc:["Returns the Ex-dividend date (Ex-date) of the current instrument's next dividend payment, or [na](#var_na) if this data isn't available. Ex-dividend date signifies when investors are no longer entitled to a payout from the most recent dividend. Only those who purchased shares before this day are entitled to the dividend payment."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend."]},{name:"dividends.future_pay_date",type:"series int",returns:["UNIX time, expressed in milliseconds."],desc:["Returns the Payment date (Pay date) of the current instrument's next dividend payment, or [na](#var_na) if this data isn't available. Payment date signifies the day when eligible investors will receive the dividend payment."],remarks:["This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend."]},{name:"splits.denominator",type:"const string",desc:["A named constant for the [request.splits](#fun_request.splits) function. Is used to request the denominator (the number below the line in a fraction) of a splits."],seeAlso:["[request.splits](#fun_request.splits)."]},{name:"splits.numerator",type:"const string",desc:["A named constant for the [request.splits](#fun_request.splits) function. Is used to request the numerator (the number above the line in a fraction) of a splits."],seeAlso:["[request.splits](#fun_request.splits)."]},{name:"true",desc:["Literal representing one of the values a [bool](#op_bool) variable can hold, or an expression can evaluate to when it uses comparison or logical operators."],remarks:["See the User Manual for [comparison operators](https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#comparison-operators) and [logical operators](https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#logical-operators)."],seeAlso:["[bool](#op_bool)"]},{name:"false",desc:["Literal representing a [bool](#op_bool) value, and result of a comparison operation."],remarks:["See the User Manual for [comparison operators](https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#comparison-operators) and [logical operators](https://www.tradingview.com/pine-script-docs/en/v5/language/Operators.html#logical-operators)."],seeAlso:["[bool](#op_bool)"]},{name:"color.black",type:"const color",color:"#363A45",desc:["Is a named constant for #363A45 color."],seeAlso:["[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.silver",type:"const color",color:"#B2B5BE",desc:["Is a named constant for #B2B5BE color."],seeAlso:["[color.black](#var_color.black)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.gray",type:"const color",color:"#787B86",desc:["Is a named constant for #787B86 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.white",type:"const color",color:"#FFFFFF",desc:["Is a named constant for #FFFFFF color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.maroon",type:"const color",color:"#880E4F",desc:["Is a named constant for #880E4F color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.red",type:"const color",color:"#FF5252",desc:["Is a named constant for #FF5252 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.purple",type:"const color",color:"#9C27B0",desc:["Is a named constant for #9C27B0 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.fuchsia",type:"const color",color:"#E040FB",desc:["Is a named constant for #E040FB color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.green",type:"const color",color:"#4CAF50",desc:["Is a named constant for #4CAF50 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.lime",type:"const color",color:"#00E676",desc:["Is a named constant for #00E676 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.olive",type:"const color",color:"#808000",desc:["Is a named constant for #808000 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.yellow",type:"const color",color:"#FFEB3B",desc:["Is a named constant for #FFEB3B color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.navy",type:"const color",color:"#311B92",desc:["Is a named constant for #311B92 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.blue",type:"const color",color:"#2962ff",desc:["Is a named constant for #2962ff color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.teal",type:"const color",color:"#00897B",desc:["Is a named constant for #00897B color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.aqua](#var_color.aqua)","[color.orange](#var_color.orange)"]},{name:"color.aqua",type:"const color",color:"#00BCD4",desc:["Is a named constant for #00BCD4 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.orange](#var_color.orange)"]},{name:"color.orange",type:"const color",color:"#FF9800",desc:["Is a named constant for #FF9800 color."],seeAlso:["[color.black](#var_color.black)","[color.silver](#var_color.silver)","[color.gray](#var_color.gray)","[color.white](#var_color.white)","[color.maroon](#var_color.maroon)","[color.red](#var_color.red)","[color.purple](#var_color.purple)","[color.fuchsia](#var_color.fuchsia)","[color.green](#var_color.green)","[color.lime](#var_color.lime)","[color.olive](#var_color.olive)","[color.yellow](#var_color.yellow)","[color.navy](#var_color.navy)","[color.blue](#var_color.blue)","[color.teal](#var_color.teal)","[color.aqua](#var_color.aqua)"]}],types:[{name:"simple",desc:['The `simple` keyword explicitly assigns the "simple" type qualifier to variables and function parameters. Variables and parameters that use the "simple" qualifier can reference values established at the beginning of a script\'s execution that do not change later.','To restrict the parameters in a library\'s exported functions to only allow values with a "simple" or weaker type qualifier, using the `simple` keyword when declaring parameters is often necessary, as libraries automatically qualify all parameters as "series" wherever possible by default. Explicitly restricting functions to accept "simple" arguments also allows them to return "simple" values in some cases, depending on the operations they execute, making them usable with the parameters of built-in functions that do not allow "series" arguments.',`In variable declarations, the compiler can usually infer the qualified type automatically based on the values assigned to a variable, and it can automatically change a variable's qualifier to a stronger one when necessary. The type qualifier hierarchy is "const" < "input" < "simple" < "series", where "simple" is stronger than "input" and "const".`,'Explicitly declaring a variable with the `simple` keyword restricts the type qualifier to "simple", meaning the script cannot pass its value to any variable or function parameter that requires a value with a weaker qualifier ("const" or "input"). Additionally, one cannot assign a "series" value to a variable explicitly declared with the `simple` keyword.',"When using this keyword to specify the type qualifier, one must also use a type keyword to declare the allowed type."],syntax:[`export [method ]<functionName>([[simple ]<paramType>] <paramName>[ = <defaultValue>])
87
+
88
+ [method ]<functionName>([simple <paramType> ]<paramName>[ = <defaultValue>])
89
+
90
+ [var/varip ]simple <variableType> <variableName> = <variableValue></variableValue>`],examples:["//@version=5","//@description A library with custom functions.",'library("CustomFunctions", overlay = true)',"","//@function Calculates the length values for a ribbon of four EMAs by multiplying the `baseLength`.",'//@param baseLength The initial EMA length. Requires "simple int" because you can\'t use "series int" in `ta.ema()`.',"//@returns A tuple of length values.","export ribbonLengths(simple int baseLength) =>"," simple int length1 = baseLength"," simple int length2 = baseLength * 2"," simple int length3 = baseLength * 3"," simple int length4 = baseLength * 4"," [length1, length2, length3, length4]","",'// Get a tuple of "simple int" length values.',"[len1, len2, len3, len4] = ribbonLengths(14)","","// Plot four EMAs using the values from the tuple.",'plot(ta.ema(close, len1), "EMA 1", color = color.red)','plot(ta.ema(close, len2), "EMA 1", color = color.orange)','plot(ta.ema(close, len3), "EMA 1", color = color.green)','plot(ta.ema(close, len4), "EMA 1", color = color.blue)'],detailedDesc:[{desc:[],examples:["//@version=5",`indicator("can't change simple to series")`,"",'//@variable A variable declared as "simple float" with a value of 5.0.',"simple float myVar = 5.0","","// This reassignment causes an error.",'// The `close` variable returns a "series float" value. Since `myVar` is restricted to "simple" values, it cannot','// change its qualifier to "series".',"myVar := close","","plot(myVar)"]}],remarks:["To learn more, see our User Manual's section on [type qualifiers](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#qualifiers)."],seeAlso:["[series](#op_series)","[const](#op_const)"]},{name:"series",desc:['The `series` keyword explicitly assigns the "series" type qualifier to variables and function parameters. Variables and parameters that use the "series" qualifier can reference values that change throughout a script\'s execution.','Explicit use of the `series` keyword when declaring the parameters of a library\'s exported functions is typically unnecessary, as the compiler can usually automatically detect whether a parameter is compatible with "series" or "simple" qualified values. By default, all exported function parameters are qualified as "series" wherever possible.',`In variable declarations, the compiler can usually infer the qualified type automatically based on the values assigned to a variable, and it can automatically change a variable's qualifier to a stronger one when necessary. The type qualifier hierarchy is "const" < "input" < "simple" < "series", where "series" is the strongest.`,'Explicitly declaring a variable with the `series` keyword restricts the type qualifier to "series", meaning the script cannot pass its value to any variable or function parameter that requires a value with a weaker qualifier ("const", "input", or "simple").',"When using this keyword to specify the type qualifier, one must also use a type keyword to declare the allowed type."],syntax:[`export [method ]<functionName>([[series ]<paramType>] <paramName>[ = <defaultValue>])
91
+
92
+ [method ]<functionName>([series <paramType> ]<paramName>[ = <defaultValue>])
93
+
94
+ [var/varip ]series <variableType> <variableName> = <variableValue>`],examples:["//@version=5","//@description A library with custom functions.",'library("CustomFunctions", overlay = true)',"","//@function Finds the highest `source` value over `length` bars, filtered by the `cond` condition.","export conditionalHighest(series float source, series bool cond, series int length) =>"," //@variable The highest `source` value from when the `cond` was `true` over `length` bars."," series float result = na"," // Loop to find the highest value."," for i = 0 to length - 1"," if cond[i]"," value = source[i]"," result := math.max(nz(result, value), value)"," // Return the `result`."," result","","//@variable Is `true` once every five bars.","series bool condition = bar_index % 5 == 0","","//@variable The highest `close` value from every fifth bar over the last 100 bars.","series float hiValue = conditionalHighest(close, condition, 100)","","plot(hiValue)","bgcolor(condition ? color.new(color.teal, 80) : na)"],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("series variable not allowed")',"",'//@variable A variable declared as "series int" with a value of 5.',"series int myVar = 5","","// This call causes an error.",'// The `histbase` accepts "input int/float". It can\'t accept the stronger "series int" qualified type.',"plot(close, style = plot.style_histogram, histbase = myVar)"]}],remarks:["To learn more, see our User Manual's section on [type qualifiers](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#qualifiers)."],seeAlso:["[simple](#op_simple)","[const](#op_const)"]},{name:"const",desc:['The `const` keyword explicitly assigns the "const" type qualifier to variables and the parameters of non-exported functions. Variables and parameters with the "const" qualifier reference values established at compile time that never change in the script\'s execution.',`In variable declarations, the compiler can usually infer the qualified type automatically based on the values assigned to a variable, and it can automatically change a variable's qualifier to a stronger one when necessary. The type qualifier hierarchy is "const" < "input" < "simple" < "series", where "const" is the weakest.`,'Explicitly declaring a variable with the `const` keyword restricts the type qualifier to "const", meaning the variable cannot accept a value with a stronger qualifier (e.g., "input"), nor can the value assigned to the variable change at any point in the script\'s execution.',"When using this keyword to specify the type qualifier, one must also use a type keyword to declare the allowed type."],syntax:[`[method ]<functionName>([const <paramType> ]<paramName>[ = <defaultValue>])
95
+
96
+ [var/varip ]const <variableType> <variableName> = <variableValue>`],examples:["//@version=5",'indicator("custom plot title")',"",'//@function Concatenates two "const string" values.',"concatStrings(const string x, const string y) =>"," const string result = x + y","","//@variable The title of the plot.",'const string myTitle = concatStrings("My ", "Plot")',"","plot(close, myTitle)"],detailedDesc:[{desc:[],examples:["//@version=5",`indicator("can't assign input to const")`,"",'//@variable A variable declared as "const float" that attempts to assign the result of `input.float()` as its value.','// This declaration causes an error. The "input float" qualified type is stronger than "const float".',"const float myVar = input.float(2.0)","","plot(myVar)"]}],remarks:["To learn more, see our User Manual's section on [type qualifiers](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#qualifiers)."],seeAlso:["[simple](#op_simple)","[series](#op_series)"]},{name:"int",desc:['Keyword used to explicitly declare the "int" (integer) type of a variable or a parameter.'],examples:["//@version=5",'indicator("int")',"int i = 14 // Same as `i = 14`","i := na","plot(i)"],remarks:["Explicitly mentioning the type in a variable declaration is optional, except when it is initialized with [na](#var_na). Learn more about Pine Script® types in the User Manual page on the [Type System](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html)."],seeAlso:["[var](#op_var)","[varip](#op_varip)","[float](#op_float)","[bool](#op_bool)","[color](#op_color)","[string](#op_string)"]},{name:"float",desc:['Keyword used to explicitly declare the "float" (floating point) type of a variable or a parameter.'],examples:["//@version=5",'indicator("float")',"float f = 3.14 // Same as `f = 3.14`","f := na","plot(f)"],remarks:["Explicitly mentioning the type in a variable declaration is optional, except when it is initialized with [na](#var_na). Learn more about Pine Script® types in the User Manual page on the [Type System](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html)."],seeAlso:["[var](#op_var)","[varip](#op_varip)","[int](#op_int)","[bool](#op_bool)","[color](#op_color)","[string](#op_string)"]},{name:"bool",desc:['Keyword used to explicitly declare the "bool" (boolean) type of a variable or a parameter. "Bool" variables can have values [true](#var_true), [false](#var_false) or [na](#var_na).'],examples:["//@version=5",'indicator("bool")',"bool b = true // Same as `b = true`","b := na","plot(b ? open : close)"],remarks:["Explicitly mentioning the type in a variable declaration is optional, except when it is initialized with [na](#var_na). Learn more about Pine Script® types in the User Manual page on the [Type System](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html)."],seeAlso:["[var](#op_var)","[varip](#op_varip)","[int](#op_int)","[float](#op_float)","[color](#op_color)","[string](#op_string)","[true](#var_true)","[false](#var_false)"]},{name:"string",desc:['Keyword used to explicitly declare the "string" type of a variable or a parameter.'],examples:["//@version=5",'indicator("string")','string s = "Hello World!" // Same as `s = "Hello world!"`','// string s = na // same as "" ',"plot(na, title=s)"],remarks:["Explicitly mentioning the type in a variable declaration is optional, except when it is initialized with [na](#var_na). Learn more about Pine Script® types in the User Manual page on the [Type System](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html)."],seeAlso:["[var](#op_var)","[varip](#op_varip)","[int](#op_int)","[float](#op_float)","[bool](#op_bool)","[str.tostring](#fun_str.tostring)","[str.format](#fun_str.format)"]},{name:"color",desc:['Keyword used to explicitly declare the "color" type of a variable or a parameter.'],examples:["//@version=5",'indicator("color", overlay = true)',"","color textColor = color.green ","color labelColor = #FF000080 // Red color (FF0000) with 50% transparency (80 which is half of FF).","if barstate.islastconfirmedhistory",' label.new(bar_index, high, text = "Label", color = labelColor, textcolor = textColor)',"",'// When declaring variables with color literals, built-in constants(color.green) or functions (color.new(), color.rgb()), the "color" keyword for the type can be omitted.',"c = color.rgb(0,255,0,0)","plot(close, color = c)"],remarks:["Color literals have the following format: #RRGGBB or #RRGGBBAA. The letter pairs represent 00 to FF hexadecimal values (0 to 255 in decimal) where RR, GG and BB pairs are the values for the color's red, green and blue components. AA is an optional value for the color's transparency (or alpha component) where 00 is invisible and FF opaque. When no AA pair is supplied, FF is used. The hexadecimal letters can be upper or lower case.","Explicitly mentioning the type in a variable declaration is optional, except when it is initialized with [na](#var_na). Learn more about Pine Script® types in the User Manual page on the [Type System](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html)."],seeAlso:["[var](#op_var)","[varip](#op_varip)","[int](#op_int)","[float](#op_float)","[string](#op_string)","[color.rgb](#fun_color.rgb)","[color.new](#fun_color.new)"]},{name:"line",desc:['Keyword used to explicitly declare the "line" type of a variable or a parameter. Line objects (or IDs) can be created with the [line.new](#fun_line.new) function.'],examples:["//@version=5",'indicator("line")',"// Empty `line1` line ID.","var line line1 = na",'// `line` type is unnecessary because `line.new()` returns "line" type.',"var line2 = line.new(na, na, na, na)","line3 = line.new(bar_index - 1, high, bar_index, high, extend = extend.right)"],remarks:['Line objects are always of "series" form.'],seeAlso:["[var](#op_var)","[label](#op_label)","[box](#op_box)","[line.new](#fun_line.new)"]},{name:"label",desc:['Keyword used to explicitly declare the "label" type of a variable or a parameter. Label objects (or IDs) can be created with the [label.new](#fun_label.new) function.'],examples:["//@version=5",'indicator("label")',"// Empty `label1` label ID.","var label label1 = na",'// `label` type is unnecessary because `label.new()` returns "label" type.',"var label2 = label.new(na, na, na)","if barstate.islastconfirmedhistory",' label3 = label.new(bar_index, high, text = "label3 text")'],remarks:['Label objects are always of "series" form.'],seeAlso:["[var](#op_var)","[line](#op_line)","[box](#op_box)","[label.new](#fun_label.new)"]},{name:"box",desc:['Keyword used to explicitly declare the "box" type of a variable or a parameter. Box objects (or IDs) can be created with the [box.new](#fun_box.new) function.'],examples:["//@version=5",'indicator("box")',"// Empty `box1` box ID.","var box box1 = na",'// `box` type is unnecessary because `box.new()` returns a "box" type.',"var box2 = box.new(na, na, na, na)","box3 = box.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time)"],remarks:['Box objects are always of "series" form.'],seeAlso:["[var](#op_var)","[line](#op_line)","[label](#op_label)","[table](#op_table)","[box.new](#fun_box.new)"]},{name:"table",desc:['Keyword used to explicitly declare the "table" type of a variable or a parameter. Table objects (or IDs) can be created with the [table.new](#fun_table.new) function.'],examples:["//@version=5",'indicator("table")',"// Empty `table1` table ID.","var table table1 = na",'// `table` type is unnecessary because `table.new()` returns "table" type.',"var table2 = table.new(position.top_left, na, na)","","if barstate.islastconfirmedhistory"," var table3 = table.new(position = position.top_right, columns = 1, rows = 1, bgcolor = color.yellow, border_width = 1)",' table.cell(table_id = table3, column = 0, row = 0, text = "table3 text")'],remarks:['Table objects are always of "series" form.'],seeAlso:["[var](#op_var)","[line](#op_line)","[label](#op_label)","[box](#op_box)","[table.new](#fun_table.new)"]},{name:"linefill",desc:['Keyword used to explicitly declare the "linefill" type of a variable or a parameter. Linefill objects (or IDs) can be created with the [linefill.new](#fun_linefill.new) function.'],examples:["//@version=5",'indicator("linefill", overlay=true)',"// Empty `linefill1` line ID.","var linefill linefill1 = na",'// `linefill` type is unnecessary because `linefill.new()` returns "linefill" type.',"var linefill2 = linefill.new(na, na, na)","","if barstate.islastconfirmedhistory"," line1 = line.new(bar_index - 10, high+1, bar_index, high+1, extend = extend.right)"," line2 = line.new(bar_index - 10, low+1, bar_index, low+1, extend = extend.right)"," linefill3 = linefill.new(line1, line2, color = color.new(color.green, 80))"],remarks:['Linefill objects are always of "series" form.'],seeAlso:["[var](#op_var)","[line](#op_line)","[label](#op_label)","[table](#op_table)","[box](#op_box)","[linefill.new](#fun_linefill.new)"]},{name:"array",desc:['Keyword used to explicitly declare the "array" type of a variable or a parameter. Array objects (or IDs) can be created with the [array.new<type>](#fun_array.new<type>), [array.from](#fun_array.from) function.'],examples:["//@version=5",'indicator("array", overlay=true)',"array<float> a = na","a := array.new<float>(1, close)","plot(array.get(a, 0))"],remarks:['Array objects are always of "series" form.'],seeAlso:["[var](#op_var)","[line](#op_line)","[label](#op_label)","[table](#op_table)","[box](#op_box)","[array.new<type>](#fun_array.new<type>)","[array.from](#fun_array.from)"]},{name:"matrix",desc:['Keyword used to explicitly declare the "matrix" type of a variable or a parameter. Matrix objects (or IDs) can be created with the [matrix.new<type>](#fun_matrix.new<type>) function.'],examples:["//@version=5",'indicator("matrix example")',"","// Create `m1` matrix of `int` type.","matrix<int> m1 = matrix.new<int>(2, 3, 0)","","// `matrix<int>` is unnecessary because the `matrix.new<int>()` function returns an `int` type matrix object.","m2 = matrix.new<int>(2, 3, 0)","","// Display matrix using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m2))"],remarks:['Matrix objects are always of "series" form.'],seeAlso:["[var](#op_var)","[matrix.new<type>](#fun_matrix.new<type>)","[array](#op_array)"]},{name:"chart.point",desc:["Keyword to explicitly declare the type of a variable or parameter as `chart.point`. Scripts can produce `chart.point` instances using the [chart.point.from_time](#fun_chart.point.from_time), [chart.point.from_index](#fun_chart.point.from_index), [chart.point.now](#fun_chart.point.now), and [chart.point.new](#fun_chart.point.new) functions."],fields:[{name:"index",desc:"The x-coordinate of the point, expressed as a bar index value.",type:"series int"},{name:"time",desc:"The x-coordinate of the point, expressed as a UNIX time value, in milliseconds.",type:"series float"},{name:"price",desc:"The y-coordinate of the point.",type:"series float"}],seeAlso:["[polyline](#op_polyline)"]},{name:"map",desc:['Keyword used to explicitly declare the "map" type of a variable or a parameter. Map objects (or IDs) can be created with the [map.new<type,type>](#fun_map.new<type,type>) function.'],examples:["//@version=5",'indicator("map", overlay=true)',"map<int, float> a = na","a := map.new<int, float>()","a.put(bar_index, close)",'label.new(bar_index, a.get(bar_index), "Current close")'],remarks:["Map objects are always of [series](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#series) form."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)"]},{name:"polyline",desc:["Keyword to explicitly declare the type of a variable or parameter as `polyline`. Scripts can produce `polyline` instances using the [polyline.new](#fun_polyline.new) function."],seeAlso:["[chart.point](#op_chart.point)"]}],annotations:[{name:"@version=",desc:["Specifies the Pine Script® version that the script will use. The number in this annotation should not be confused with the script's version number, which updates on every saved change to the code."],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Pine v5 Indicator")',"plot(close)"]},{desc:[],examples:["//This indicator has no version annotation, so it will try to use v1.","//Pine Script® v1 has no function named `indicator()`, so the script will not compile.",'indicator("Pine v1 Indicator")',"plot(close)"]}],remarks:["The version should always be specified. Otherwise, for compatibility reasons, the script will be compiled using Pine Script® v1, which lacks most of the newer features and is bound to confuse. This annotation can be anywhere within a script, but we recommend placing it at the top of the code for readability."]},{name:"@description",desc:['Sets a custom description for scripts that use the [library](#fun_library) declaration statement. The text provided with this annotation will be used to pre-fill the "Description" field in the publication dialogue.'],examples:["//@version=5","// @description Provides a tool to quickly output a label on the chart.",'library("MyLibrary")',"","// @function Outputs a label with `labelText` on the bar's high.","// @param labelText (series string) The text to display on the label.","// @returns Drawn label.","export drawLabel(string labelText) =>"," label.new(bar_index, high, text = labelText)"]},{name:"@function",desc:["If placed above a function declaration, it adds a custom description for the function.",`The Pine Editor's autosuggest uses this description and displays it when a user hovers over the function name. When used in [library](#fun_library) scripts, the descriptions of all functions using the [export](#op_export) keyword will pre-fill the "Description" field in the publication dialogue.`],examples:["//@version=5","// @description Provides a tool to quickly output a label on the chart.",'library("MyLibrary")',"","// @function Outputs a label with `labelText` on the bar's high.","// @param labelText (series string) The text to display on the label.","// @returns Drawn label.","export drawLabel(string labelText) =>"," label.new(bar_index, high, text = labelText)"]},{name:"@param",desc:["If placed above a function declaration, it adds a custom description for a function parameter. After the annotation, users should specify the parameter name, then its description.",`The Pine Editor's autosuggest uses this description and displays it when a user hovers over the function name. When used in [library](#fun_library) scripts, the descriptions of all functions using the [export](#op_export) keyword will pre-fill the "Description" field in the publication dialogue.`],examples:["//@version=5","// @description Provides a tool to quickly output a label on the chart.",'library("MyLibrary")',"","// @function Outputs a label with `labelText` on the bar's high.","// @param labelText (series string) The text to display on the label.","// @returns Drawn label.","export drawLabel(string labelText) =>"," label.new(bar_index, high, text = labelText)"]},{name:"@returns",desc:["If placed above a function declaration, it adds a custom description for what that function returns.",`The Pine Editor's autosuggest uses this description and displays it when a user hovers over the function name. When used in [library](#fun_library) scripts, the descriptions of all functions using the [export](#op_export) keyword will pre-fill the "Description" field in the publication dialogue.`],examples:["//@version=5","// @description Provides a tool to quickly output a label on the chart.",'library("MyLibrary")',"","// @function Outputs a label with `labelText` on the bar's high.","// @param labelText (series string) The text to display on the label.","// @returns Drawn label.","export drawLabel(string labelText) =>"," label.new(bar_index, high, text = labelText)"]},{name:"@variable",desc:["If placed above a variable declaration, it adds a custom description for the variable.","The Pine Editor's autosuggest uses this description and displays it when a user hovers over the variable name."],examples:["//@version=5",'indicator("New high over the last 20 bars", overlay = true)',"","//@type A point on a chart.","//@field index The index of the bar where the point is located, i.e., its `x` coordinate.","//@field price The price where the point is located, i.e., its `y` coordinate.","type Point"," int index"," float price","","//@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.","Point highest = na","","if ta.highestbars(high, 20) == 0"," highest := Point.new(bar_index, high)"," label.new(highest.index, highest.price, str.tostring(highest.price))"]},{name:"@type",desc:["If placed above a type declaration, it adds a custom description for the type.",`The Pine Editor's autosuggest uses this description and displays it when a user hovers over the type name. When used in [library](#fun_library) scripts, the descriptions of all types using the [export](#op_export) keyword will pre-fill the "Description" field in the publication dialogue.`],examples:["//@version=5",'indicator("New high over the last 20 bars", overlay = true)',"","//@type A point on a chart.","//@field index The index of the bar where the point is located, i.e., its `x` coordinate.","//@field price The price where the point is located, i.e., its `y` coordinate.","type Point"," int index"," float price","","//@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.","Point highest = na","","if ta.highestbars(high, 20) == 0"," highest := Point.new(bar_index, high)"," label.new(highest.index, highest.price, str.tostring(highest.price))"]},{name:"@field",desc:["If placed above a type declaration, it adds a custom description for a field of the type. After the annotation, users should specify the field name, then its description.",`The Pine Editor's autosuggest uses this description and displays it when a user hovers over the type or field name. When used in [library](#fun_library) scripts, the descriptions of all types using the [export](#op_export) keyword will pre-fill the "Description" field in the publication dialogue.`],examples:["//@version=5",'indicator("New high over the last 20 bars", overlay = true)',"","//@type A point on a chart.","//@field index The index of the bar where the point is located, i.e., its `x` coordinate.","//@field price The price where the point is located, i.e., its `y` coordinate.","type Point"," int index"," float price","","//@variable If the current `high` is the highest over the last 20 bars, returns a new `Point` instance, `na` otherwise.","Point highest = na","","if ta.highestbars(high, 20) == 0"," highest := Point.new(bar_index, high)"," label.new(highest.index, highest.price, str.tostring(highest.price))"]},{name:"@strategy_alert_message",desc:['If used within a [strategy](#fun_strategy) script, it provides a default message to pre-fill the "Message" field in the alert creation dialogue.'],examples:["//@version=5",'strategy("My strategy", overlay=true, margin_long=100, margin_short=100)',"//@strategy_alert_message Strategy alert on symbol {{ticker}}","","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)",' strategy.entry("My Long Entry Id", strategy.long)','strategy.exit("Exit", "My Long Entry Id", profit = 10 / syminfo.mintick, loss = 10 / syminfo.mintick)']}],functions:[{name:"indicator",desc:["This declaration statement designates the script as an indicator and sets a number of indicator-related properties."],args:[{name:"title",desc:"The title of the script. It is displayed on the chart when no `shorttitle` argument is used, and becomes the publication's default title when publishing the script.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"shorttitle",desc:"The script's display name on charts. If specified, it will replace the `title` argument in most chart-related windows. Optional. The default is the argument used for `title`.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"overlay",desc:"If [true](#var_true), the indicator will be displayed over the chart. If [false](#var_false), it will be added in a separate pane. Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"format",desc:"Specifies the formatting of the script's displayed values. Possible values: [format.inherit](#var_format.inherit), [format.price](#var_format.price), [format.volume](#var_format.volume), [format.percent](#var_format.percent). Optional. The default is [format.inherit](#var_format.inherit).",allowedTypeIDs:["const string"],displayType:"const string"},{name:"precision",desc:"Specifies the number of digits after the floating point of the script's displayed values. Must be a non-negative integer no greater than 16. If `format` is set to [format.inherit](#var_format.inherit) and `precision` is specified, the format will instead be set to [format.price](#var_format.price). Optional. The default is inherited from the precision of the chart's symbol.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"scale",desc:"The price scale used. Possible values: [scale.right](#var_scale.right), [scale.left](#var_scale.left), [scale.none](#var_scale.none). The [scale.none](#var_scale.none) value can only be applied in combination with `overlay = true`. Optional. By default, the script uses the same scale as the chart.",allowedTypeIDs:["const scale_type"],displayType:"const scale_type"},{name:"max_bars_back",desc:"The length of the historical buffer the script keeps for every variable and function, which determines how many past values can be referenced using the `[]` history-referencing operator. The required buffer size is automatically detected by the Pine Script® runtime. Using this parameter is only necessary when a runtime error occurs because automatic detection fails. More information on the underlying mechanics of the historical buffer can be found [in our Help Center](https://www.tradingview.com/chart/?solution=43000587849). Optional. The default is 0.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"timeframe",desc:`Adds multi-timeframe functionality to simple scripts. When used, a "Timeframe" field will be added to the script's "Settings/Inputs" tab. The field's default value will be the argument supplied, whose format must conform to [timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications). To specify the chart's timeframe, use an empty string or the [timeframe.period](#var_timeframe.period) variable. The parameter cannot be used with scripts using Pine Script® drawings. Optional. The default is [timeframe.period](#var_timeframe.period).`,allowedTypeIDs:["const string"],displayType:"const string"},{name:"timeframe_gaps",desc:'Specifies how the indicator\'s values are displayed on chart bars when the `timeframe` is higher than the chart\'s. If [true](#var_true), a value only appears on a chart bar when the higher `timeframe` value becomes available, otherwise [na](#var_na) is returned (thus a "gap" occurs). With [false](#var_false), what would otherwise be gaps are filled with the latest known value returned, avoiding [na](#var_na) values. When used, a "Gaps" checkbox will appear in the indicator\'s "Settings/Inputs" tab. Optional. The default is [true](#var_true).',allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"explicit_plot_zorder",desc:"Specifies the order in which the script's plots, fills, and hlines are rendered. If [true](#var_true), plots are drawn in the order in which they appear in the script's code, each newer plot being drawn above the previous ones. This only applies to `plot*()` functions, [fill](#fun_fill), and [hline](#fun_hline). Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"max_lines_count",desc:"The number of last [line](#op_line) drawings displayed. Possible values: 1-500. The count is approximate; more drawings than the specified count may be displayed. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"max_labels_count",desc:"The number of last [label](#op_label) drawings displayed. Possible values: 1-500. The count is approximate; more drawings than the specified count may be displayed. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"max_boxes_count",desc:"The number of last [box](#op_box) drawings displayed. Possible values: 1-500. The count is approximate; more drawings than the specified count may be displayed. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"max_polylines_count",desc:"The number of last [polyline](#op_polyline) drawings displayed. Possible values: 1-100. The count is approximate; more drawings than the specified count may be displayed. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'indicator("My script", shorttitle="Script")',"plot(close)"],remarks:["Every indicator script must have one [indicator](#fun_indicator) call."],seeAlso:["[strategy](#fun_strategy)","[library](#fun_library)"],syntax:["indicator(title, shorttitle, overlay, format, precision, scale, max_bars_back, timeframe, timeframe_gaps, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count, max_polylines_count) → void"],returnedTypes:["void"]},{name:"plot",desc:["Plots a series of data on the chart."],args:[{name:"series",desc:"Series of data to be plotted. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"title",desc:"Title of the plot.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"color",desc:"Color of the plot. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"linewidth",desc:"Width of the plotted line. Default value is 1. Not applicable to every style.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"style",desc:"Type of plot. Possible values are: [plot.style_line](#var_plot.style_line), [plot.style_stepline](#var_plot.style_stepline), [plot.style_stepline_diamond](#var_plot.style_stepline_diamond), [plot.style_histogram](#var_plot.style_histogram), [plot.style_cross](#var_plot.style_cross), [plot.style_area](#var_plot.style_area), [plot.style_columns](#var_plot.style_columns), [plot.style_circles](#var_plot.style_circles), [plot.style_linebr](#var_plot.style_linebr), [plot.style_areabr](#var_plot.style_areabr), [plot.style_steplinebr](#var_plot.style_steplinebr). Default value is [plot.style_line](#var_plot.style_line).",allowedTypeIDs:["input plot_style","const plot_style"],displayType:"input plot_style"},{name:"trackprice",desc:"If true then a horizontal price line will be shown at the level of the last indicator value. Default is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"histbase",desc:"The price value used as the reference level when rendering plot with [plot.style_histogram](#var_plot.style_histogram), [plot.style_columns](#var_plot.style_columns) or [plot.style_area](#var_plot.style_area) style. Default is 0.0.",allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"offset",desc:"Shifts the plot to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"join",desc:"If true then plot points will be joined with line, applicable only to [plot.style_cross](#var_plot.style_cross) and [plot.style_circles](#var_plot.style_circles) styles. Default is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"editable",desc:"If true then plot style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of bars (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plot")',"plot(high+low, title='Title', color=color.new(#00ffaa, 70), linewidth=2, style=plot.style_area, offset=15, trackprice=true)","","// You may fill the background between any two plots with a fill() function:","p1 = plot(open)","p2 = plot(close)","fill(p1, p2, color=color.new(color.green, 90))"],returns:["A plot object, that can be used in [fill](#fun_fill)"],seeAlso:["[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)","[fill](#fun_fill)"],syntax:["plot(series, title, color, linewidth, style, trackprice, histbase, offset, join, editable, show_last, display, format, precision) → plot"],returnedTypes:["plot"]},{name:"plotshape",desc:["Plots visual shapes on the chart."],args:[{name:"series",desc:"Series of data to be plotted as shapes. Series is treated as a series of boolean values for all location values except [location.absolute](#var_location.absolute). Required argument.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool","series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series bool"},{name:"title",desc:"Title of the plot.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"style",desc:"Type of plot. Possible values are: [shape.xcross](#var_shape.xcross), [shape.cross](#var_shape.cross), [shape.triangleup](#var_shape.triangleup), [shape.triangledown](#var_shape.triangledown), [shape.flag](#var_shape.flag), [shape.circle](#var_shape.circle), [shape.arrowup](#var_shape.arrowup), [shape.arrowdown](#var_shape.arrowdown), [shape.labelup](#var_shape.labelup), [shape.labeldown](#var_shape.labeldown), [shape.square](#var_shape.square), [shape.diamond](#var_shape.diamond). Default value is [shape.xcross](#var_shape.xcross).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"location",desc:"Location of shapes on the chart. Possible values are: [location.abovebar](#var_location.abovebar), [location.belowbar](#var_location.belowbar), [location.top](#var_location.top), [location.bottom](#var_location.bottom), [location.absolute](#var_location.absolute). Default value is [location.abovebar](#var_location.abovebar).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"color",desc:"Color of the shapes. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"offset",desc:"Shifts shapes to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"Text to display with the shape. You can use multiline text, to separate lines use '\\n' escape sequence. Example: 'line one\\nline two'.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"textcolor",desc:"Color of the text. You can use constants like 'textcolor=color.red' or 'textcolor=#ff001a' as well as complex expressions like 'textcolor = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"editable",desc:"If true then plotshape style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"size",desc:"Size of shapes on the chart. Possible values are: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default is [size.auto](#var_size.auto).",allowedTypeIDs:["const string"],displayType:"const string"},{name:"show_last",desc:"If set, defines the number of shapes (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plotshape example 1", overlay=true)',"data = close >= open","plotshape(data, style=shape.xcross)"],remarks:["Use [plotshape](#fun_plotshape) function in conjunction with 'overlay=true' [indicator](#fun_indicator) parameter!"],seeAlso:["[plot](#fun_plot)","[plotchar](#fun_plotchar)","[plotarrow](#fun_plotarrow)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)"],syntax:["plotshape(series, title, style, location, color, offset, text, textcolor, editable, size, show_last, display, format, precision) → void"],returnedTypes:["void"]},{name:"plotchar",desc:["Plots visual shapes using any given one Unicode character on the chart."],args:[{name:"series",desc:"Series of data to be plotted as shapes. Series is treated as a series of boolean values for all location values except [location.absolute](#var_location.absolute). Required argument.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool","series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series bool"},{name:"title",desc:"Title of the plot.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"char",desc:"Character to use as a visual shape.",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"location",desc:"Location of shapes on the chart. Possible values are: [location.abovebar](#var_location.abovebar), [location.belowbar](#var_location.belowbar), [location.top](#var_location.top), [location.bottom](#var_location.bottom), [location.absolute](#var_location.absolute). Default value is [location.abovebar](#var_location.abovebar).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"color",desc:"Color of the shapes. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"offset",desc:"Shifts shapes to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"Text to display with the shape. You can use multiline text, to separate lines use '\\n' escape sequence. Example: 'line one\\nline two'.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"textcolor",desc:"Color of the text. You can use constants like 'textcolor=color.red' or 'textcolor=#ff001a' as well as complex expressions like 'textcolor = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"editable",desc:"If true then plotchar style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"size",desc:"Size of characters on the chart. Possible values are: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default is [size.auto](#var_size.auto).",allowedTypeIDs:["const string"],displayType:"const string"},{name:"show_last",desc:"If set, defines the number of chars (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plotchar example", overlay=true)',"data = close >= open","plotchar(data, char='❄')"],remarks:["Use [plotchar](#fun_plotchar) function in conjunction with 'overlay=true' [indicator](#fun_indicator) parameter!"],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotarrow](#fun_plotarrow)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)"],syntax:["plotchar(series, title, char, location, color, offset, text, textcolor, editable, size, show_last, display, format, precision) → void"],returnedTypes:["void"]},{name:"plotarrow",desc:["Plots up and down arrows on the chart. Up arrow is drawn at every indicator positive value, down arrow is drawn at every negative value. If indicator returns [na](#var_na) then no arrow is drawn. Arrows has different height, the more absolute indicator value the longer arrow is drawn."],args:[{name:"series",desc:"Series of data to be plotted as arrows. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"title",desc:"Title of the plot.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"colorup",desc:"Color of the up arrows. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"colordown",desc:"Color of the down arrows. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"offset",desc:"Shifts arrows to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"minheight",desc:"Minimal possible arrow height in pixels. Default is 5.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"maxheight",desc:"Maximum possible arrow height in pixels. Default is 100.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"editable",desc:"If true then plotarrow style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of arrows (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plotarrow example", overlay=true)',"codiff = close - open","plotarrow(codiff, colorup=color.new(color.teal,40), colordown=color.new(color.orange, 40))"],remarks:["Use [plotarrow](#fun_plotarrow) function in conjunction with 'overlay=true' [indicator](#fun_indicator) parameter!"],seeAlso:["[plot](#fun_plot)","[plotshape](#fun_plotshape)","[plotchar](#fun_plotchar)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)"],syntax:["plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, editable, show_last, display, format, precision) → void"],returnedTypes:["void"]},{name:"plotbar",desc:["Plots ohlc bars on the chart."],args:[{name:"open",desc:"Open series of data to be used as open values of bars. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"high",desc:"High series of data to be used as high values of bars. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"low",desc:"Low series of data to be used as low values of bars. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"close",desc:"Close series of data to be used as close values of bars. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"title",desc:"Title of the plotbar. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"color",desc:"Color of the ohlc bars. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"editable",desc:"If true then plotbar style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of bars (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plotbar example", overlay=true)',"plotbar(open, high, low, close, title='Title', color = open < close ? color.green : color.red)"],remarks:["Even if one value of open, high, low or close equal NaN then bar no draw.","The maximal value of open, high, low or close will be set as 'high', and the minimal value will be set as 'low'."],seeAlso:["[plotcandle](#fun_plotcandle)"],syntax:["plotbar(open, high, low, close, title, color, editable, show_last, display, format, precision) → void"],returnedTypes:["void"]},{name:"plotcandle",desc:["Plots candles on the chart."],args:[{name:"open",desc:"Open series of data to be used as open values of candles. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"high",desc:"High series of data to be used as high values of candles. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"low",desc:"Low series of data to be used as low values of candles. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"close",desc:"Close series of data to be used as close values of candles. Required argument.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"title",desc:"Title of the plotcandles. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"color",desc:"Color of the candles. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"wickcolor",desc:"The color of the wick of candles. An optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"editable",desc:"If true then plotcandle style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of candles (from the last bar back to the past) to plot on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"bordercolor",desc:"The border color of candles. An optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"display",desc:"Controls where the plot's information is displayed. Display options support addition and subtraction, meaning that using `display.all - display.status_line` will display the plot's information everywhere except in the script's status line. `display.price_scale + display.status_line` will display the plot only in the price scale and status line. When `display` arguments such as `display.price_scale` have user-controlled chart settings equivalents, the relevant plot information will only appear when all settings allow for it. Possible values: [display.none](#var_display.none), [display.pane](#var_display.pane), [display.data_window](#var_display.data_window), [display.price_scale](#var_display.price_scale), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_display","const plot_display","input plot_simple_display","const plot_simple_display"],displayType:"input plot_display"},{name:"format",desc:"Determines whether the script formats the plot's values as prices, percentages, or volume values. The argument passed to this parameter supersedes the `format` parameter of the [indicator](#fun_indicator), and [strategy](#fun_strategy) functions. Optional. The default is the `format` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function. Possible values: [format.price](#var_format.price), [format.percent](#var_format.percent), [format.volume](#var_format.volume).",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"precision",desc:"The number of digits after the decimal point the plot's values show on the chart pane's y-axis, the script's status line, and the Data Window. Accepts a non-negative integer less than or equal to 16. The argument passed to this parameter supersedes the `precision` parameter of the [indicator](#fun_indicator) and [strategy](#fun_strategy) functions. Optional. The default is the `precision` value used by the [indicator](#fun_indicator)/[strategy](#fun_strategy) function.",allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("plotcandle example", overlay=true)',"plotcandle(open, high, low, close, title='Title', color = open < close ? color.green : color.red, wickcolor=color.black)"],remarks:["Even if one value of open, high, low or close equal NaN then bar no draw.","The maximal value of open, high, low or close will be set as 'high', and the minimal value will be set as 'low'."],seeAlso:["[plotbar](#fun_plotbar)"],syntax:["plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor, display, format, precision) → void"],returnedTypes:["void"]},{name:"barcolor",desc:["Set color of bars."],args:[{name:"color",desc:"Color of bars. You can use constants like 'red' or '#ff001a' as well as complex expressions like 'close >= open ? color.green : color.red'. Required argument.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"offset",desc:"Shifts the color series to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"editable",desc:"If true then barcolor style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of bars (from the last bar back to the past) to fill on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"title",desc:"Title of the barcolor. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the barcolor is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"}],examples:["//@version=5",'indicator("barcolor example", overlay=true)',"barcolor(close < open ? color.black : color.white)"],seeAlso:["[bgcolor](#fun_bgcolor)","[plot](#fun_plot)","[fill](#fun_fill)"],syntax:["barcolor(color, offset, editable, show_last, title, display) → void"],returnedTypes:["void"]},{name:"bgcolor",desc:["Fill background of bars with specified color."],args:[{name:"color",desc:"Color of the filled background. You can use constants like 'red' or '#ff001a' as well as complex expressions like 'close >= open ? color.green : color.red'. Required argument.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"offset",desc:"Shifts the color series to the left or to the right on the given number of bars. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"editable",desc:"If true then bgcolor style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of bars (from the last bar back to the past) to fill on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"title",desc:"Title of the bgcolor. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the bgcolor is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"}],examples:["//@version=5",'indicator("bgcolor example", overlay=true)',"bgcolor(close < open ? color.new(color.red,70) : color.new(color.green, 70))"],seeAlso:["[barcolor](#fun_barcolor)","[plot](#fun_plot)","[fill](#fun_fill)"],syntax:["bgcolor(color, offset, editable, show_last, title, display) → void"],returnedTypes:["void"]},{name:"color.new",desc:["Function color applies the specified transparency to the given color."],args:[{name:"color",desc:"Color to apply transparency to.",required:!0,allowedTypeIDs:["const color"],displayType:"const color"},{name:"transp",desc:"Possible values are from 0 (not transparent) to 100 (invisible).",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],examples:["//@version=5",'indicator("color.new", overlay=true)',"plot(close, color=color.new(color.red, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.new(color, transp) → const color"],returnedTypes:["const color"]},{name:"color.new",desc:["Function color applies the specified transparency to the given color."],args:[{name:"color",desc:"Color to apply transparency to.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"transp",desc:"Possible values are from 0 (not transparent) to 100 (invisible).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("color.new", overlay=true)',"plot(close, color=color.new(color.red, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.new(color, transp) → series color"],returnedTypes:["series color"]},{name:"color.new",desc:["Function color applies the specified transparency to the given color."],args:[{name:"color",desc:"Color to apply transparency to.",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"},{name:"transp",desc:"Possible values are from 0 (not transparent) to 100 (invisible).",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],examples:["//@version=5",'indicator("color.new", overlay=true)',"plot(close, color=color.new(color.red, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.new(color, transp) → input color"],returnedTypes:["input color"]},{name:"color.rgb",desc:["Creates a new color with transparency using the RGB color model."],args:[{name:"red",desc:"Red color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"green",desc:"Green color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"blue",desc:"Blue color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"transp",desc:"Optional. Color transparency. Possible values are from 0 (opaque) to 100 (invisible). Default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("color.rgb", overlay=true)',"plot(close, color=color.rgb(255, 0, 0, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.rgb(red, green, blue, transp) → series color"],returnedTypes:["series color"]},{name:"color.rgb",desc:["Creates a new color with transparency using the RGB color model."],args:[{name:"red",desc:"Red color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"green",desc:"Green color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"blue",desc:"Blue color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"transp",desc:"Optional. Color transparency. Possible values are from 0 (opaque) to 100 (invisible). Default value is 0.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],examples:["//@version=5",'indicator("color.rgb", overlay=true)',"plot(close, color=color.rgb(255, 0, 0, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.rgb(red, green, blue, transp) → const color"],returnedTypes:["const color"]},{name:"color.rgb",desc:["Creates a new color with transparency using the RGB color model."],args:[{name:"red",desc:"Red color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"green",desc:"Green color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"blue",desc:"Blue color component. Possible values are from 0 to 255.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"transp",desc:"Optional. Color transparency. Possible values are from 0 (opaque) to 100 (invisible). Default value is 0.",allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],examples:["//@version=5",'indicator("color.rgb", overlay=true)',"plot(close, color=color.rgb(255, 0, 0, 50))"],returns:["Color with specified transparency."],remarks:[`Using arguments that are not constants (e.g., 'simple', 'input' or 'series') will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.rgb(red, green, blue, transp) → input color"],returnedTypes:["input color"]},{name:"color.r",desc:["Retrieves the value of the color's red component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("color.r", overlay=true)',"plot(color.r(color.red))"],returns:["The value (0 to 255) of the color's red component."],syntax:["color.r(color) → series float"],returnedTypes:["series float"]},{name:"color.r",desc:["Retrieves the value of the color's red component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["const color"],displayType:"const color"}],examples:["//@version=5",'indicator("color.r", overlay=true)',"plot(color.r(color.red))"],returns:["The value (0 to 255) of the color's red component."],syntax:["color.r(color) → const float"],returnedTypes:["const float"]},{name:"color.r",desc:["Retrieves the value of the color's red component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"}],examples:["//@version=5",'indicator("color.r", overlay=true)',"plot(color.r(color.red))"],returns:["The value (0 to 255) of the color's red component."],syntax:["color.r(color) → input float"],returnedTypes:["input float"]},{name:"color.g",desc:["Retrieves the value of the color's green component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("color.g", overlay=true)',"plot(color.g(color.green))"],returns:["The value (0 to 255) of the color's green component."],syntax:["color.g(color) → series float"],returnedTypes:["series float"]},{name:"color.g",desc:["Retrieves the value of the color's green component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["const color"],displayType:"const color"}],examples:["//@version=5",'indicator("color.g", overlay=true)',"plot(color.g(color.green))"],returns:["The value (0 to 255) of the color's green component."],syntax:["color.g(color) → const float"],returnedTypes:["const float"]},{name:"color.g",desc:["Retrieves the value of the color's green component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"}],examples:["//@version=5",'indicator("color.g", overlay=true)',"plot(color.g(color.green))"],returns:["The value (0 to 255) of the color's green component."],syntax:["color.g(color) → input float"],returnedTypes:["input float"]},{name:"color.b",desc:["Retrieves the value of the color's blue component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("color.b", overlay=true)',"plot(color.b(color.blue))"],returns:["The value (0 to 255) of the color's blue component."],syntax:["color.b(color) → series float"],returnedTypes:["series float"]},{name:"color.b",desc:["Retrieves the value of the color's blue component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["const color"],displayType:"const color"}],examples:["//@version=5",'indicator("color.b", overlay=true)',"plot(color.b(color.blue))"],returns:["The value (0 to 255) of the color's blue component."],syntax:["color.b(color) → const float"],returnedTypes:["const float"]},{name:"color.b",desc:["Retrieves the value of the color's blue component."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"}],examples:["//@version=5",'indicator("color.b", overlay=true)',"plot(color.b(color.blue))"],returns:["The value (0 to 255) of the color's blue component."],syntax:["color.b(color) → input float"],returnedTypes:["input float"]},{name:"color.t",desc:["Retrieves the color's transparency."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("color.t", overlay=true)',"plot(color.t(color.new(color.red, 50)))"],returns:["The value (0-100) of the color's transparency."],syntax:["color.t(color) → series float"],returnedTypes:["series float"]},{name:"color.t",desc:["Retrieves the color's transparency."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["const color"],displayType:"const color"}],examples:["//@version=5",'indicator("color.t", overlay=true)',"plot(color.t(color.new(color.red, 50)))"],returns:["The value (0-100) of the color's transparency."],syntax:["color.t(color) → const float"],returnedTypes:["const float"]},{name:"color.t",desc:["Retrieves the color's transparency."],args:[{name:"color",desc:"Color.",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"}],examples:["//@version=5",'indicator("color.t", overlay=true)',"plot(color.t(color.new(color.red, 50)))"],returns:["The value (0-100) of the color's transparency."],syntax:["color.t(color) → input float"],returnedTypes:["input float"]},{name:"color.from_gradient",desc:["Based on the relative position of value in the bottom_value to top_value range, the function returns a color from the gradient defined by bottom_color to top_color."],args:[{name:"value",desc:"Value to calculate the position-dependent color.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"bottom_value",desc:"Bottom position value corresponding to bottom_color.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"top_value",desc:"Top position value corresponding to top_color.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"bottom_color",desc:"Bottom position color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"top_color",desc:"Top position color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("color.from_gradient", overlay=true)',"color1 = color.from_gradient(close, low, high, color.yellow, color.lime)","color2 = color.from_gradient(ta.rsi(close, 7), 0, 100, color.rgb(255, 0, 0), color.rgb(0, 255, 0, 50))","plot(close, color=color1)","plot(ta.rsi(close,7), color=color2)"],returns:["A color calculated from the linear gradient between bottom_color to top_color."],remarks:[`Using this function will have an impact on the colors displayed in the script's "Settings/Style" tab. See the [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Colors.html#stylecolors) for more information.`],syntax:["color.from_gradient(value, bottom_value, top_value, bottom_color, top_color) → series color"],returnedTypes:["series color"]},{name:"alertcondition",desc:["Creates alert condition, that is available in Create Alert dialog. Please note, that [alertcondition](#fun_alertcondition) does NOT create an alert, it just gives you more options in Create Alert dialog. Also, [alertcondition](#fun_alertcondition) effect is invisible on chart."],args:[{name:"condition",desc:"Series of boolean values that is used for alert. True values mean alert fire, false - no alert. Required argument.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"title",desc:"Title of the alert condition. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"message",desc:"Message to display when alert fires. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"}],examples:["//@version=5",'indicator("alertcondition", overlay=true)',"alertcondition(close >= open, title='Alert on Green Bar', message='Green Bar!')"],remarks:["Please note that an alertcondition call generates an additional plot. All such calls are taken into account when we calculate the number of the output series per script."],seeAlso:["[alert](#fun_alert)"],syntax:["alertcondition(condition, title, message) → void"],returnedTypes:["void"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const bool"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, tooltip, inline, group, display) → input bool"],returnedTypes:["input bool"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const color"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, tooltip, inline, group, display) → input color"],returnedTypes:["input color"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const float"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, tooltip, inline, group, display) → input float"],returnedTypes:["input float"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const int"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, tooltip, inline, group, display) → input int"],returnedTypes:["input int"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const string"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, tooltip, inline, group, display) → input string"],returnedTypes:["input string"]},{name:"input",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget."],args:[{name:"defval",displayType:"const int/float/bool/string/color or source-type built-ins",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: `close`, `hlc3`, etc.',required:!0,allowedTypeIDs:["const float"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default depends on the type of the value passed to `defval`: [display.none](#var_display.none) for [bool](#op_bool) and [color](#op_color) values, [display.all](#var_display.all) for everything else.",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input", overlay=true)','i_switch = input(true, "On/Off")',"plot(i_switch ? open : na)","",'i_len = input(7, "Length")','i_src = input(close, "Source")',"plot(ta.sma(i_src, i_len))","",'i_border = input(142.50, "Price Border")',"hline(i_border)","bgcolor(close > i_border ? color.green : color.red)","",'i_col = input(color.red, "Plot Color")',"plot(close, color=i_col)","",'i_text = input("Hello!", "Message")',"l = label.new(bar_index, high, text=i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input](#fun_input) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.color](#fun_input.color)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.text_area](#fun_input.text_area)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)"],syntax:["input(defval, title, inline, group, tooltip, display) → series float"],returnedTypes:["series float"]},{name:"input.bool",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a checkmark to the script's inputs."],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,required:!0,allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.none](#var_display.none).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.bool", overlay=true)','i_switch = input.bool(true, "On/Off")',"plot(i_switch ? open : na)"],returns:["Value of input variable."],remarks:["Result of [input.bool](#fun_input.bool) function always should be assigned to a variable, see examples above."],seeAlso:["[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.bool(defval, title, tooltip, inline, group, confirm, display) → input bool"],returnedTypes:["input bool"]},{name:"input.int",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for an integer input to the script's inputs."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const int"],displayType:"const int"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"minval",desc:"Minimal possible value of the input variable. Optional.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"maxval",desc:"Maximum possible value of the input variable. Optional.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"step",desc:"Step value used for incrementing/decrementing the input. Optional. The default is 1.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.int", overlay=true)','i_len1 = input.int(10, "Length 1", minval=5, maxval=21, step=1)',"plot(ta.sma(close, i_len1))","",'i_len2 = input.int(10, "Length 2", options=[5, 10, 21])',"plot(ta.sma(close, i_len2))"],returns:["Value of input variable."],remarks:["Result of [input.int](#fun_input.int) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.int(defval, title, minval, maxval, step, tooltip, inline, group, confirm, display) → input int"],returnedTypes:["input int"]},{name:"input.int",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for an integer input to the script's inputs."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const int"],displayType:"const int"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"options",displayType:"tuple of const int values: [val1, val2, ...]",desc:"A list of options to choose from a dropdown menu, separated by commas and enclosed in square brackets: [val1, val2, ...]. When using this parameter, the `minval`, `maxval` and `step` parameters cannot be used.",allowedTypeIDs:["[const int...]"]},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.int", overlay=true)','i_len1 = input.int(10, "Length 1", minval=5, maxval=21, step=1)',"plot(ta.sma(close, i_len1))","",'i_len2 = input.int(10, "Length 2", options=[5, 10, 21])',"plot(ta.sma(close, i_len2))"],returns:["Value of input variable."],remarks:["Result of [input.int](#fun_input.int) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.int(defval, title, options, tooltip, inline, group, confirm, display) → input int"],returnedTypes:["input int"]},{name:"input.float",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for a float input to the script's inputs."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"minval",desc:"Minimal possible value of the input variable. Optional.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"maxval",desc:"Maximum possible value of the input variable. Optional.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"step",desc:"Step value used for incrementing/decrementing the input. Optional. The default is 1.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.float", overlay=true)','i_angle1 = input.float(0.5, "Sin Angle", minval=-3.14, maxval=3.14, step=0.02)','plot(math.sin(i_angle1) > 0 ? close : open, "sin", color=color.green)',"",'i_angle2 = input.float(0, "Cos Angle", options=[-3.14, -1.57, 0, 1.57, 3.14])','plot(math.cos(i_angle2) > 0 ? close : open, "cos", color=color.red)'],returns:["Value of input variable."],remarks:["Result of [input.float](#fun_input.float) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.float(defval, title, minval, maxval, step, tooltip, inline, group, confirm, display) → input float"],returnedTypes:["input float"]},{name:"input.float",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for a float input to the script's inputs."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where script users can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"options",displayType:"tuple of const int/float values: [val1, val2, ...]",desc:"A list of options to choose from a dropdown menu, separated by commas and enclosed in square brackets: [val1, val2, ...]. When using this parameter, the `minval`, `maxval` and `step` parameters cannot be used.",allowedTypeIDs:["[const float...]"]},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.float", overlay=true)','i_angle1 = input.float(0.5, "Sin Angle", minval=-3.14, maxval=3.14, step=0.02)','plot(math.sin(i_angle1) > 0 ? close : open, "sin", color=color.green)',"",'i_angle2 = input.float(0, "Cos Angle", options=[-3.14, -1.57, 0, 1.57, 3.14])','plot(math.cos(i_angle2) > 0 ? close : open, "cos", color=color.red)'],returns:["Value of input variable."],remarks:["Result of [input.float](#fun_input.float) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.float(defval, title, options, tooltip, inline, group, confirm, display) → input float"],returnedTypes:["input float"]},{name:"input.string",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for a string input to the script's inputs."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where the user can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"options",displayType:"tuple of const string values: [val1, val2, ...]",desc:"A list of options to choose from.",allowedTypeIDs:["[const string...]"]},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.string", overlay=true)','i_text = input.string("Hello!", "Message")',"l = label.new(bar_index, high, i_text)","label.delete(l[1])"],returns:["Value of input variable."],remarks:["Result of [input.string](#fun_input.string) function always should be assigned to a variable, see examples above."],seeAlso:["[input.text_area](#fun_input.text_area)","[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.string(defval, title, options, tooltip, inline, group, confirm, display) → input string"],returnedTypes:["input string"]},{name:"input.text_area",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field for a multiline text input."],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.none](#var_display.none).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.text_area")','i_text = input.text_area(defval = "Hello \\nWorld!", title = "Message")',"plot(close)"],returns:["Value of input variable."],remarks:["Result of [input.text_area](#fun_input.text_area) function always should be assigned to a variable, see examples above."],seeAlso:["[input.string](#fun_input.string)","[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.text_area(defval, title, tooltip, group, confirm, display) → input string"],returnedTypes:["input string"]},{name:"input.symbol",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a field that allows the user to select a specific symbol using the symbol search and returns that symbol, paired with its exchange prefix, as a string."],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.symbol", overlay=true)','i_sym = input.symbol("DELL", "Symbol")',"s = request.security(i_sym, 'D', close)","plot(s)"],returns:["Value of input variable."],remarks:["Result of [input.symbol](#fun_input.symbol) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.symbol(defval, title, tooltip, inline, group, confirm, display) → input string"],returnedTypes:["input string"]},{name:"input.timeframe",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a dropdown that allows the user to select a specific timeframe via the timeframe selector and returns it as a string. The selector includes the custom timeframes a user may have added using the chart's Timeframe dropdown."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where the user can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"options",displayType:"tuple of const string values: [val1, val2, ...]",desc:"A list of options to choose from.",allowedTypeIDs:["[const string...]"]},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.timeframe", overlay=true)',`i_res = input.timeframe('D', "Resolution", options=['D', 'W', 'M'])`,'s = request.security("AAPL", i_res, close)',"plot(s)"],returns:["Value of input variable."],remarks:["Result of [input.timeframe](#fun_input.timeframe) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.timeframe(defval, title, options, tooltip, inline, group, confirm, display) → input string"],returnedTypes:["input string"]},{name:"input.session",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds two dropdowns that allow the user to specify the beginning and the end of a session using the session selector and returns the result as a string."],args:[{name:"defval",desc:'Determines the default value of the input variable proposed in the script\'s "Settings/Inputs" tab, from where the user can change it. When a list of values is used with the `options` parameter, the value must be one of them.',required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"options",displayType:"tuple of const string values: [val1, val2, ...]",desc:"A list of options to choose from.",allowedTypeIDs:["[const string...]"]},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.session", overlay=true)','i_sess = input.session("1300-1700", "Session", options=["0930-1600", "1300-1700", "1700-2100"])',"t = time(timeframe.period, i_sess)","bgcolor(time == t ? color.green : na)"],returns:["Value of input variable."],remarks:["Result of [input.session](#fun_input.session) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.session(defval, title, options, tooltip, inline, group, confirm, display) → input string"],returnedTypes:["input string"]},{name:"input.source",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a dropdown that allows the user to select a source for the calculation, e.g. [close](#var_close), [hl2](#var_hl2), etc. The user can also select an output from another indicator on their chart as the source."],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,displayType:"open/high/low/close/hl2/hlc3/ohlc4/hlcc4",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"]},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.source", overlay=true)','i_src = input.source(close, "Source")',"plot(i_src)"],returns:["Value of input variable."],remarks:["Result of [input.source](#fun_input.source) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.color](#fun_input.color)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.source(defval, title, tooltip, inline, group, display) → series float"],returnedTypes:["series float"]},{name:"input.color",desc:["Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function adds a color picker that allows the user to select a color and transparency, either from a palette or a hex value."],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,required:!0,allowedTypeIDs:["const color"],displayType:"const color"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.none](#var_display.none).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.color", overlay=true)','i_col = input.color(color.red, "Plot Color")',"plot(close, color=i_col)"],returns:["Value of input variable."],remarks:["Result of [input.color](#fun_input.color) function always should be assigned to a variable, see examples above."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.time](#fun_input.time)","[input](#fun_input)"],syntax:["input.color(defval, title, tooltip, inline, group, confirm, display) → input color"],returnedTypes:["input color"]},{name:"input.time",desc:['Adds a time input to the script\'s "Settings/Inputs" tab. This function adds two input widgets on the same line: one for the date and one for the time. The function returns a date/time value in UNIX format. Using `confirm = true` activates the interactive input mode where a point in time is selected by clicking on the chart.'],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it. The value can be a [timestamp](#fun_timestamp) function, but only if it uses a date argument in const string format.`,required:!0,allowedTypeIDs:["const int"],displayType:"const int"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, the interactive input mode is enabled and the selection is done by clicking on the chart when the indicator is added to the chart, or by selecting the indicator and moving the selection after that. Optional. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.none](#var_display.none).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.time", overlay=true)','i_date = input.time(timestamp("20 Jul 2021 00:00 +0300"), "Date")','l = label.new(i_date, high, "Date", xloc=xloc.bar_time)',"label.delete(l[1])"],returns:["Value of input variable."],remarks:["When using interactive mode, a price input can be combined with a time input if both function calls use the same argument for their `inline` parameter."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.timeframe](#fun_input.timeframe)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input](#fun_input)"],syntax:["input.time(defval, title, tooltip, inline, group, confirm, display) → input int"],returnedTypes:["input int"]},{name:"input.price",desc:['Adds a price input to the script\'s "Settings/Inputs" tab. Using `confirm = true` activates the interactive input mode where a price is selected by clicking on the chart.'],args:[{name:"defval",desc:`Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.`,required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"title",desc:"Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"tooltip",desc:"The string that will be shown to the user when hovering over the tooltip icon.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"inline",desc:"Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"group",desc:"Creates a header above all inputs using the same group argument string. The string is also used as the header's text.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"confirm",desc:"If true, the interactive input mode is enabled and the selection is done by clicking on the chart when the indicator is added to the chart, or by selecting the indicator and moving the selection after that. Optional. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the script will display the input's information, aside from within the script's settings. This option allows one to remove a specific input from the script's status line or the Data Window to ensure only the most necessary inputs are displayed there. Possible values: [display.none](#var_display.none), [display.data_window](#var_display.data_window), [display.status_line](#var_display.status_line), [display.all](#var_display.all). Optional. The default is [display.all](#var_display.all).",allowedTypeIDs:["const plot_display","const plot_simple_display"],displayType:"const plot_display"}],examples:["//@version=5",'indicator("input.price", overlay=true)','price1 = input.price(title="Date", defval=42)',"plot(price1)","",'price2 = input.price(54, title="Date")',"plot(price2)"],returns:["Value of input variable."],remarks:["When using interactive mode, a time input can be combined with a price input if both function calls use the same argument for their `inline` parameter."],seeAlso:["[input.bool](#fun_input.bool)","[input.int](#fun_input.int)","[input.float](#fun_input.float)","[input.string](#fun_input.string)","[input.text_area](#fun_input.text_area)","[input.symbol](#fun_input.symbol)","[input.resolution](#fun_input.resolution)","[input.session](#fun_input.session)","[input.source](#fun_input.source)","[input.color](#fun_input.color)","[input](#fun_input)"],syntax:["input.price(defval, title, tooltip, inline, group, confirm, display) → input float"],returnedTypes:["input float"]},{name:"hline",desc:["Renders a horizontal line at a given fixed price level."],args:[{name:"price",desc:"Price value at which the object will be rendered. Required argument.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"title",desc:"Title of the object.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"color",desc:"Color of the rendered line. Must be a constant value (not an expression). Optional argument.",allowedTypeIDs:["input color","const color"],displayType:"input color"},{name:"linestyle",desc:"Style of the rendered line. Possible values are: [hline.style_solid](#var_hline.style_solid), [hline.style_dotted](#var_hline.style_dotted), [hline.style_dashed](#var_hline.style_dashed). Optional argument.",allowedTypeIDs:["input hline_style","const hline_style"],displayType:"input hline_style"},{name:"linewidth",desc:"Width of the rendered line. Default value is 1.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"editable",desc:"If true then hline style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the hline is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"}],examples:["//@version=5",'indicator("input.hline", overlay=true)',"hline(3.14, title='Pi', color=color.blue, linestyle=hline.style_dotted, linewidth=2)","","// You may fill the background between any two hlines with a fill() function:","h1 = hline(20)","h2 = hline(10)","fill(h1, h2, color=color.new(color.green, 90))"],returns:["An hline object, that can be used in [fill](#fun_fill)"],seeAlso:["[fill](#fun_fill)"],syntax:["hline(price, title, color, linestyle, linewidth, editable, display) → hline"],returnedTypes:["hline"]},{name:"fill",desc:["Fills background between two plots or hlines with a given color."],args:[{name:"plot1",desc:"The first plot object. Required argument.",required:!0,allowedTypeIDs:["plot"],displayType:"plot"},{name:"plot2",desc:"The second plot object. Required argument.",required:!0,allowedTypeIDs:["plot"],displayType:"plot"},{name:"top_value",desc:"Value where the gradient uses the `top_color`.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"bottom_value",desc:"Value where the gradient uses the `bottom_color`.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"top_color",desc:"Color of the gradient at the topmost value.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"bottom_color",desc:"Color of the gradient at the bottommost value.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"title",desc:"Title of the created fill object. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"display",desc:"Controls where the fill is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"},{name:"fillgaps",desc:"Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"editable",desc:"If true then fill style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"}],detailedDesc:[{desc:["Fill between two horizontal lines"],examples:["//@version=5",'indicator("Fill between hlines", overlay = false)',"h1 = hline(20)","h2 = hline(10)","fill(h1, h2, color = color.new(color.blue, 90))"]},{desc:["Fill between two plots"],examples:["//@version=5",'indicator("Fill between plots", overlay = true)',"p1 = plot(open)","p2 = plot(close)","fill(p1, p2, color = color.new(color.green, 90))"]},{desc:["Gradient fill between two horizontal lines"],examples:["//@version=5",'indicator("Gradient Fill between hlines", overlay = false)',"topVal = input.int(100)","botVal = input.int(0)","topCol = input.color(color.red)","botCol = input.color(color.blue)","topLine = hline(100, color = topCol, linestyle = hline.style_solid)","botLine = hline(0, color = botCol, linestyle = hline.style_solid)","fill(topLine, botLine, topVal, botVal, topCol, botCol)"]}],seeAlso:["[plot](#fun_plot)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)","[hline](#fun_hline)","[color.new](#fun_color.new)"],syntax:["fill(plot1, plot2, top_value, bottom_value, top_color, bottom_color, title, display, fillgaps, editable) → void"],returnedTypes:["void"]},{name:"fill",desc:["Fills background between two plots or hlines with a given color."],args:[{name:"hline1",desc:"The first hline object. Required argument.",required:!0,allowedTypeIDs:["hline"],displayType:"hline"},{name:"hline2",desc:"The second hline object. Required argument.",required:!0,allowedTypeIDs:["hline"],displayType:"hline"},{name:"color",desc:"Color of the background fill. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"title",desc:"Title of the created fill object. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"editable",desc:"If true then fill style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"fillgaps",desc:"Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the fill is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"}],detailedDesc:[{desc:["Fill between two horizontal lines"],examples:["//@version=5",'indicator("Fill between hlines", overlay = false)',"h1 = hline(20)","h2 = hline(10)","fill(h1, h2, color = color.new(color.blue, 90))"]},{desc:["Fill between two plots"],examples:["//@version=5",'indicator("Fill between plots", overlay = true)',"p1 = plot(open)","p2 = plot(close)","fill(p1, p2, color = color.new(color.green, 90))"]},{desc:["Gradient fill between two horizontal lines"],examples:["//@version=5",'indicator("Gradient Fill between hlines", overlay = false)',"topVal = input.int(100)","botVal = input.int(0)","topCol = input.color(color.red)","botCol = input.color(color.blue)","topLine = hline(100, color = topCol, linestyle = hline.style_solid)","botLine = hline(0, color = botCol, linestyle = hline.style_solid)","fill(topLine, botLine, topVal, botVal, topCol, botCol)"]}],seeAlso:["[plot](#fun_plot)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)","[hline](#fun_hline)","[color.new](#fun_color.new)"],syntax:["fill(hline1, hline2, color, title, editable, fillgaps, display) → void"],returnedTypes:["void"]},{name:"fill",desc:["Fills background between two plots or hlines with a given color."],args:[{name:"plot1",desc:"The first plot object. Required argument.",required:!0,allowedTypeIDs:["plot"],displayType:"plot"},{name:"plot2",desc:"The second plot object. Required argument.",required:!0,allowedTypeIDs:["plot"],displayType:"plot"},{name:"color",desc:"Color of the background fill. You can use constants like 'color=color.red' or 'color=#ff001a' as well as complex expressions like 'color = close >= open ? color.green : color.red'. Optional argument.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"title",desc:"Title of the created fill object. Optional argument.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"editable",desc:"If true then fill style will be editable in Format dialog. Default is true.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"show_last",desc:"If set, defines the number of bars (from the last bar back to the past) to fill on chart.",allowedTypeIDs:["input int","const int"],displayType:"input int"},{name:"fillgaps",desc:"Controls continuing fills on gaps, i.e., when one of the plot() calls returns an na value. When true, the last fill will continue on gaps. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"display",desc:"Controls where the fill is displayed. Possible values are: [display.none](#var_display.none), [display.all](#var_display.all). Default is [display.all](#var_display.all).",allowedTypeIDs:["input plot_simple_display","const plot_simple_display"],displayType:"input plot_simple_display"}],detailedDesc:[{desc:["Fill between two horizontal lines"],examples:["//@version=5",'indicator("Fill between hlines", overlay = false)',"h1 = hline(20)","h2 = hline(10)","fill(h1, h2, color = color.new(color.blue, 90))"]},{desc:["Fill between two plots"],examples:["//@version=5",'indicator("Fill between plots", overlay = true)',"p1 = plot(open)","p2 = plot(close)","fill(p1, p2, color = color.new(color.green, 90))"]},{desc:["Gradient fill between two horizontal lines"],examples:["//@version=5",'indicator("Gradient Fill between hlines", overlay = false)',"topVal = input.int(100)","botVal = input.int(0)","topCol = input.color(color.red)","botCol = input.color(color.blue)","topLine = hline(100, color = topCol, linestyle = hline.style_solid)","botLine = hline(0, color = botCol, linestyle = hline.style_solid)","fill(topLine, botLine, topVal, botVal, topCol, botCol)"]}],seeAlso:["[plot](#fun_plot)","[barcolor](#fun_barcolor)","[bgcolor](#fun_bgcolor)","[hline](#fun_hline)","[color.new](#fun_color.new)"],syntax:["fill(plot1, plot2, color, title, editable, show_last, fillgaps, display) → void"],returnedTypes:["void"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → simple int"],returnedTypes:["simple int"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → simple float"],returnedTypes:["simple float"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple color","input color","const color"],displayType:"simple color"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → simple color"],returnedTypes:["simple color"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → simple bool"],returnedTypes:["simple bool"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → series int"],returnedTypes:["series int"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → series float"],returnedTypes:["series float"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → series color"],returnedTypes:["series color"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source) → series bool"],returnedTypes:["series bool"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → simple int"],returnedTypes:["simple int"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → simple float"],returnedTypes:["simple float"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple color","input color","const color"],displayType:"simple color"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["simple color","input color","const color"],displayType:"simple color"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → simple color"],returnedTypes:["simple color"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → simple bool"],returnedTypes:["simple bool"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → series int"],returnedTypes:["series int"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → series float"],returnedTypes:["series float"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → series color"],returnedTypes:["series color"]},{name:"nz",desc:["Replaces NaN values with zeros (or given value) in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"replacement",desc:"Value that will replace all ‘na’ values in the `source` series.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("nz", overlay=true)',"plot(nz(ta.sma(close, 100)))"],returns:["The value of `source` if it is not `na`. If the value of `source` is `na`, returns zero, or the `replacement` argument when one is used."],seeAlso:["[na](#var_na)","[na](#fun_na)","[fixnan](#fun_fixnan)"],syntax:["nz(source, replacement) → series bool"],returnedTypes:["series bool"]},{name:"na",desc:["Tests if `x` is [na](#var_na)."],args:[{name:"x",desc:"Value to be tested.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("na")',"// Use the `na()` function to test for `na`.","plot(na(close[1]) ? close : close[1])","// ALTERNATIVE","// `nz()` also tests `close[1]` for `na`. It returns `close[1]` if it is not `na`, and `close` if it is.","plot(nz(close[1], close))"],returns:["Returns [true](#var_true) if `x` is [na](#var_na), [false](#var_false) otherwise."],seeAlso:["[na](#var_na)","[fixnan](#fun_fixnan)","[nz](#fun_nz)"],syntax:["na(x) → simple bool"],returnedTypes:["simple bool"]},{name:"na",desc:["Tests if `x` is [na](#var_na)."],args:[{name:"x",desc:"Value to be tested.",required:!0,allowedTypeIDs:[],displayType:"<arg_type>"}],examples:["//@version=5",'indicator("na")',"// Use the `na()` function to test for `na`.","plot(na(close[1]) ? close : close[1])","// ALTERNATIVE","// `nz()` also tests `close[1]` for `na`. It returns `close[1]` if it is not `na`, and `close` if it is.","plot(nz(close[1], close))"],returns:["Returns [true](#var_true) if `x` is [na](#var_na), [false](#var_false) otherwise."],seeAlso:["[na](#var_na)","[fixnan](#fun_fixnan)","[nz](#fun_nz)"],syntax:["na(x) → series bool"],returnedTypes:["series bool"]},{name:"ta.tr",args:[{name:"handle_na",desc:"How NaN values are handled. if true, and previous day's close is NaN then tr would be calculated as current day high-low. Otherwise (if false) tr would return NaN in such cases. Also note, that [ta.atr](#fun_ta.atr) uses ta.tr(true).",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],returns:["True range. It is math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))."],remarks:["ta.tr(false) is exactly the same as [ta.tr](#var_ta.tr)."],seeAlso:["[ta.tr](#var_ta.tr)","[ta.atr](#fun_ta.atr)"],syntax:["ta.tr(handle_na) → series float"],returnedTypes:["series float"]},{name:"math.pow",desc:["Mathematical power function."],args:[{name:"base",desc:"Specify the base to use.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"exponent",desc:"Specifies the exponent.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("math.pow", overlay=true)',"plot(math.pow(close, 2))"],returns:["`base` raised to the power of `exponent`. If `base` is a series, it is calculated elementwise."],seeAlso:["[math.sqrt](#fun_math.sqrt)","[math.exp](#fun_math.exp)"],syntax:["math.pow(base, exponent) → simple float"],returnedTypes:["simple float"]},{name:"math.pow",desc:["Mathematical power function."],args:[{name:"base",desc:"Specify the base to use.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"exponent",desc:"Specifies the exponent.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],examples:["//@version=5",'indicator("math.pow", overlay=true)',"plot(math.pow(close, 2))"],returns:["`base` raised to the power of `exponent`. If `base` is a series, it is calculated elementwise."],seeAlso:["[math.sqrt](#fun_math.sqrt)","[math.exp](#fun_math.exp)"],syntax:["math.pow(base, exponent) → input float"],returnedTypes:["input float"]},{name:"math.pow",desc:["Mathematical power function."],args:[{name:"base",desc:"Specify the base to use.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"exponent",desc:"Specifies the exponent.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],examples:["//@version=5",'indicator("math.pow", overlay=true)',"plot(math.pow(close, 2))"],returns:["`base` raised to the power of `exponent`. If `base` is a series, it is calculated elementwise."],seeAlso:["[math.sqrt](#fun_math.sqrt)","[math.exp](#fun_math.exp)"],syntax:["math.pow(base, exponent) → const float"],returnedTypes:["const float"]},{name:"math.pow",desc:["Mathematical power function."],args:[{name:"base",desc:"Specify the base to use.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"exponent",desc:"Specifies the exponent.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("math.pow", overlay=true)',"plot(math.pow(close, 2))"],returns:["`base` raised to the power of `exponent`. If `base` is a series, it is calculated elementwise."],seeAlso:["[math.sqrt](#fun_math.sqrt)","[math.exp](#fun_math.exp)"],syntax:["math.pow(base, exponent) → series float"],returnedTypes:["series float"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → simple int"],returnedTypes:["simple int"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → simple float"],returnedTypes:["simple float"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → input int"],returnedTypes:["input int"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → input float"],returnedTypes:["input float"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → series int"],returnedTypes:["series int"]},{name:"math.min",desc:["Returns the smallest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("math.min", overlay=true)',"plot(math.min(close, open))","plot(math.min(close, math.min(open, 42)))"],returns:["The smallest of multiple given values."],seeAlso:["[math.max](#fun_math.max)"],syntax:["math.min(number0, number1, ...) → series float"],returnedTypes:["series float"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → simple int"],returnedTypes:["simple int"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → simple float"],returnedTypes:["simple float"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int"],displayType:"input int"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → input int"],returnedTypes:["input int"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → input float"],returnedTypes:["input float"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → series int"],returnedTypes:["series int"]},{name:"math.max",desc:["Returns the greatest of multiple values."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("math.max", overlay=true)',"plot(math.max(close, open))","plot(math.max(close, math.max(open, 42)))"],returns:["The greatest of multiple given values."],seeAlso:["[math.min](#fun_math.min)"],syntax:["math.max(number0, number1, ...) → series float"],returnedTypes:["series float"]},{name:"str.format",desc:["Converts the formatting string and value(s) into a formatted string. The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the str.format argument list."],args:[{name:"formatString",desc:"Format string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"arg0, arg1, ...",desc:"Values to format.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float","simple bool","input bool","const bool","simple string","input string","const string"],displayType:"simple int/float/bool/string"}],examples:["//@version=5",'indicator("str.format", overlay=true)',"// The format specifier inside the curly braces accepts certain modifiers:","// - Specify the number of decimals to display:",'s1 = str.format("{0,number,#.#}", 1.34) // returns: 1.3',"label.new(bar_index, close, text=s1)","// - Round a float value to an integer:",'s2 = str.format("{0,number,integer}", 1.34) // returns: 1',"label.new(bar_index - 1, close, text=s2)","// - Display a number in currency:",'s3 = str.format("{0,number,currency}", 1.34) // returns: $1.34',"label.new(bar_index - 2, close, text=s3)","// - Display a number as a percentage:",'s4 = str.format("{0,number,percent}", 0.5) // returns: 50%',"label.new(bar_index - 3, close, text=s4)","// EXAMPLES WITH SEVERAL ARGUMENTS","// returns: Number 1 is not equal to 4",'s5 = str.format("Number {0} is not {1} to {2}", 1, "equal", 4)',"label.new(bar_index - 4, close, text=s5)","// returns: 1.34 != 1.3",'s6 = str.format("{0} != {0, number, #.#}", 1.34)',"label.new(bar_index - 5, close, text=s6)","// returns: 1 is equal to 1, but 2 is equal to 2",'s7 = str.format("{0, number, integer} is equal to 1, but {1, number, integer} is equal to 2", 1.34, 1.52)',"label.new(bar_index - 6, close, text=s7)","// returns: The cash turnover amounted to $1,340,000.00",'s8 = str.format("The cash turnover amounted to {0, number, currency}", 1340000)',"label.new(bar_index - 7, close, text=s8)","// returns: Expected return is 10% - 20%",'s9 = str.format("Expected return is {0, number, percent} - {1, number, percent}", 0.1, 0.2)',"label.new(bar_index - 8, close, text=s9)"],returns:["The formatted string."],remarks:["By default, formatted numbers will display up to three decimals with no trailing zeros.","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.",`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`],syntax:["str.format(formatString, arg0, arg1, ...) → simple string"],returnedTypes:["simple string"]},{name:"str.format",desc:["Converts the formatting string and value(s) into a formatted string. The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the str.format argument list."],args:[{name:"formatString",desc:"Format string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"arg0, arg1, ...",desc:"Values to format.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series string","simple string","input string","const string","int[]","float[]","bool[]","string[]"],displayType:"series int/float/bool/string/int[]/float[]/bool[]/string[]"}],examples:["//@version=5",'indicator("str.format", overlay=true)',"// The format specifier inside the curly braces accepts certain modifiers:","// - Specify the number of decimals to display:",'s1 = str.format("{0,number,#.#}", 1.34) // returns: 1.3',"label.new(bar_index, close, text=s1)","// - Round a float value to an integer:",'s2 = str.format("{0,number,integer}", 1.34) // returns: 1',"label.new(bar_index - 1, close, text=s2)","// - Display a number in currency:",'s3 = str.format("{0,number,currency}", 1.34) // returns: $1.34',"label.new(bar_index - 2, close, text=s3)","// - Display a number as a percentage:",'s4 = str.format("{0,number,percent}", 0.5) // returns: 50%',"label.new(bar_index - 3, close, text=s4)","// EXAMPLES WITH SEVERAL ARGUMENTS","// returns: Number 1 is not equal to 4",'s5 = str.format("Number {0} is not {1} to {2}", 1, "equal", 4)',"label.new(bar_index - 4, close, text=s5)","// returns: 1.34 != 1.3",'s6 = str.format("{0} != {0, number, #.#}", 1.34)',"label.new(bar_index - 5, close, text=s6)","// returns: 1 is equal to 1, but 2 is equal to 2",'s7 = str.format("{0, number, integer} is equal to 1, but {1, number, integer} is equal to 2", 1.34, 1.52)',"label.new(bar_index - 6, close, text=s7)","// returns: The cash turnover amounted to $1,340,000.00",'s8 = str.format("The cash turnover amounted to {0, number, currency}", 1340000)',"label.new(bar_index - 7, close, text=s8)","// returns: Expected return is 10% - 20%",'s9 = str.format("Expected return is {0, number, percent} - {1, number, percent}", 0.1, 0.2)',"label.new(bar_index - 8, close, text=s9)"],returns:["The formatted string."],remarks:["By default, formatted numbers will display up to three decimals with no trailing zeros.","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.",`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`],syntax:["str.format(formatString, arg0, arg1, ...) → series string"],returnedTypes:["series string"]},{name:"str.format_time",desc:["Converts the `time` timestamp into a string formatted according to `format` and `timezone`."],args:[{name:"time",desc:"UNIX time, in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"format",desc:"A format string specifying the date/time representation of the `time` in the returned string. All letters used in the string, except those escaped by single quotation marks `'`, are considered formatting tokens and will be used as a formatting instruction. Refer to the Remarks section for a list of the most useful tokens. Optional. The default is \"yyyy-MM-dd'T'HH:mm:ssZ\", which represents the ISO 8601 standard.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an [IANA time zone database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("str.format_time")','if timeframe.change("1D")',' formattedTime = str.format_time(time, "yyyy-MM-dd HH:mm", syminfo.timezone)'," label.new(bar_index, high, formattedTime)"],returns:["The formatted string."],remarks:["The `M`, `d`, `h`, `H`, `m` and `s` tokens can all be doubled to generate leading zeros. For example, the month of January will display as `1` with `M`, or `01` with `MM`.","","The most frequently used formatting tokens are:","","y - Year. Use `yy` to output the last two digits of the year or `yyyy` to output all four. Year 2000 will be `00` with `yy` or `2000` with `yyyy`.","M - Month. Not to be confused with lowercase `m`, which stands for minute.","d - Day of the month.","a - AM/PM postfix.","h - Hour in the 12-hour format. The last hour of the day will be `11` in this format.","H - Hour in the 24-hour format. The last hour of the day will be `23` in this format.","m - Minute.","s - Second.","S - Fractions of a second.","Z - Timezone, the HHmm offset from UTC, preceded by either `+` or `-`."],syntax:["str.format_time(time, format, timezone) → series string"],returnedTypes:["series string"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → simple int"],returnedTypes:["simple int"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int"],displayType:"input int"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → input int"],returnedTypes:["input int"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → const int"],returnedTypes:["const int"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → series int"],returnedTypes:["series int"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → simple float"],returnedTypes:["simple float"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → input float"],returnedTypes:["input float"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → const float"],returnedTypes:["const float"]},{name:"math.abs",desc:["Absolute value of `number` is `number` if `number` >= 0, or -`number` otherwise."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The absolute value of `number`."],syntax:["math.abs(number) → series float"],returnedTypes:["series float"]},{name:"math.log",desc:["Natural logarithm of any `number` > 0 is the unique y such that e^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The natural logarithm of `number`."],seeAlso:["[math.log10](#fun_math.log10)"],syntax:["math.log(number) → simple float"],returnedTypes:["simple float"]},{name:"math.log",desc:["Natural logarithm of any `number` > 0 is the unique y such that e^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The natural logarithm of `number`."],seeAlso:["[math.log10](#fun_math.log10)"],syntax:["math.log(number) → input float"],returnedTypes:["input float"]},{name:"math.log",desc:["Natural logarithm of any `number` > 0 is the unique y such that e^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The natural logarithm of `number`."],seeAlso:["[math.log10](#fun_math.log10)"],syntax:["math.log(number) → const float"],returnedTypes:["const float"]},{name:"math.log",desc:["Natural logarithm of any `number` > 0 is the unique y such that e^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The natural logarithm of `number`."],seeAlso:["[math.log10](#fun_math.log10)"],syntax:["math.log(number) → series float"],returnedTypes:["series float"]},{name:"math.log10",desc:["The common (or base 10) logarithm of `number` is the power to which 10 must be raised to obtain the `number`. 10^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The base 10 logarithm of `number`."],seeAlso:["[math.log](#fun_math.log)"],syntax:["math.log10(number) → simple float"],returnedTypes:["simple float"]},{name:"math.log10",desc:["The common (or base 10) logarithm of `number` is the power to which 10 must be raised to obtain the `number`. 10^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The base 10 logarithm of `number`."],seeAlso:["[math.log](#fun_math.log)"],syntax:["math.log10(number) → input float"],returnedTypes:["input float"]},{name:"math.log10",desc:["The common (or base 10) logarithm of `number` is the power to which 10 must be raised to obtain the `number`. 10^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The base 10 logarithm of `number`."],seeAlso:["[math.log](#fun_math.log)"],syntax:["math.log10(number) → const float"],returnedTypes:["const float"]},{name:"math.log10",desc:["The common (or base 10) logarithm of `number` is the power to which 10 must be raised to obtain the `number`. 10^y = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The base 10 logarithm of `number`."],seeAlso:["[math.log](#fun_math.log)"],syntax:["math.log10(number) → series float"],returnedTypes:["series float"]},{name:"math.sqrt",desc:["Square root of any `number` >= 0 is the unique y >= 0 such that y^2 = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The square root of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.sqrt(number) → simple float"],returnedTypes:["simple float"]},{name:"math.sqrt",desc:["Square root of any `number` >= 0 is the unique y >= 0 such that y^2 = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The square root of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.sqrt(number) → input float"],returnedTypes:["input float"]},{name:"math.sqrt",desc:["Square root of any `number` >= 0 is the unique y >= 0 such that y^2 = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The square root of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.sqrt(number) → const float"],returnedTypes:["const float"]},{name:"math.sqrt",desc:["Square root of any `number` >= 0 is the unique y >= 0 such that y^2 = `number`."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The square root of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.sqrt(number) → series float"],returnedTypes:["series float"]},{name:"math.sign",desc:["Sign (signum) of `number` is zero if `number` is zero, 1.0 if `number` is greater than zero, -1.0 if `number` is less than zero."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The sign of the argument."],syntax:["math.sign(number) → simple float"],returnedTypes:["simple float"]},{name:"math.sign",desc:["Sign (signum) of `number` is zero if `number` is zero, 1.0 if `number` is greater than zero, -1.0 if `number` is less than zero."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The sign of the argument."],syntax:["math.sign(number) → input float"],returnedTypes:["input float"]},{name:"math.sign",desc:["Sign (signum) of `number` is zero if `number` is zero, 1.0 if `number` is greater than zero, -1.0 if `number` is less than zero."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The sign of the argument."],syntax:["math.sign(number) → const float"],returnedTypes:["const float"]},{name:"math.sign",desc:["Sign (signum) of `number` is zero if `number` is zero, 1.0 if `number` is greater than zero, -1.0 if `number` is less than zero."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The sign of the argument."],syntax:["math.sign(number) → series float"],returnedTypes:["series float"]},{name:"math.exp",desc:["The exp function of `number` is e raised to the power of `number`, where e is Euler's number."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["A value representing e raised to the power of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.exp(number) → simple float"],returnedTypes:["simple float"]},{name:"math.exp",desc:["The exp function of `number` is e raised to the power of `number`, where e is Euler's number."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["A value representing e raised to the power of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.exp(number) → input float"],returnedTypes:["input float"]},{name:"math.exp",desc:["The exp function of `number` is e raised to the power of `number`, where e is Euler's number."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["A value representing e raised to the power of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.exp(number) → const float"],returnedTypes:["const float"]},{name:"math.exp",desc:["The exp function of `number` is e raised to the power of `number`, where e is Euler's number."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["A value representing e raised to the power of `number`."],seeAlso:["[math.pow](#fun_math.pow)"],syntax:["math.exp(number) → series float"],returnedTypes:["series float"]},{name:"math.sin",desc:["The sin function returns the trigonometric sine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The trigonometric sine of an angle."],syntax:["math.sin(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.sin",desc:["The sin function returns the trigonometric sine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The trigonometric sine of an angle."],syntax:["math.sin(angle) → input float"],returnedTypes:["input float"]},{name:"math.sin",desc:["The sin function returns the trigonometric sine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The trigonometric sine of an angle."],syntax:["math.sin(angle) → const float"],returnedTypes:["const float"]},{name:"math.sin",desc:["The sin function returns the trigonometric sine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The trigonometric sine of an angle."],syntax:["math.sin(angle) → series float"],returnedTypes:["series float"]},{name:"math.cos",desc:["The cos function returns the trigonometric cosine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The trigonometric cosine of an angle."],syntax:["math.cos(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.cos",desc:["The cos function returns the trigonometric cosine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The trigonometric cosine of an angle."],syntax:["math.cos(angle) → input float"],returnedTypes:["input float"]},{name:"math.cos",desc:["The cos function returns the trigonometric cosine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The trigonometric cosine of an angle."],syntax:["math.cos(angle) → const float"],returnedTypes:["const float"]},{name:"math.cos",desc:["The cos function returns the trigonometric cosine of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The trigonometric cosine of an angle."],syntax:["math.cos(angle) → series float"],returnedTypes:["series float"]},{name:"math.tan",desc:["The tan function returns the trigonometric tangent of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The trigonometric tangent of an angle."],syntax:["math.tan(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.tan",desc:["The tan function returns the trigonometric tangent of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The trigonometric tangent of an angle."],syntax:["math.tan(angle) → input float"],returnedTypes:["input float"]},{name:"math.tan",desc:["The tan function returns the trigonometric tangent of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The trigonometric tangent of an angle."],syntax:["math.tan(angle) → const float"],returnedTypes:["const float"]},{name:"math.tan",desc:["The tan function returns the trigonometric tangent of an angle."],args:[{name:"angle",desc:"Angle, in radians.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The trigonometric tangent of an angle."],syntax:["math.tan(angle) → series float"],returnedTypes:["series float"]},{name:"math.asin",desc:["The asin function returns the arcsine (in radians) of number such that sin(asin(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The arcsine of a value; the returned angle is in the range [-Pi/2, Pi/2], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.asin(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.asin",desc:["The asin function returns the arcsine (in radians) of number such that sin(asin(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The arcsine of a value; the returned angle is in the range [-Pi/2, Pi/2], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.asin(angle) → input float"],returnedTypes:["input float"]},{name:"math.asin",desc:["The asin function returns the arcsine (in radians) of number such that sin(asin(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The arcsine of a value; the returned angle is in the range [-Pi/2, Pi/2], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.asin(angle) → const float"],returnedTypes:["const float"]},{name:"math.asin",desc:["The asin function returns the arcsine (in radians) of number such that sin(asin(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The arcsine of a value; the returned angle is in the range [-Pi/2, Pi/2], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.asin(angle) → series float"],returnedTypes:["series float"]},{name:"math.acos",desc:["The acos function returns the arccosine (in radians) of number such that cos(acos(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The arc cosine of a value; the returned angle is in the range [0, Pi], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.acos(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.acos",desc:["The acos function returns the arccosine (in radians) of number such that cos(acos(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The arc cosine of a value; the returned angle is in the range [0, Pi], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.acos(angle) → input float"],returnedTypes:["input float"]},{name:"math.acos",desc:["The acos function returns the arccosine (in radians) of number such that cos(acos(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The arc cosine of a value; the returned angle is in the range [0, Pi], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.acos(angle) → const float"],returnedTypes:["const float"]},{name:"math.acos",desc:["The acos function returns the arccosine (in radians) of number such that cos(acos(y)) = y for y in range [-1, 1]."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The arc cosine of a value; the returned angle is in the range [0, Pi], or [na](#var_na) if y is outside of range [-1, 1]."],syntax:["math.acos(angle) → series float"],returnedTypes:["series float"]},{name:"math.atan",desc:["The atan function returns the arctangent (in radians) of number such that tan(atan(y)) = y for any y."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The arc tangent of a value; the returned angle is in the range [-Pi/2, Pi/2]."],syntax:["math.atan(angle) → simple float"],returnedTypes:["simple float"]},{name:"math.atan",desc:["The atan function returns the arctangent (in radians) of number such that tan(atan(y)) = y for any y."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The arc tangent of a value; the returned angle is in the range [-Pi/2, Pi/2]."],syntax:["math.atan(angle) → input float"],returnedTypes:["input float"]},{name:"math.atan",desc:["The atan function returns the arctangent (in radians) of number such that tan(atan(y)) = y for any y."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The arc tangent of a value; the returned angle is in the range [-Pi/2, Pi/2]."],syntax:["math.atan(angle) → const float"],returnedTypes:["const float"]},{name:"math.atan",desc:["The atan function returns the arctangent (in radians) of number such that tan(atan(y)) = y for any y."],args:[{name:"angle",desc:"The value, in radians, to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The arc tangent of a value; the returned angle is in the range [-Pi/2, Pi/2]."],syntax:["math.atan(angle) → series float"],returnedTypes:["series float"]},{name:"math.ceil",desc:["The ceil function returns the smallest (closest to negative infinity) integer that is greater than or equal to the argument."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The smallest integer greater than or equal to the given number."],seeAlso:["[math.floor](#fun_math.floor)","[math.round](#fun_math.round)"],syntax:["math.ceil(number) → simple int"],returnedTypes:["simple int"]},{name:"math.ceil",desc:["The ceil function returns the smallest (closest to negative infinity) integer that is greater than or equal to the argument."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int"],displayType:"input int"}],returns:["The smallest integer greater than or equal to the given number."],seeAlso:["[math.floor](#fun_math.floor)","[math.round](#fun_math.round)"],syntax:["math.ceil(number) → input int"],returnedTypes:["input int"]},{name:"math.ceil",desc:["The ceil function returns the smallest (closest to negative infinity) integer that is greater than or equal to the argument."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],returns:["The smallest integer greater than or equal to the given number."],seeAlso:["[math.floor](#fun_math.floor)","[math.round](#fun_math.round)"],syntax:["math.ceil(number) → const int"],returnedTypes:["const int"]},{name:"math.ceil",desc:["The ceil function returns the smallest (closest to negative infinity) integer that is greater than or equal to the argument."],args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The smallest integer greater than or equal to the given number."],seeAlso:["[math.floor](#fun_math.floor)","[math.round](#fun_math.round)"],syntax:["math.ceil(number) → series int"],returnedTypes:["series int"]},{name:"math.floor",args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The largest integer less than or equal to the given number."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.round](#fun_math.round)"],syntax:["math.floor(number) → simple int"],returnedTypes:["simple int"]},{name:"math.floor",args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["input int","const int"],displayType:"input int"}],returns:["The largest integer less than or equal to the given number."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.round](#fun_math.round)"],syntax:["math.floor(number) → input int"],returnedTypes:["input int"]},{name:"math.floor",args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],returns:["The largest integer less than or equal to the given number."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.round](#fun_math.round)"],syntax:["math.floor(number) → const int"],returnedTypes:["const int"]},{name:"math.floor",args:[{name:"number",desc:"The number to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The largest integer less than or equal to the given number."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.round](#fun_math.round)"],syntax:["math.floor(number) → series int"],returnedTypes:["series int"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number) → simple int"],returnedTypes:["simple int"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number) → input int"],returnedTypes:["input int"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number) → const int"],returnedTypes:["const int"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number) → series int"],returnedTypes:["series int"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"precision",desc:"Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number, precision) → simple float"],returnedTypes:["simple float"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"},{name:"precision",desc:"Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number, precision) → input float"],returnedTypes:["input float"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"precision",desc:"Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number, precision) → const float"],returnedTypes:["const float"]},{name:"math.round",desc:["Returns the value of `number` rounded to the nearest integer, with ties rounding up. If the `precision` parameter is used, returns a float value rounded to that amount of decimal places."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"precision",desc:"Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The value of `number` rounded to the nearest integer, or according to precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round(number, precision) → series float"],returnedTypes:["series float"]},{name:"math.round_to_mintick",desc:["Returns the value rounded to the symbol's mintick, i.e. the nearest value that can be divided by [syminfo.mintick](#var_syminfo.mintick), without the remainder, with ties rounding up."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The `number` rounded to tick precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round_to_mintick(number) → simple float"],returnedTypes:["simple float"]},{name:"math.round_to_mintick",desc:["Returns the value rounded to the symbol's mintick, i.e. the nearest value that can be divided by [syminfo.mintick](#var_syminfo.mintick), without the remainder, with ties rounding up."],args:[{name:"number",desc:"The value to be rounded.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The `number` rounded to tick precision."],remarks:["Note that for 'na' values function returns 'na'."],seeAlso:["[math.ceil](#fun_math.ceil)","[math.floor](#fun_math.floor)"],syntax:["math.round_to_mintick(number) → series float"],returnedTypes:["series float"]},{name:"ta.median",desc:["Returns the median of the series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The median of the series."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.median(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.median",desc:["Returns the median of the series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The median of the series."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.median(source, length) → series int"],returnedTypes:["series int"]},{name:"ta.max",desc:["Returns the all-time high value of `source` from the beginning of the chart up to the current bar."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["[na](#var_na) occurrences of `source` are ignored."],syntax:["ta.max(source) → series float"],returnedTypes:["series float"]},{name:"ta.min",desc:["Returns the all-time low value of `source` from the beginning of the chart up to the current bar."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["[na](#var_na) occurrences of `source` are ignored."],syntax:["ta.min(source) → series float"],returnedTypes:["series float"]},{name:"ta.mode",desc:["Returns the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) of the series. If there are several values with the same frequency, it returns the smallest value."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The most frequently occurring value from the `source`. If none exists, returns the smallest value instead."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.mode(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.mode",desc:["Returns the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) of the series. If there are several values with the same frequency, it returns the smallest value."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The most frequently occurring value from the `source`. If none exists, returns the smallest value instead."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.mode(source, length) → series int"],returnedTypes:["series int"]},{name:"ta.range",desc:["Returns the difference between the min and max values in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The difference between the min and max values in the series."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.range(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.range",desc:["Returns the difference between the min and max values in a series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The difference between the min and max values in the series."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.range(source, length) → series int"],returnedTypes:["series int"]},{name:"math.todegrees",desc:["Returns an approximately equivalent angle in degrees from an angle measured in radians."],args:[{name:"radians",desc:"Angle in radians.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The angle value in degrees."],syntax:["math.todegrees(radians) → series float"],returnedTypes:["series float"]},{name:"math.toradians",desc:["Returns an approximately equivalent angle in radians from an angle measured in degrees."],args:[{name:"degrees",desc:"Angle in degrees.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The angle value in radians."],syntax:["math.toradians(degrees) → series float"],returnedTypes:["series float"]},{name:"math.random",desc:["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."],args:[{name:"min",desc:"The lower bound of the range of random values. The value is not included in the range. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"max",desc:"The upper bound of the range of random values. The value is not included in the range. The default is 1.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"seed",desc:"Optional argument. When the same seed is used, allows successive calls to the function to produce a repeatable set of values.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["A random value."],syntax:["math.random(min, max, seed) → series float"],returnedTypes:["series float"]},{name:"math.sum",desc:["The sum function returns the sliding sum of last y values of x."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Sum of `source` for `length` bars back."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.cum](#fun_ta.cum)","[for](#op_for)"],syntax:["math.sum(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.sma",desc:["The sma function returns the moving average, that is the sum of last y values of x, divided by y."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.sma")',"plot(ta.sma(close, 15))","","// same on pine, but much less efficient","pine_sma(x, y) =>"," sum = 0.0"," for i = 0 to y - 1"," sum := sum + x[i] / y"," sum","plot(pine_sma(close, 15))"],returns:["Simple moving average of `source` for `length` bars back."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)","[ta.alma](#fun_ta.alma)"],syntax:["ta.sma(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.hma",desc:["The hma function returns the Hull Moving Average."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("Hull Moving Average")','src = input(defval=close, title="Source")','length = input(defval=9, title="Length")',"hmaBuildIn = ta.hma(src, length)",'plot(hmaBuildIn, title="Hull MA", color=#674EA7)'],returns:["Hull moving average of 'source' for 'length' bars back."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.sma](#fun_ta.sma)"],syntax:["ta.hma(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.ema",desc:["The ema function returns the exponentially weighted moving average. In ema weighting factors decrease exponentially. It calculates by using a formula: EMA = alpha * source + (1 - alpha) * EMA[1], where alpha = 2 / (length + 1)."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.ema")',"plot(ta.ema(close, 15))","","//the same on pine","pine_ema(src, length) =>"," alpha = 2 / (length + 1)"," sum = 0.0"," sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])","plot(pine_ema(close,15))"],returns:["Exponential moving average of `source` with alpha = 2 / (length + 1)."],remarks:["Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html).","`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)","[ta.alma](#fun_ta.alma)"],syntax:["ta.ema(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.wma",desc:["The wma function returns weighted moving average of `source` for `length` bars back. In wma weighting factors decrease in arithmetical progression."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.wma")',"plot(ta.wma(close, 15))","","// same on pine, but much less efficient","pine_wma(x, y) =>"," norm = 0.0"," sum = 0.0"," for i = 0 to y - 1"," weight = (y - i) * y"," norm := norm + weight"," sum := sum + x[i] * weight"," sum / norm","plot(pine_wma(close, 15))"],returns:["Weighted moving average of `source` for `length` bars back."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)","[ta.alma](#fun_ta.alma)"],syntax:["ta.wma(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.vwma",desc:["The vwma function returns volume-weighted moving average of `source` for `length` bars back. It is the same as: sma(source * volume, length) / sma(volume, length)."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.vwma")',"plot(ta.vwma(close, 15))","","// same on pine, but less efficient","pine_vwma(x, y) =>"," ta.sma(x * volume, y) / ta.sma(volume, y)","plot(pine_vwma(close, 15))"],returns:["Volume-weighted moving average of `source` for `length` bars back."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.swma](#fun_ta.swma)","[ta.alma](#fun_ta.alma)"],syntax:["ta.vwma(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.supertrend",desc:["The Supertrend Indicator. The Supertrend is a trend following indicator."],args:[{name:"factor",desc:"The multiplier by which the ATR will get multiplied.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"atrPeriod",desc:"Length of ATR.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("Pine Script® Supertrend")',"","[supertrend, direction] = ta.supertrend(3, 10)",'plot(direction < 0 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)','plot(direction > 0 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)',"","// The same on Pine Script®","pine_supertrend(factor, atrPeriod) =>"," src = hl2"," atr = ta.atr(atrPeriod)"," upperBand = src + factor * atr"," lowerBand = src - factor * atr"," prevLowerBand = nz(lowerBand[1])"," prevUpperBand = nz(upperBand[1])",""," lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand"," upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand"," int direction = na"," float superTrend = na"," prevSuperTrend = superTrend[1]"," if na(atr[1])"," direction := 1"," else if prevSuperTrend == prevUpperBand"," direction := close > upperBand ? -1 : 1"," else"," direction := close < lowerBand ? 1 : -1"," superTrend := direction == -1 ? lowerBand : upperBand"," [superTrend, direction]","","[Pine_Supertrend, pineDirection] = pine_supertrend(3, 10)",'plot(pineDirection < 0 ? Pine_Supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)','plot(pineDirection > 0 ? Pine_Supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)'],returns:["[Tuple](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#tuples) of two supertrend series: supertrend line and direction of trend. Possible values are 1 (down direction) and -1 (up direction)."],seeAlso:["[ta.macd](#fun_ta.macd)"],syntax:["ta.supertrend(factor, atrPeriod) → [series float, series float]"],returnedTypes:["[series float, series float]"]},{name:"ta.macd",desc:["MACD (moving average convergence/divergence). It is supposed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock's price."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"fastlen",desc:"Fast Length parameter.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"slowlen",desc:"Slow Length parameter.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"siglen",desc:"Signal Length parameter.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("MACD")',"[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)","plot(macdLine, color=color.blue)","plot(signalLine, color=color.orange)","plot(histLine, color=color.red, style=plot.style_histogram)"]},{desc:["If you need only one value, use placeholders '_' like this:"],examples:["//@version=5",'indicator("MACD")',"[_, signalLine, _] = ta.macd(close, 12, 26, 9)","plot(signalLine, color=color.orange)"]}],returns:["[Tuple](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#tuples) of three MACD series: MACD line, signal line and histogram line."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)"],syntax:["ta.macd(source, fastlen, slowlen, siglen) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.lowest",desc:["Lowest value for a given number of bars back."],args:[{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Lowest value in the series."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses low as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.highest](#fun_ta.highest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.valuewhen](#fun_ta.valuewhen)","[ta.barssince](#fun_ta.barssince)"],syntax:["ta.lowest(length) → series float"],returnedTypes:["series float"]},{name:"ta.lowest",desc:["Lowest value for a given number of bars back."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Lowest value in the series."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses low as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.highest](#fun_ta.highest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.valuewhen](#fun_ta.valuewhen)","[ta.barssince](#fun_ta.barssince)"],syntax:["ta.lowest(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.highest",desc:["Highest value for a given number of bars back."],args:[{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Highest value in the series."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses high as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.valuewhen](#fun_ta.valuewhen)","[ta.barssince](#fun_ta.barssince)"],syntax:["ta.highest(length) → series float"],returnedTypes:["series float"]},{name:"ta.highest",desc:["Highest value for a given number of bars back."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Highest value in the series."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses high as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.valuewhen](#fun_ta.valuewhen)","[ta.barssince](#fun_ta.barssince)"],syntax:["ta.highest(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.lowestbars",desc:["Lowest value offset for a given number of bars back."],args:[{name:"length",desc:"Number of bars back.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["Offset to the lowest bar."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses low as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.highest](#fun_ta.highest)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.valuewhen](#fun_ta.valuewhen)"],syntax:["ta.lowestbars(length) → series int"],returnedTypes:["series int"]},{name:"ta.lowestbars",desc:["Lowest value offset for a given number of bars back."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars back.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["Offset to the lowest bar."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses low as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.highest](#fun_ta.highest)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.valuewhen](#fun_ta.valuewhen)"],syntax:["ta.lowestbars(source, length) → series int"],returnedTypes:["series int"]},{name:"ta.highestbars",desc:["Highest value offset for a given number of bars back."],args:[{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["Offset to the highest bar."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses high as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.highest](#fun_ta.highest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.barssince](#fun_ta.barssince)","[ta.valuewhen](#fun_ta.valuewhen)"],syntax:["ta.highestbars(length) → series int"],returnedTypes:["series int"]},{name:"ta.highestbars",desc:["Highest value offset for a given number of bars back."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["Offset to the highest bar."],remarks:["Two args version: `source` is a series and `length` is the number of bars back.","One arg version: `length` is the number of bars back. Algorithm uses high as a `source` series.","`na` values in the `source` series are ignored."],seeAlso:["[ta.lowest](#fun_ta.lowest)","[ta.highest](#fun_ta.highest)","[ta.lowestbars](#fun_ta.lowestbars)","[ta.barssince](#fun_ta.barssince)","[ta.valuewhen](#fun_ta.valuewhen)"],syntax:["ta.highestbars(source, length) → series int"],returnedTypes:["series int"]},{name:"ta.barssince",desc:["Counts the number of bars since the last time the condition was true."],args:[{name:"condition",desc:"The condition to check for.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("ta.barssince")',"// get number of bars since last color.green bar","plot(ta.barssince(close >= open))"],returns:["Number of bars since condition was true."],remarks:["If the condition has never been met prior to the current bar, the function returns na.","Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.valuewhen](#fun_ta.valuewhen)","[ta.highest](#fun_ta.highest)","[ta.lowest](#fun_ta.lowest)"],syntax:["ta.barssince(condition) → series int"],returnedTypes:["series int"]},{name:"ta.valuewhen",desc:["Returns the value of the `source` series on the bar where the `condition` was true on the nth most recent occurrence."],args:[{name:"condition",desc:"The condition to search for.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"source",desc:"The value to be returned from the bar where the condition is met.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"occurrence",desc:"The occurrence of the condition. The numbering starts from 0 and goes back in time, so '0' is the most recent occurrence of `condition`, '1' is the second most recent and so forth. Must be an integer >= 0.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.valuewhen")',"slow = ta.sma(close, 7)","fast = ta.sma(close, 14)","// Get value of `close` on second most recent cross","plot(ta.valuewhen(ta.cross(slow, fast), close, 1))"],remarks:["This function requires execution on every bar. It is not recommended to use it inside a [for](#op_for) or [while](#op_while) loop structure, where its behavior can be unexpected. Please note that using this function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.highest](#fun_ta.highest)","[ta.lowest](#fun_ta.lowest)"],syntax:["ta.valuewhen(condition, source, occurrence) → series float"],returnedTypes:["series float"]},{name:"ta.valuewhen",desc:["Returns the value of the `source` series on the bar where the `condition` was true on the nth most recent occurrence."],args:[{name:"condition",desc:"The condition to search for.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"source",desc:"The value to be returned from the bar where the condition is met.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"occurrence",desc:"The occurrence of the condition. The numbering starts from 0 and goes back in time, so '0' is the most recent occurrence of `condition`, '1' is the second most recent and so forth. Must be an integer >= 0.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.valuewhen")',"slow = ta.sma(close, 7)","fast = ta.sma(close, 14)","// Get value of `close` on second most recent cross","plot(ta.valuewhen(ta.cross(slow, fast), close, 1))"],remarks:["This function requires execution on every bar. It is not recommended to use it inside a [for](#op_for) or [while](#op_while) loop structure, where its behavior can be unexpected. Please note that using this function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.highest](#fun_ta.highest)","[ta.lowest](#fun_ta.lowest)"],syntax:["ta.valuewhen(condition, source, occurrence) → series int"],returnedTypes:["series int"]},{name:"ta.valuewhen",desc:["Returns the value of the `source` series on the bar where the `condition` was true on the nth most recent occurrence."],args:[{name:"condition",desc:"The condition to search for.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"source",desc:"The value to be returned from the bar where the condition is met.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"occurrence",desc:"The occurrence of the condition. The numbering starts from 0 and goes back in time, so '0' is the most recent occurrence of `condition`, '1' is the second most recent and so forth. Must be an integer >= 0.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.valuewhen")',"slow = ta.sma(close, 7)","fast = ta.sma(close, 14)","// Get value of `close` on second most recent cross","plot(ta.valuewhen(ta.cross(slow, fast), close, 1))"],remarks:["This function requires execution on every bar. It is not recommended to use it inside a [for](#op_for) or [while](#op_while) loop structure, where its behavior can be unexpected. Please note that using this function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.highest](#fun_ta.highest)","[ta.lowest](#fun_ta.lowest)"],syntax:["ta.valuewhen(condition, source, occurrence) → series bool"],returnedTypes:["series bool"]},{name:"ta.valuewhen",desc:["Returns the value of the `source` series on the bar where the `condition` was true on the nth most recent occurrence."],args:[{name:"condition",desc:"The condition to search for.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"source",desc:"The value to be returned from the bar where the condition is met.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"occurrence",desc:"The occurrence of the condition. The numbering starts from 0 and goes back in time, so '0' is the most recent occurrence of `condition`, '1' is the second most recent and so forth. Must be an integer >= 0.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.valuewhen")',"slow = ta.sma(close, 7)","fast = ta.sma(close, 14)","// Get value of `close` on second most recent cross","plot(ta.valuewhen(ta.cross(slow, fast), close, 1))"],remarks:["This function requires execution on every bar. It is not recommended to use it inside a [for](#op_for) or [while](#op_while) loop structure, where its behavior can be unexpected. Please note that using this function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],seeAlso:["[ta.lowestbars](#fun_ta.lowestbars)","[ta.highestbars](#fun_ta.highestbars)","[ta.barssince](#fun_ta.barssince)","[ta.highest](#fun_ta.highest)","[ta.lowest](#fun_ta.lowest)"],syntax:["ta.valuewhen(condition, source, occurrence) → series color"],returnedTypes:["series color"]},{name:"ta.falling",desc:["Test if the `source` series is now falling for `length` bars long."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["true if current `source` value is less than any previous `source` value for `length` bars back, false otherwise."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.rising](#fun_ta.rising)"],syntax:["ta.falling(source, length) → series bool"],returnedTypes:["series bool"]},{name:"ta.rising",desc:["Test if the `source` series is now rising for `length` bars long."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["true if current `source` is greater than any previous `source` for `length` bars back, false otherwise."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.falling](#fun_ta.falling)"],syntax:["ta.rising(source, length) → series bool"],returnedTypes:["series bool"]},{name:"ta.roc",desc:["Calculates the percentage of change (rate of change) between the current value of `source` and its value `length` bars ago.","It is calculated by the formula: 100 * change(src, length) / src[length]."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["The rate of change of `source` for `length` bars back."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],syntax:["ta.roc(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.cci",desc:["The CCI (commodity channel index) is calculated as the difference between the typical price of a commodity and its simple moving average, divided by the mean absolute deviation of the typical price. The index is scaled by an inverse factor of 0.015 to provide more readable numbers."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Commodity channel index of source for length bars back."],remarks:["`na` values in the `source` series are ignored."],syntax:["ta.cci(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.variance",desc:["Variance is the expectation of the squared deviation of a series from its mean ([ta.sma](#fun_ta.sma)), and it informally measures how far a set of numbers are spread out from their mean."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],returns:["Variance of `source` for `length` bars back."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample.","`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.dev](#fun_ta.dev)","[ta.stdev](#fun_ta.stdev)"],syntax:["ta.variance(source, length, biased) → series float"],returnedTypes:["series float"]},{name:"ta.dev",desc:["Measure of difference between the series and it's [ta.sma](#fun_ta.sma)"],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.dev")',"plot(ta.dev(close, 10))","","// the same on pine","pine_dev(source, length) =>"," mean = ta.sma(source, length)"," sum = 0.0"," for i = 0 to length - 1"," val = source[i]"," sum := sum + math.abs(val - mean)"," dev = sum/length","plot(pine_dev(close, 10))"],returns:["Deviation of `source` for `length` bars back."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.variance](#fun_ta.variance)","[ta.stdev](#fun_ta.stdev)"],syntax:["ta.dev(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.stdev",args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("ta.stdev")',"plot(ta.stdev(close, 5))","","//the same on pine","isZero(val, eps) => math.abs(val) <= eps","","SUM(fst, snd) =>"," EPS = 1e-10"," res = fst + snd"," if isZero(res, EPS)"," res := 0"," else"," if not isZero(res, 1e-4)"," res := res"," else"," 15","","pine_stdev(src, length) =>"," avg = ta.sma(src, length)"," sumOfSquareDeviations = 0.0"," for i = 0 to length - 1"," sum = SUM(src[i], -avg)"," sumOfSquareDeviations := sumOfSquareDeviations + sum * sum",""," stdev = math.sqrt(sumOfSquareDeviations / length)","plot(pine_stdev(close, 5))"],returns:["Standard deviation."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample.","`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.dev](#fun_ta.dev)","[ta.variance](#fun_ta.variance)"],syntax:["ta.stdev(source, length, biased) → series float"],returnedTypes:["series float"]},{name:"ta.percentrank",desc:["Percent rank is the percents of how many previous values was less than or equal to the current value of given series."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Percent rank of `source` for `length` bars back."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],syntax:["ta.percentrank(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.rma",desc:["Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.rma")',"plot(ta.rma(close, 15))","","//the same on pine","pine_rma(src, length) =>"," alpha = 1/length"," sum = 0.0"," sum := na(sum[1]) ? ta.sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])","plot(pine_rma(close, 15))"],returns:["Exponential moving average of `source` with alpha = 1 / `length`."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)","[ta.alma](#fun_ta.alma)","[ta.rsi](#fun_ta.rsi)"],syntax:["ta.rma(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.rsi",desc:["Relative strength index. It is calculated using the `ta.rma()` of upward and downward changes of `source` over the last `length` bars."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.rsi")',"plot(ta.rsi(close, 7))","","// same on pine, but less efficient","pine_rsi(x, y) => "," u = math.max(x - x[1], 0) // upward ta.change"," d = math.max(x[1] - x, 0) // downward ta.change"," rs = ta.rma(u, y) / ta.rma(d, y)"," res = 100 - 100 / (1 + rs)"," res","","plot(pine_rsi(close, 7))"],returns:["Relative strength index."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.rma](#fun_ta.rma)"],syntax:["ta.rsi(source, length) → series float"],returnedTypes:["series float"]},{name:"timeframe.in_seconds",desc:["Converts a timeframe string into seconds."],args:[{name:"timeframe",desc:"Timeframe string in [timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications) format. Optional. The default is [timeframe.period](#var_timeframe.period).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("`timeframe_in_seconds()`")',"","// Get a user-selected timeframe.",'tfInput = input.timeframe("1D")',"",'// Convert it into an "int" number of seconds.',"secondsInTf = timeframe.in_seconds(tfInput)","","plot(secondsInTf)"],returns:['The "int" representation of the number of seconds in the timeframe string.'],remarks:['When the timeframe is "1M" or more, calculations use 2628003 as the number of seconds in one month, which represents 30.4167 (365/12) days.'],seeAlso:["[input.timeframe](#fun_input.timeframe)","[timeframe.period](#var_timeframe.period)","[timeframe.from_seconds](#fun_timeframe.from_seconds)"],syntax:["timeframe.in_seconds(timeframe) → simple int"],returnedTypes:["simple int"]},{name:"timeframe.in_seconds",desc:["Converts a timeframe string into seconds."],args:[{name:"timeframe",desc:"Timeframe string in [timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications) format. Optional. The default is [timeframe.period](#var_timeframe.period).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("`timeframe_in_seconds()`")',"","// Get a user-selected timeframe.",'tfInput = input.timeframe("1D")',"",'// Convert it into an "int" number of seconds.',"secondsInTf = timeframe.in_seconds(tfInput)","","plot(secondsInTf)"],returns:['The "int" representation of the number of seconds in the timeframe string.'],remarks:['When the timeframe is "1M" or more, calculations use 2628003 as the number of seconds in one month, which represents 30.4167 (365/12) days.'],seeAlso:["[input.timeframe](#fun_input.timeframe)","[timeframe.period](#var_timeframe.period)","[timeframe.from_seconds](#fun_timeframe.from_seconds)"],syntax:["timeframe.in_seconds(timeframe) → series int"],returnedTypes:["series int"]},{name:"timeframe.from_seconds",desc:["Converts a number of seconds into a valid timeframe string."],args:[{name:"seconds",desc:"The number of seconds in the timeframe.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("HTF Close", "", true)',"int chartTf = timeframe.in_seconds()","string tfTimes5 = timeframe.from_seconds(chartTf * 5)","float htfClose = request.security(syminfo.tickerid, tfTimes5, close)","plot(htfClose)"],returns:["A timeframe string compliant with [timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications)."],remarks:['If no valid timeframe exists for the quantity of seconds supplied, the next higher valid timeframe will be returned. Accordingly, one second or less will return "1S", 2-5 seconds will return "5S", and 604,799 seconds (one second less than 7 days) will return "7D".','If the seconds exactly represent two or more valid timeframes, the one with the larger base unit will be used. Thus 604,800 seconds (7 days) returns "1W", not "7D".','All values above 31,622,400 (366 days) return "12M".'],seeAlso:["[timeframe.in_seconds](#fun_timeframe.in_seconds)","[request.security](#var_request.security)","[request.security_lower_tf](#var_request.security_lower_tf)"],syntax:["timeframe.from_seconds(seconds) → simple string"],returnedTypes:["simple string"]},{name:"timeframe.from_seconds",desc:["Converts a number of seconds into a valid timeframe string."],args:[{name:"seconds",desc:"The number of seconds in the timeframe.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("HTF Close", "", true)',"int chartTf = timeframe.in_seconds()","string tfTimes5 = timeframe.from_seconds(chartTf * 5)","float htfClose = request.security(syminfo.tickerid, tfTimes5, close)","plot(htfClose)"],returns:["A timeframe string compliant with [timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications)."],remarks:['If no valid timeframe exists for the quantity of seconds supplied, the next higher valid timeframe will be returned. Accordingly, one second or less will return "1S", 2-5 seconds will return "5S", and 604,799 seconds (one second less than 7 days) will return "7D".','If the seconds exactly represent two or more valid timeframes, the one with the larger base unit will be used. Thus 604,800 seconds (7 days) returns "1W", not "7D".','All values above 31,622,400 (366 days) return "12M".'],seeAlso:["[timeframe.in_seconds](#fun_timeframe.in_seconds)","[request.security](#var_request.security)","[request.security_lower_tf](#var_request.security_lower_tf)"],syntax:["timeframe.from_seconds(seconds) → series string"],returnedTypes:["series string"]},{name:"ta.dmi",desc:["The dmi function returns the directional movement index."],args:[{name:"diLength",desc:"DI Period.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"adxSmoothing",desc:"ADX Smoothing Period.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4)','len = input.int(17, minval=1, title="DI Length")','lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)',"[diplus, diminus, adx] = ta.dmi(len, lensig)",'plot(adx, color=color.red, title="ADX")','plot(diplus, color=color.blue, title="+DI")','plot(diminus, color=color.orange, title="-DI")'],returns:["[Tuple](https://www.tradingview.com/pine-script-docs/en/v5/language/Type_system.html#tuples) of three DMI series: Positive Directional Movement (+DI), Negative Directional Movement (-DI) and Average Directional Movement Index (ADX)."],seeAlso:["[ta.rsi](#fun_ta.rsi)","[ta.tsi](#fun_ta.tsi)","[ta.mfi](#fun_ta.mfi)"],syntax:["ta.dmi(diLength, adxSmoothing) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.correlation",desc:["Correlation coefficient. Describes the degree to which two series tend to deviate from their [ta.sma](#fun_ta.sma) values."],args:[{name:"source1",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"source2",desc:"Target series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Length (number of bars back).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Correlation coefficient."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[request.security](#fun_request.security)"],syntax:["ta.correlation(source1, source2, length) → series float"],returnedTypes:["series float"]},{name:"ta.tsi",desc:["True strength index. It uses moving averages of the underlying momentum of a financial instrument."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"short_length",desc:"Short length.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"long_length",desc:"Long length.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["True strength index. A value in range [-1, 1]."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],syntax:["ta.tsi(source, short_length, long_length) → series float"],returnedTypes:["series float"]},{name:"ta.linreg",desc:["Linear regression curve. A line that best fits the prices specified over a user-defined time period. It is calculated using the least squares method. The result of this function is calculated using the formula: linreg = intercept + slope * (length - 1 - offset), where intercept and slope are the values calculated with the least squares method on `source` series."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"offset",desc:"Offset.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],returns:["Linear regression curve."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],syntax:["ta.linreg(source, length, offset) → series float"],returnedTypes:["series float"]},{name:"ta.stoch",desc:["Stochastic. It is calculated by a formula: 100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length))."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"high",desc:"Series of high.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"low",desc:"Series of low.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Length (number of bars back).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Stochastic."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.cog](#fun_ta.cog)"],syntax:["ta.stoch(source, high, low, length) → series float"],returnedTypes:["series float"]},{name:"ta.atr",desc:["Function atr (average true range) returns the RMA of true range. True range is max(high - low, abs(high - close[1]), abs(low - close[1]))."],args:[{name:"length",desc:"Length (number of bars back).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ta.atr")',"plot(ta.atr(14))","","//the same on pine","pine_atr(length) =>"," trueRange = na(high[1])? high-low : math.max(math.max(high - low, math.abs(high - close[1])), math.abs(low - close[1]))"," //true range can be also calculated with ta.tr(true)"," ta.rma(trueRange, length)","","plot(pine_atr(14))"],returns:["Average true range."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.tr](#fun_ta.tr)","[ta.rma](#fun_ta.rma)"],syntax:["ta.atr(length) → series float"],returnedTypes:["series float"]},{name:"fixnan",desc:["For a given series replaces NaN values with previous nearest non-NaN value."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["Series without na gaps."],seeAlso:["[na](#fun_na)","[na](#var_na)","[nz](#fun_nz)"],syntax:["fixnan(source) → series float"],returnedTypes:["series float"]},{name:"fixnan",desc:["For a given series replaces NaN values with previous nearest non-NaN value."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Series without na gaps."],seeAlso:["[na](#fun_na)","[na](#var_na)","[nz](#fun_nz)"],syntax:["fixnan(source) → series int"],returnedTypes:["series int"]},{name:"fixnan",desc:["For a given series replaces NaN values with previous nearest non-NaN value."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],returns:["Series without na gaps."],seeAlso:["[na](#fun_na)","[na](#var_na)","[nz](#fun_nz)"],syntax:["fixnan(source) → series bool"],returnedTypes:["series bool"]},{name:"fixnan",desc:["For a given series replaces NaN values with previous nearest non-NaN value."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],returns:["Series without na gaps."],seeAlso:["[na](#fun_na)","[na](#var_na)","[nz](#fun_nz)"],syntax:["fixnan(source) → series color"],returnedTypes:["series color"]},{name:"ta.cum",desc:["Cumulative (total) sum of `source`. In other words it's a sum of all elements of `source`."],args:[{name:"source",desc:"Source used for the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["Total sum series."],seeAlso:["[math.sum](#fun_math.sum)"],syntax:["ta.cum(source) → series float"],returnedTypes:["series float"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source) → series float"],returnedTypes:["series float"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source) → series bool"],returnedTypes:["series bool"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source) → series int"],returnedTypes:["series int"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"How far the past `source` value is offset from the current one, in bars. Optional. The default is 1.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"length",desc:"How far the past `source` value is offset from the current one, in bars. Optional. The default is 1.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source, length) → series bool"],returnedTypes:["series bool"]},{name:"ta.change",desc:["Compares the current `source` value to its value `length` bars ago and returns the difference."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"length",desc:"How far the past `source` value is offset from the current one, in bars. Optional. The default is 1.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5","indicator('Day and Direction Change', overlay = true)","dailyBarTime = time('1D')","isNewDay = ta.change(dailyBarTime)","bgcolor(isNewDay ? color.new(color.green, 80) : na)","","isGreenBar = close >= open","colorChange = ta.change(isGreenBar)","plotshape(colorChange, 'Direction Change')"],returns:["The difference between the values when they are numerical. When a 'bool' source is used, returns `true` when the current source is different from the previous source."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.mom](#fun_ta.mom)","[ta.cross](#fun_ta.cross)"],syntax:["ta.change(source, length) → series int"],returnedTypes:["series int"]},{name:"ta.mom",desc:["Momentum of `source` price and `source` price `length` bars ago. This is simply a difference: source - source[length]."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Offset from the current bar to the previous bar.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Momentum of `source` price and `source` price `length` bars ago."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.change](#fun_ta.change)"],syntax:["ta.mom(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.pivot_point_levels",desc:["Calculates the pivot point levels using the specified `type` and `anchor`."],args:[{name:"type",desc:'The type of pivot point levels. Possible values: "Traditional", "Fibonacci", "Woodie", "Classic", "DM", "Camarilla".',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"anchor",desc:"The condition that triggers the reset of the pivot point calculations. When [true](#var_true), calculations reset; when [false](#var_false), results calculated at the last reset persist.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"developing",desc:"If [false](#var_false), the values are those calculated the last time the anchor condition was [true](#var_true). They remain constant until the anchor condition becomes [true](#var_true) again. If [true](#var_true), 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](#var_true)) and the current bar. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("Weekly Pivots", max_lines_count=500, overlay=true)','timeframe = "1W"','typeInput = input.string("Traditional", "Type", options=["Traditional", "Fibonacci", "Woodie", "Classic", "DM", "Camarilla"])',"weekChange = timeframe.change(timeframe)","pivotPointsArray = ta.pivot_point_levels(typeInput, weekChange)","if weekChange"," for pivotLevel in pivotPointsArray"," line.new(time, pivotLevel, time + timeframe.in_seconds(timeframe) * 1000, pivotLevel, xloc=xloc.bar_time)"],returns:['A float[] array with numerical values representing 11 pivot point levels: [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5]. Levels absent from the specified `type` return [na](#var_na) values (e.g., "DM" only calculates P, R1, and S1).'],remarks:['The `developing` parameter cannot be `true` when `type` is set to "Woodie", because the Woodie calculation for a period depends on that period\'s open, which means that the pivot value is either available or unavailable, but never developing. If used together, the indicator will return a runtime error.'],syntax:["ta.pivot_point_levels(type, anchor, developing) → float[]"],returnedTypes:["float[]"]},{name:"ta.vwap",desc:["Volume weighted average price."],args:[{name:"source",desc:"Source used for the VWAP calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Simple VWAP")',"vwap = ta.vwap(open)","plot(vwap)"]},{desc:[],examples:["//@version=5",'indicator("Advanced VWAP")','vwapAnchorInput = input.string("Daily", "Anchor", options = ["Daily", "Weekly", "Monthly"])','stdevMultiplierInput = input.float(1.0, "Standard Deviation Multiplier")',"anchorTimeframe = switch vwapAnchorInput",' "Daily" => "1D"',' "Weekly" => "1W"',' "Monthly" => "1M"',"anchor = timeframe.change(anchorTimeframe)","[vwap, upper, lower] = ta.vwap(open, anchor, stdevMultiplierInput)","plot(vwap)","plot(upper, color = color.green)","plot(lower, color = color.green)"]}],returns:["A VWAP series, or a tuple [vwap, upper_band, lower_band] if `stdev_mult` is specified."],remarks:["Calculations only begin the first time the anchor condition becomes [true](#var_true). Until then, the function returns [na](#var_na)."],seeAlso:["[ta.vwap](#var_ta.vwap) (variable)"],syntax:["ta.vwap(source) → series float"],returnedTypes:["series float"]},{name:"ta.vwap",desc:["Volume weighted average price."],args:[{name:"source",desc:"Source used for the VWAP calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"anchor",desc:'The condition that triggers the reset of VWAP calculations. When [true](#var_true), calculations reset; when [false](#var_false), calculations proceed using the values accumulated since the previous reset. Optional. The default is equivalent to passing [timeframe.change](#fun_timeframe.change) with "1D" as its argument.',required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Simple VWAP")',"vwap = ta.vwap(open)","plot(vwap)"]},{desc:[],examples:["//@version=5",'indicator("Advanced VWAP")','vwapAnchorInput = input.string("Daily", "Anchor", options = ["Daily", "Weekly", "Monthly"])','stdevMultiplierInput = input.float(1.0, "Standard Deviation Multiplier")',"anchorTimeframe = switch vwapAnchorInput",' "Daily" => "1D"',' "Weekly" => "1W"',' "Monthly" => "1M"',"anchor = timeframe.change(anchorTimeframe)","[vwap, upper, lower] = ta.vwap(open, anchor, stdevMultiplierInput)","plot(vwap)","plot(upper, color = color.green)","plot(lower, color = color.green)"]}],returns:["A VWAP series, or a tuple [vwap, upper_band, lower_band] if `stdev_mult` is specified."],remarks:["Calculations only begin the first time the anchor condition becomes [true](#var_true). Until then, the function returns [na](#var_na)."],seeAlso:["[ta.vwap](#var_ta.vwap) (variable)"],syntax:["ta.vwap(source, anchor) → series float"],returnedTypes:["series float"]},{name:"ta.vwap",desc:["Volume weighted average price."],args:[{name:"source",desc:"Source used for the VWAP calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"anchor",desc:'The condition that triggers the reset of VWAP calculations. When [true](#var_true), calculations reset; when [false](#var_false), calculations proceed using the values accumulated since the previous reset. Optional. The default is equivalent to passing [timeframe.change](#fun_timeframe.change) with "1D" as its argument.',required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"stdev_mult",desc:"If specified, the function will calculate the standard deviation bands based on the main VWAP series and return a [vwap, upper_band, lower_band] tuple. The `upper_band`/`lower_band` values are calculated using the VWAP to which the standard deviation multiplied by this argument is added/subtracted. Optional. The default is [na](#var_na), in which case the function returns a single value, not a tuple.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Simple VWAP")',"vwap = ta.vwap(open)","plot(vwap)"]},{desc:[],examples:["//@version=5",'indicator("Advanced VWAP")','vwapAnchorInput = input.string("Daily", "Anchor", options = ["Daily", "Weekly", "Monthly"])','stdevMultiplierInput = input.float(1.0, "Standard Deviation Multiplier")',"anchorTimeframe = switch vwapAnchorInput",' "Daily" => "1D"',' "Weekly" => "1W"',' "Monthly" => "1M"',"anchor = timeframe.change(anchorTimeframe)","[vwap, upper, lower] = ta.vwap(open, anchor, stdevMultiplierInput)","plot(vwap)","plot(upper, color = color.green)","plot(lower, color = color.green)"]}],returns:["A VWAP series, or a tuple [vwap, upper_band, lower_band] if `stdev_mult` is specified."],remarks:["Calculations only begin the first time the anchor condition becomes [true](#var_true). Until then, the function returns [na](#var_na)."],seeAlso:["[ta.vwap](#var_ta.vwap) (variable)"],syntax:["ta.vwap(source, anchor, stdev_mult) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.swma",desc:["Symmetrically weighted moving average with fixed length: 4. Weights: [1/6, 2/6, 2/6, 1/6]."],args:[{name:"source",desc:"Source series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("ta.swma")',"plot(ta.swma(close))","","// same on pine, but less efficient","pine_swma(x) =>"," x[3] * 1 / 6 + x[2] * 2 / 6 + x[1] * 2 / 6 + x[0] * 1 / 6","plot(pine_swma(close))"],returns:["Symmetrically weighted moving average."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.alma](#fun_ta.alma)"],syntax:["ta.swma(source) → series float"],returnedTypes:["series float"]},{name:"ta.sar",desc:["Parabolic SAR (parabolic stop and reverse) is a method devised by J. Welles Wilder, Jr., to find potential reversals in the market price direction of traded goods."],args:[{name:"start",desc:"Start.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"inc",desc:"Increment.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"max",desc:"Maximum.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.sar")',"plot(ta.sar(0.02, 0.02, 0.2), style=plot.style_cross, linewidth=3)","","// The same on Pine Script®","pine_sar(start, inc, max) =>"," var float result = na"," var float maxMin = na"," var float acceleration = na"," var bool isBelow = na"," bool isFirstTrendBar = false"," "," if bar_index == 1"," if close > close[1]"," isBelow := true"," maxMin := high"," result := low[1]"," else"," isBelow := false"," maxMin := low"," result := high[1]"," isFirstTrendBar := true"," acceleration := start"," "," result := result + acceleration * (maxMin - result)"," "," if isBelow"," if result > low"," isFirstTrendBar := true"," isBelow := false"," result := math.max(high, maxMin)"," maxMin := low"," acceleration := start"," else"," if result < high"," isFirstTrendBar := true"," isBelow := true"," result := math.min(low, maxMin)"," maxMin := high"," acceleration := start"," "," if not isFirstTrendBar"," if isBelow"," if high > maxMin"," maxMin := high"," acceleration := math.min(acceleration + inc, max)"," else"," if low < maxMin"," maxMin := low"," acceleration := math.min(acceleration + inc, max)"," "," if isBelow"," result := math.min(result, low[1])"," if bar_index > 1"," result := math.min(result, low[2])"," "," else"," result := math.max(result, high[1])"," if bar_index > 1"," result := math.max(result, high[2])"," "," result"," ","plot(pine_sar(0.02, 0.02, 0.2), style=plot.style_cross, linewidth=3)"],returns:["Parabolic SAR."],syntax:["ta.sar(start, inc, max) → series float"],returnedTypes:["series float"]},{name:"timeframe.change",desc:["Detects changes in the specified `timeframe`."],args:[{name:"timeframe",desc:"String formatted according to the [User manual's timeframe string specifications](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications).",allowedTypeIDs:["simple string","input string","const string","series string"],displayType:"simple string"}],examples:["//@version=5","// Run this script on an intraday chart.",'indicator("New day started", overlay = true)',"// Highlights the first bar of the new day.",'isNewDay = timeframe.change("1D")',"bgcolor(isNewDay ? color.new(color.green, 80) : na)"],returns:["Returns [true](#var_true) on the first bar of a new `timeframe`, [false](#var_false) otherwise."],syntax:["timeframe.change(timeframe) → series bool"],returnedTypes:["series bool"]},{name:"math.avg",desc:["Calculates average of all given series (elementwise)."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["Average."],seeAlso:["[math.sum](#fun_math.sum)","[ta.cum](#fun_ta.cum)","[ta.sma](#fun_ta.sma)"],syntax:["math.avg(number0, number1, ...) → simple float"],returnedTypes:["simple float"]},{name:"math.avg",desc:["Calculates average of all given series (elementwise)."],args:[{name:"number0, number1, ...",desc:"A sequence of numbers to use in the calculation.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["Average."],seeAlso:["[math.sum](#fun_math.sum)","[ta.cum](#fun_ta.cum)","[ta.sma](#fun_ta.sma)"],syntax:["math.avg(number0, number1, ...) → series float"],returnedTypes:["series float"]},{name:"request.currency_rate",desc:["Provides a daily rate that can be used to convert a value expressed in the `from` currency to another in the `to` currency."],args:[{name:"from",desc:'The currency in which the value to be converted is expressed. Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD"), or one of the built-in variables that return currency codes, like [syminfo.currency](#var_syminfo.currency) or [currency.USD](#var_currency.USD).',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"to",desc:'The currency in which the value is to be converted. Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD"), or one of the built-in variables that return currency codes, like [syminfo.currency](#var_syminfo.currency) or [currency.USD](#var_currency.USD).',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"ignore_invalid_currency",desc:"Determines the behavior of the function if a conversion rate between the two currencies cannot be calculated: if [false](#var_false), the script will halt and return a runtime error; if [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("Close in British Pounds")','rate = request.currency_rate(syminfo.currency, "GBP")',"plot(close * rate)"],remarks:["If `from` and `to` arguments are equal, function returns 1. Please note that using this variable/function can cause [indicator repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html)."],syntax:["request.currency_rate(from, to, ignore_invalid_currency) → series float"],returnedTypes:["series float"]},{name:"request.security",desc:["Requests data from another symbol and/or timeframe."],syntax:["request.security(symbol, timeframe, expression, gaps, lookahead, ignore_invalid_symbol, currency) → series <type>"],args:[{name:"symbol",desc:"Symbol to request the data from. Use [syminfo.tickerid](#var_syminfo.tickerid) to request data from the chart's symbol. To request data with additional parameters (extended sessions, dividend adjustments, or a non-standard chart type like Heikin Ashi or Renko), a custom ticker identifier must first be created using functions in the `ticker.*` namespace.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"timeframe",desc:"Timeframe of the requested data. To use the chart's timeframe, use an empty string or the [timeframe.period](#var_timeframe.period) variable. Valid timeframe strings are documented in the User Manual's [Timeframes](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications) page.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"expression",desc:"An expression to be calculated and returned from the [request.security](#fun_request.security) call's context. It can be a built-in variable like [close](#var_close), an expression such as `ta.sma(close, 100)`, a non-mutable user-defined variable previously calculated in the script, a function call that does not use Pine Script® drawings, an array, a matrix, or a tuple. Mutable variables are not allowed, unless they are enclosed in the body of a function used in the expression.",displayType:"variable, function, object, array or matrix of series int/float/bool/string/color, or a tuple of these",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series color","simple color","input color","const color","series string","simple string","input string","const string"]},{name:"gaps",desc:`Specifies how the returned values are merged on chart bars. Possible values: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). With [barmerge.gaps_on](#var_barmerge.gaps_on) a value only appears on the current chart bar when it first becomes available from the function's context, otherwise [na](#var_na) is returned (thus a "gap" occurs). With [barmerge.gaps_off](#var_barmerge.gaps_off) what would otherwise be gaps are filled with the latest known value returned, avoiding [na](#var_na) values. Optional. The default is [barmerge.gaps_off](#var_barmerge.gaps_off).`,allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"lookahead",desc:"On historical bars only, returns data from the timeframe before it elapses. Possible values: [barmerge.lookahead_on](#var_barmerge.lookahead_on), [barmerge.lookahead_off](#var_barmerge.lookahead_off). Has no effect on realtime values. Optional. The default is [barmerge.lookahead_off](#var_barmerge.lookahead_off) starting from Pine Script® v3. The default is [barmerge.lookahead_on](#var_barmerge.lookahead_on) in v1 and v2. WARNING: Using [barmerge.lookahead_on](#var_barmerge.lookahead_on) at timeframes higher than the chart's without offsetting the `expression` argument like in `close[1]` will introduce future leak in scripts, as the function will then return the `close` price before it is actually known in the current context. As is explained in the User Manual's page on [Repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html#future-leak-with-request-security) this will produce misleading results.",allowedTypeIDs:["simple barmerge_lookahead","input barmerge_lookahead","const barmerge_lookahead"],displayType:"simple barmerge_lookahead"},{name:"ignore_invalid_symbol",desc:"Determines the behavior of the function if the specified symbol is not found: if [false](#var_false), the script will halt and throw a runtime error; if [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"currency",desc:'Currency into which values expressed in currency units ([open](#var_open), [high](#var_high), [low](#var_low), [close](#var_close), etc.) or expressions using such values are to be converted. The conversion rates used are based on the FX_IDC pairs\' daily rates of the previous day (relative to the bar where the calculation is done). Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD") or one of the constants in the currency.* namespace, e.g. [currency.USD](#var_currency.USD). Note that literal values such as `200` are not converted. Optional. The default is [syminfo.currency](#var_syminfo.currency).',allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"calc_bars_count",desc:"If specified, the function will only request this number of values from the end of the symbol's history and calculate `expression` as if these values are the only available data, which might improve calculation speed in some cases. Optional. The default is [na](#var_na).",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Simple `request.security()` calls")',"// Returns 1D close of the current symbol.",'dailyClose = request.security(syminfo.tickerid, "1D", close)',"plot(dailyClose)","",'// Returns the close of "AAPL" from the same timeframe as currently open on the chart.','aaplClose = request.security("AAPL", timeframe.period, close)',"plot(aaplClose)"]},{desc:[],examples:["//@version=5",'indicator("Advanced `request.security()` calls")',"// This calculates a 10-period moving average on the active chart.","sma = ta.sma(close, 10)",'// This sends the `sma` calculation for execution in the context of the "AAPL" symbol at a "240" (4 hours) timeframe.','aaplSma = request.security("AAPL", "240", sma)',"plot(aaplSma)","","// To avoid differences on historical and realtime bars, you can use this technique, which only returns a value from the higher timeframe on the bar after it completes:","indexHighTF = barstate.isrealtime ? 1 : 0","indexCurrTF = barstate.isrealtime ? 0 : 1",'nonRepaintingClose = request.security(syminfo.tickerid, "1D", close[indexHighTF])[indexCurrTF]','plot(nonRepaintingClose, "Non-repainting close")',"",'// Returns the 1H close of "AAPL", extended session included. The value is dividend-adjusted.','extendedTicker = ticker.modify("NASDAQ:AAPL", session = session.extended, adjustment = adjustment.dividends)','aaplExtAdj = request.security(extendedTicker, "60", close)',"plot(aaplExtAdj)","","// Returns the result of a user-defined function.","// The `max` variable is mutable, but we can pass it to `request.security()` because it is wrapped in a function.","allTimeHigh(source) =>"," var max = source"," max := math.max(max, source)",'allTimeHigh1D = request.security(syminfo.tickerid, "1D", allTimeHigh(high))',"","// By using a tuple `expression`, we obtain several values with only one `request.security()` call.",'[open1D, high1D, low1D, close1D, ema1D] = request.security(syminfo.tickerid, "1D", [open, high, low, close, ta.ema(close, 10)])',"plotcandle(open1D, high1D, low1D, close1D)","plot(ema1D)","","// Returns an array containing the OHLC values of the chart's symbol from the 1D timeframe.",'ohlcArray = request.security(syminfo.tickerid, "1D", array.from(open, high, low, close))',"plotcandle(array.get(ohlcArray, 0), array.get(ohlcArray, 1), array.get(ohlcArray, 2), array.get(ohlcArray, 3))"]}],returns:["A result determined by `expression`."],remarks:["Pine Script® code using this function may calculate differently on historical and realtime bars, leading to [repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html).","A single script can have no more than 40 calls to `request.*()` functions."],seeAlso:["[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)","[timeframe.period](#var_timeframe.period)","[ticker.new](#fun_ticker.new)","[ticker.modify](#fun_ticker.modify)","[request.security_lower_tf](#fun_request.security_lower_tf)","[request.dividends](#fun_request.dividends)","[request.earnings](#fun_request.earnings)","[request.splits](#fun_request.splits)","[request.financial](#fun_request.financial)","[request.quandl](#fun_request.quandl)"]},{name:"request.security_lower_tf",desc:["Requests data from a specified symbol from a lower timeframe than the chart's. The function returns an array containing one element for each closed lower timeframe intrabar inside the current chart's bar. On a 5-minute chart using a `timeframe` argument of \"1\", the size of the array will usually be 5, with each array element representing the value of `expression` on a 1-minute intrabar, ordered sequentially in time."],syntax:["request.security_lower_tf(symbol, timeframe, expression, ignore_invalid_symbol, currency, ignore_invalid_timeframe) → array<type>"],args:[{name:"symbol",desc:"Symbol to request the data from. Use [syminfo.tickerid](#var_syminfo.tickerid) to request data from the chart's symbol. To request data with additional parameters (extended sessions, dividend adjustments, or a non-standard chart type like Heikin Ashi or Renko), a custom ticker identifier must first be created using functions in the `ticker.*` namespace.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"timeframe",desc:"Timeframe of the requested data. To use the chart's timeframe, use an empty string or the [timeframe.period](#var_timeframe.period) variable. Valid timeframe strings are documented in the User Manual's [Timeframes](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#timeframe-string-specifications) page.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"expression",desc:"An expression to be calculated and returned from the function call's context. It can be a built-in variable like [close](#var_close), an expression such as `ta.sma(close, 100)`, a non-mutable user-defined variable previously calculated in the script, a function call that does not use Pine Script® drawings, arrays or matrices, or a tuple. Mutable variables are not allowed, unless they are enclosed in the body of a function used in the expression.",displayType:"variable, object or function of series int/float/bool/string/color, or a tuple of these",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series color","simple color","input color","const color","series string","simple string","input string","const string"]},{name:"ignore_invalid_symbol",desc:"Determines the behavior of the function if the specified symbol is not found: if [false](#var_false), the script will halt and throw a runtime error; if [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"currency",desc:'Currency into which values expressed in currency units ([open](#var_open), [high](#var_high), [low](#var_low), [close](#var_close), etc.) or expressions using such values are to be converted. The conversion rates used are based on the FX_IDC pairs\' daily rates of the previous day (relative to the bar where the calculation is done). Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD") or one of the constants in the currency.* namespace, e.g. [currency.USD](#var_currency.USD). Note that literal values such as `200` are not converted. Optional. The default is [syminfo.currency](#var_syminfo.currency).',allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"ignore_invalid_timeframe",desc:"Determines the behavior of the function when the chart's timeframe is smaller than the `timeframe` used in the function call. If [false](#var_false), the script will halt and throw a runtime error. If [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"}],examples:["//@version=5",'indicator("`request.security_lower_tf()` Example", overlay = true)',"","// If the current chart timeframe is set to 120 minutes, then the `arrayClose` array will contain two 'close' values from the 60 minute timeframe for each bar.",'arrClose = request.security_lower_tf(syminfo.tickerid, "60", close)',"","if bar_index == last_bar_index - 1"," label.new(bar_index, high, str.tostring(arrClose))"],returns:["An array of a type determined by `expression`, or a tuple of these."],remarks:["Pine Script® code using this function may calculate differently on historical and real-time bars, leading to [repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html).","Please note that spreads (e.g., “AAPL+MSFT*TSLA”) will not always return reliable data with this function.","A single script can have no more than 40 calls to `request.*()` functions.","A maximum of 100,000 lower timeframe bars can be accessed by this function. The number of chart bars for which lower timeframe data is available will thus vary with the requested lower timeframe."],seeAlso:["[request.security](#fun_request.security)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.tickerid](#var_syminfo.tickerid)","[timeframe.period](#var_timeframe.period)","[ticker.new](#fun_ticker.new)","[request.dividends](#fun_request.dividends)","[request.earnings](#fun_request.earnings)","[request.splits](#fun_request.splits)","[request.financial](#fun_request.financial)","[request.quandl](#fun_request.quandl)"]},{name:"request.financial",desc:["Requests financial series for symbol."],args:[{name:"symbol",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL".',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"financial_id",desc:"Financial identifier. You can find the list of available ids via our [Help Center](https://www.tradingview.com/?solution=43000564727).",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"period",desc:'Reporting period. Possible values are "TTM", "FY", "FQ", "FH".',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:"Merge strategy for the requested data (requested data automatically merges with the main series: OHLC data). Possible values include: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). [barmerge.gaps_on](#var_barmerge.gaps_on) - requested data is merged with possible gaps ([na](#var_na) values). [barmerge.gaps_off](#var_barmerge.gaps_off) - requested data is merged continuously without gaps, all the gaps are filled with the previous, nearest existing values. Default value is [barmerge.gaps_off](#var_barmerge.gaps_off).",allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"ignore_invalid_symbol",desc:"An optional parameter. Determines the behavior of the function if the specified symbol is not found: if false, the script will halt and return a runtime error; if true, the function will return na and execution will continue. The default value is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"currency",desc:`Currency into which the symbol's financial metrics (e.g. Net Income) are to be converted. The conversion rates used are based on the FX_IDC pairs' daily rates of the previous day (relative to the bar where the calculation is done). Optional. The default is [syminfo.currency](#var_syminfo.currency). Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD") or one of the constants in the currency.* namespace, e.g. [currency.USD](#var_currency.USD).`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("request.financial")','f = request.financial("NASDAQ:MSFT", "ACCOUNTS_PAYABLE", "FY")',"plot(f)"],returns:["Requested series."],seeAlso:["[request.security](#fun_request.security)","[syminfo.tickerid](#var_syminfo.tickerid)"],syntax:["request.financial(symbol, financial_id, period, gaps, ignore_invalid_symbol, currency) → series float"],returnedTypes:["series float"]},{name:"request.quandl",desc:["Requests [Nasdaq Data Link](https://data.nasdaq.com/) (formerly Quandl) data for a symbol."],args:[{name:"ticker",desc:'Symbol. Note that the name of a time series and Quandl data feed should be divided by a forward slash. For example: "CFTC/SB_FO_ALL".',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:"Merge strategy for the requested data (requested data automatically merges with the main series: OHLC data). Possible values include: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). [barmerge.gaps_on](#var_barmerge.gaps_on) - requested data is merged with possible gaps ([na](#var_na) values). [barmerge.gaps_off](#var_barmerge.gaps_off) - requested data is merged continuously without gaps, all the gaps are filled with the previous, nearest existing values. Default value is [barmerge.gaps_off](#var_barmerge.gaps_off).",allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"index",desc:"A Quandl time-series column index.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"ignore_invalid_symbol",desc:"An optional parameter. Determines the behavior of the function if the specified symbol is not found: if false, the script will halt and return a runtime error; if true, the function will return na and execution will continue. The default value is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"}],examples:["//@version=5",'indicator("request.quandl")','f = request.quandl("CFTC/SB_FO_ALL", barmerge.gaps_off, 0)',"plot(f)"],returns:["Requested series."],remarks:["You can learn more about how to find ticker and index values in our [Help Center](https://www.tradingview.com/chart/?solution=43000568613)."],seeAlso:["[request.security](#fun_request.security)","[syminfo.tickerid](#var_syminfo.tickerid)"],syntax:["request.quandl(ticker, gaps, index, ignore_invalid_symbol) → series float"],returnedTypes:["series float"]},{name:"ticker.new",desc:["Creates a ticker identifier for requesting additional data for the script."],args:[{name:"prefix",desc:"Exchange prefix. For example: 'BATS', 'NYSE', 'NASDAQ'. Exchange prefix of main series is [syminfo.prefix](#var_syminfo.prefix).",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"ticker",desc:"Ticker name. For example 'AAPL', 'MSFT', 'EURUSD'. Ticker name of the main series is [syminfo.ticker](#var_syminfo.ticker).",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"session",desc:"Session type. Optional argument. Possible values: [session.regular](#var_session.regular), [session.extended](#var_session.extended). Session type of the current chart is [syminfo.session](#var_syminfo.session). If session is not given, then [syminfo.session](#var_syminfo.session) value is used.",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"adjustment",desc:"Adjustment type. Optional argument. Possible values: [adjustment.none](#var_adjustment.none), [adjustment.splits](#var_adjustment.splits), [adjustment.dividends](#var_adjustment.dividends). If adjustment is not given, then default adjustment value is used (can be different depending on particular instrument).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker.new", overlay=true) ',"t = ticker.new(syminfo.prefix, syminfo.ticker, session.regular, adjustment.splits)","t2 = ticker.heikinashi(t)","c = request.security(t2, timeframe.period, low, barmerge.gaps_on)","plot(c, style=plot.style_linebr)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],remarks:["You may use return value of [ticker.new](#fun_ticker.new) function as input argument for [ticker.heikinashi](#fun_ticker.heikinashi), [ticker.renko](#fun_ticker.renko), [ticker.linebreak](#fun_ticker.linebreak), [ticker.kagi](#fun_ticker.kagi), [ticker.pointfigure](#fun_ticker.pointfigure) functions."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.session](#var_syminfo.session)","[session.extended](#var_session.extended)","[session.regular](#var_session.regular)","[ticker.heikinashi](#fun_ticker.heikinashi)","[adjustment.none](#var_adjustment.none)","[adjustment.splits](#var_adjustment.splits)","[adjustment.dividends](#var_adjustment.dividends)"],syntax:["ticker.new(prefix, ticker, session, adjustment) → simple string"],returnedTypes:["simple string"]},{name:"ticker.standard",desc:["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. Among other things, this makes it possible to retrieve standard chart values when the script is running on a non-standard chart."],args:[{name:"symbol",desc:"A ticker ID to be converted into its standard form. Optional. The default is [syminfo.tickerid](#var_syminfo.tickerid).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker.standard", overlay = true)',"// This script should be run on a non-standard chart such as HA, Renko...","","// Requests data from the chart type the script is running on.",'chartTypeValue = request.security(syminfo.tickerid, "1D", close)',"","// Request data from the standard chart type, regardless of the chart type the script is running on.",'standardChartValue = request.security(ticker.standard(syminfo.tickerid), "1D", close)',"","// This will not use a standard ticker ID because the `symbol` argument contains only the ticker — not the prefix (exchange).",'standardChartValue2 = request.security(ticker.standard(syminfo.ticker), "1D", close)',"","plot(chartTypeValue)","plot(standardChartValue, color = color.green)"],returns:['A string representing the ticker of a standard chart in the "prefix:ticker" format. If the `symbol` argument does not contain the prefix and ticker information, the function returns the supplied argument as is.'],seeAlso:["[request.security](#fun_request.security)"],syntax:["ticker.standard(symbol) → simple string"],returnedTypes:["simple string"]},{name:"syminfo.prefix",desc:['Returns exchange prefix of the `symbol`, e.g. "NASDAQ".'],args:[{name:"symbol",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL".',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("syminfo.prefix fun", overlay=true)','i_sym = input.symbol("NASDAQ:AAPL")',"pref = syminfo.prefix(i_sym)","tick = syminfo.ticker(i_sym)","t = ticker.new(pref, tick, session.extended)",'s = request.security(t, "1D", close)',"plot(s)"],returns:['Returns exchange prefix of the `symbol`, e.g. "NASDAQ".'],remarks:["The result of the function is used in the [ticker.new](#fun_ticker.new)/[ticker.modify](#fun_ticker.modify) and [request.security](#fun_request.security)."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.prefix](#var_syminfo.prefix)","[syminfo.ticker](#fun_syminfo.ticker)","[ticker.new](#fun_ticker.new)"],syntax:["syminfo.prefix(symbol) → simple string"],returnedTypes:["simple string"]},{name:"syminfo.prefix",desc:['Returns exchange prefix of the `symbol`, e.g. "NASDAQ".'],args:[{name:"symbol",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL".',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("syminfo.prefix fun", overlay=true)','i_sym = input.symbol("NASDAQ:AAPL")',"pref = syminfo.prefix(i_sym)","tick = syminfo.ticker(i_sym)","t = ticker.new(pref, tick, session.extended)",'s = request.security(t, "1D", close)',"plot(s)"],returns:['Returns exchange prefix of the `symbol`, e.g. "NASDAQ".'],remarks:["The result of the function is used in the [ticker.new](#fun_ticker.new)/[ticker.modify](#fun_ticker.modify) and [request.security](#fun_request.security)."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.prefix](#var_syminfo.prefix)","[syminfo.ticker](#fun_syminfo.ticker)","[ticker.new](#fun_ticker.new)"],syntax:["syminfo.prefix(symbol) → series string"],returnedTypes:["series string"]},{name:"syminfo.ticker",desc:['Returns `symbol` name without exchange prefix, e.g. "AAPL".'],args:[{name:"symbol",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL".',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("syminfo.ticker fun", overlay=true) ','i_sym = input.symbol("NASDAQ:AAPL")',"pref = syminfo.prefix(i_sym)","tick = syminfo.ticker(i_sym)","t = ticker.new(pref, tick, session.extended)",'s = request.security(t, "1D", close)',"plot(s)"],returns:['Returns `symbol` name without exchange prefix, e.g. "AAPL".'],remarks:["The result of the function is used in the [ticker.new](#fun_ticker.new)/[ticker.modify](#fun_ticker.modify) and [request.security](#fun_request.security)."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.prefix](#var_syminfo.prefix)","[syminfo.prefix](#fun_syminfo.prefix)","[ticker.new](#fun_ticker.new)"],syntax:["syminfo.ticker(symbol) → simple string"],returnedTypes:["simple string"]},{name:"syminfo.ticker",desc:['Returns `symbol` name without exchange prefix, e.g. "AAPL".'],args:[{name:"symbol",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL".',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("syminfo.ticker fun", overlay=true) ','i_sym = input.symbol("NASDAQ:AAPL")',"pref = syminfo.prefix(i_sym)","tick = syminfo.ticker(i_sym)","t = ticker.new(pref, tick, session.extended)",'s = request.security(t, "1D", close)',"plot(s)"],returns:['Returns `symbol` name without exchange prefix, e.g. "AAPL".'],remarks:["The result of the function is used in the [ticker.new](#fun_ticker.new)/[ticker.modify](#fun_ticker.modify) and [request.security](#fun_request.security)."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.prefix](#var_syminfo.prefix)","[syminfo.prefix](#fun_syminfo.prefix)","[ticker.new](#fun_ticker.new)"],syntax:["syminfo.ticker(symbol) → series string"],returnedTypes:["series string"]},{name:"ticker.modify",desc:["Creates a ticker identifier for requesting additional data for the script."],args:[{name:"tickerid",desc:"Symbol name with exchange prefix, e.g. 'BATS:MSFT', 'NASDAQ:MSFT' or tickerid with session and adjustment from the [ticker.new](#fun_ticker.new) function.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"session",desc:"Session type. Optional argument. Possible values: [session.regular](#var_session.regular), [session.extended](#var_session.extended). Session type of the current chart is [syminfo.session](#var_syminfo.session). If session is not given, then [syminfo.session](#var_syminfo.session) value is used.",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"adjustment",desc:"Adjustment type. Optional argument. Possible values: [adjustment.none](#var_adjustment.none), [adjustment.splits](#var_adjustment.splits), [adjustment.dividends](#var_adjustment.dividends). If adjustment is not given, then default adjustment value is used (can be different depending on particular instrument).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker_modify", overlay=true)',"t1 = ticker.new(syminfo.prefix, syminfo.ticker, session.regular, adjustment.splits)",'c1 = request.security(t1, "D", close)',"t2 = ticker.modify(t1, session.extended)",'c2 = request.security(t2, "2D", close)',"plot(c1)","plot(c2)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[syminfo.session](#var_syminfo.session)","[session.extended](#var_session.extended)","[session.regular](#var_session.regular)","[ticker.heikinashi](#fun_ticker.heikinashi)","[adjustment.none](#var_adjustment.none)","[adjustment.splits](#var_adjustment.splits)","[adjustment.dividends](#var_adjustment.dividends)"],syntax:["ticker.modify(tickerid, session, adjustment) → simple string"],returnedTypes:["simple string"]},{name:"ticker.inherit",desc:["Constructs a ticker ID for the specified `symbol` 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 `from_tickerid` has, including extended session, dividend adjustment, currency conversion, non-standard chart types, back-adjustment, settlement-as-close, etc."],args:[{name:"from_tickerid",desc:"The ticker ID to inherit modifiers from.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"symbol",desc:"The symbol to construct the new ticker ID for. ",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker.inherit")',"",'//@variable A "NASDAQ:AAPL" ticker ID with Extender Hours enabled.','tickerExtHours = ticker.new("NASDAQ", "AAPL", session.extended)','//@variable A Heikin Ashi ticker ID for "NASDAQ:AAPL" with Extended Hours enabled.',"HAtickerExtHours = ticker.heikinashi(tickerExtHours)",'//@variable The "NASDAQ:MSFT" symbol with no modifiers.','testSymbol = "NASDAQ:MSFT"','//@variable A ticker ID for "NASDAQ:MSFT" with inherited Heikin Ashi and Extended Hours modifiers.',"testSymbolHAtickerExtHours = ticker.inherit(HAtickerExtHours, testSymbol)","",'//@variable The `close` price requested using "NASDAQ:MSFT" with inherited modifiers. ','secData = request.security(testSymbolHAtickerExtHours, "60", close, ignore_invalid_symbol = true)','//@variable The `close` price requested using "NASDAQ:MSFT" without modifiers. ','compareData = request.security(testSymbol, "60", close, ignore_invalid_symbol = true)',"","plot(secData, color = color.green)","plot(compareData)"],remarks:["If the constructed ticker ID inherits a modifier that doesn't apply to the symbol (e.g., if the `from_tickerid` has Extended Hours enabled, but no such option is available for the `symbol`), the script will ignore the modifier when requesting data using the ID. "],syntax:["ticker.inherit(from_tickerid, symbol) → simple string"],returnedTypes:["simple string"]},{name:"ticker.heikinashi",desc:["Creates a ticker identifier for requesting Heikin Ashi bar values."],args:[{name:"symbol",desc:"Symbol ticker identifier.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker.heikinashi", overlay=true) ',"heikinashi_close = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)","",'heikinashi_aapl_60_close = request.security(ticker.heikinashi("AAPL"), "60", close)',"plot(heikinashi_close)","plot(heikinashi_aapl_60_close)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[request.security](#fun_request.security)","[ticker.renko](#fun_ticker.renko)","[ticker.linebreak](#fun_ticker.linebreak)","[ticker.kagi](#fun_ticker.kagi)","[ticker.pointfigure](#fun_ticker.pointfigure)"],syntax:["ticker.heikinashi(symbol) → simple string"],returnedTypes:["simple string"]},{name:"ticker.renko",desc:["Creates a ticker identifier for requesting Renko values."],args:[{name:"symbol",desc:"Symbol ticker identifier.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"style",desc:"Box Size Assignment Method: 'ATR', 'Traditional'.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"param",desc:"ATR Length if `style` is equal to 'ATR', or Box Size if `style` is equal to 'Traditional'.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"request_wicks",desc:"Specifies if wick values are returned for Renko bricks. When [true](#var_true), [high](#var_high) and [low](#var_low) values requested from a symbol using the ticker formed by this function will include wick values when they are present. When [false](#var_false), [high](#var_high) and [low](#var_low) will always be equal to either [open](#var_open) or [close](#var_close). Optional. The default is [false](#var_false). A detailed explanation of how Renko wicks are calculated can be found in our [Help Center](https://www.tradingview.com/support/solutions/43000481040-what-do-renko-wicks-mean/).",allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"},{name:"source",desc:'The source used to calculate bricks. Optional. Possible values: "Close", "OHLC". The default is "Close".',allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("ticker.renko", overlay=true) ','renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", 10)',"renko_close = request.security(renko_tickerid, timeframe.period, close)","plot(renko_close)"],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Renko candles", overlay=false)','renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", 10)',"[renko_open, renko_high, renko_low, renko_close] = request.security(renko_tickerid, timeframe.period, [open, high, low, close])","plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_close > renko_open ? color.green : color.red)"]}],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[request.security](#fun_request.security)","[ticker.heikinashi](#fun_ticker.heikinashi)","[ticker.linebreak](#fun_ticker.linebreak)","[ticker.kagi](#fun_ticker.kagi)","[ticker.pointfigure](#fun_ticker.pointfigure)"],syntax:["ticker.renko(symbol, style, param, request_wicks, source) → simple string"],returnedTypes:["simple string"]},{name:"ticker.linebreak",desc:["Creates a ticker identifier for requesting Line Break values."],args:[{name:"symbol",desc:"Symbol ticker identifier.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"number_of_lines",desc:"Number of line.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ticker.linebreak", overlay=true) ',"linebreak_tickerid = ticker.linebreak(syminfo.tickerid, 3)","linebreak_close = request.security(linebreak_tickerid, timeframe.period, close)","plot(linebreak_close)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[request.security](#fun_request.security)","[ticker.heikinashi](#fun_ticker.heikinashi)","[ticker.renko](#fun_ticker.renko)","[ticker.kagi](#fun_ticker.kagi)","[ticker.pointfigure](#fun_ticker.pointfigure)"],syntax:["ticker.linebreak(symbol, number_of_lines) → simple string"],returnedTypes:["simple string"]},{name:"ticker.kagi",desc:["Creates a ticker identifier for requesting Kagi values."],args:[{name:"symbol",desc:"Symbol ticker identifier.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"reversal",desc:"Reversal amount (absolute price value).",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ticker.kagi", overlay=true) ',"kagi_tickerid = ticker.kagi(syminfo.tickerid, 3)","kagi_close = request.security(kagi_tickerid, timeframe.period, close)","plot(kagi_close)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[request.security](#fun_request.security)","[ticker.heikinashi](#fun_ticker.heikinashi)","[ticker.renko](#fun_ticker.renko)","[ticker.linebreak](#fun_ticker.linebreak)","[ticker.pointfigure](#fun_ticker.pointfigure)"],syntax:["ticker.kagi(symbol, reversal) → simple string"],returnedTypes:["simple string"]},{name:"ticker.pointfigure",desc:["Creates a ticker identifier for requesting Point & Figure values."],args:[{name:"symbol",desc:"Symbol ticker identifier.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"source",desc:"The source for calculating Point & Figure. Possible values are: 'hl', 'close'.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"style",desc:"Box Size Assignment Method: 'ATR', 'Traditional'.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"param",desc:"ATR Length if `style` is equal to 'ATR', or Box Size if `style` is equal to 'Traditional'.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"reversal",desc:"Reversal amount.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("ticker.pointfigure", overlay=true) ','pnf_tickerid = ticker.pointfigure(syminfo.tickerid, "hl", "Traditional", 1, 3)',"pnf_close = request.security(pnf_tickerid, timeframe.period, close)","plot(pnf_close)"],returns:["String value of ticker id, that can be supplied to [request.security](#fun_request.security) function."],seeAlso:["[syminfo.tickerid](#var_syminfo.tickerid)","[syminfo.ticker](#var_syminfo.ticker)","[request.security](#fun_request.security)","[ticker.heikinashi](#fun_ticker.heikinashi)","[ticker.renko](#fun_ticker.renko)","[ticker.linebreak](#fun_ticker.linebreak)","[ticker.kagi](#fun_ticker.kagi)"],syntax:["ticker.pointfigure(symbol, source, style, param, reversal) → simple string"],returnedTypes:["simple string"]},{name:"time",desc:["The time function returns the UNIX time of the current bar for the specified timeframe and session or NaN if the time point is out of session."],args:[{name:"timeframe",desc:"Timeframe. An empty string is interpreted as the current timeframe of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)',"// Try this on chart AAPL,1",'timeinrange(res, sess) => not na(time(res, sess, "America/New_York")) ? 1 : 0','plot(timeinrange("1", "1300-1400"), color=color.red)',"","// This plots 1.0 at every start of 10 minute bar on a 1 minute chart:","newbar(res) => ta.change(time(res)) == 0 ? 0 : 1",'plot(newbar("10"))']},{desc:["While setting up a session you can specify not just the hours and minutes but also the days of the week that will be included in that session.",`If the days aren't specified, the session is considered to have been set from Sunday (1) to Saturday (7), i.e. "1100-2000" is the same as "1100-1200:1234567".`,"","You can change that by specifying the days. For example, on a symbol that is traded seven days a week with the 24-hour trading session the following script will not color Saturdays and Sundays:"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "0000-0000:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]},{desc:["One `session` argument can include several different sessions, separated by commas. For example, the following script will highlight the bars from 10:00 to 11:00 and from 14:00 to 15:00 (workdays only):"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "1000-1100,1400-1500:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#var_time) (variable)"],syntax:["time(timeframe) → series int"],returnedTypes:["series int"]},{name:"time",desc:["The time function returns the UNIX time of the current bar for the specified timeframe and session or NaN if the time point is out of session."],args:[{name:"timeframe",desc:"Timeframe. An empty string is interpreted as the current timeframe of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"session",desc:"Session specification. Optional argument, session of the symbol is used by default. An empty string is interpreted as the session of the symbol.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)',"// Try this on chart AAPL,1",'timeinrange(res, sess) => not na(time(res, sess, "America/New_York")) ? 1 : 0','plot(timeinrange("1", "1300-1400"), color=color.red)',"","// This plots 1.0 at every start of 10 minute bar on a 1 minute chart:","newbar(res) => ta.change(time(res)) == 0 ? 0 : 1",'plot(newbar("10"))']},{desc:["While setting up a session you can specify not just the hours and minutes but also the days of the week that will be included in that session.",`If the days aren't specified, the session is considered to have been set from Sunday (1) to Saturday (7), i.e. "1100-2000" is the same as "1100-1200:1234567".`,"","You can change that by specifying the days. For example, on a symbol that is traded seven days a week with the 24-hour trading session the following script will not color Saturdays and Sundays:"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "0000-0000:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]},{desc:["One `session` argument can include several different sessions, separated by commas. For example, the following script will highlight the bars from 10:00 to 11:00 and from 14:00 to 15:00 (workdays only):"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "1000-1100,1400-1500:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#var_time) (variable)"],syntax:["time(timeframe, session) → series int"],returnedTypes:["series int"]},{name:"time",desc:["The time function returns the UNIX time of the current bar for the specified timeframe and session or NaN if the time point is out of session."],args:[{name:"timeframe",desc:"Timeframe. An empty string is interpreted as the current timeframe of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"session",desc:"Session specification. Optional argument, session of the symbol is used by default. An empty string is interpreted as the session of the symbol.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"timezone",desc:'Timezone of the `session` argument. Can only be used when a `session` is specified. Optional. The default is [syminfo.timezone](#var_syminfo.timezone). Can be specified in GMT notation (e.g. "GMT-5") or as an [IANA time zone database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g. "America/New_York").',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)',"// Try this on chart AAPL,1",'timeinrange(res, sess) => not na(time(res, sess, "America/New_York")) ? 1 : 0','plot(timeinrange("1", "1300-1400"), color=color.red)',"","// This plots 1.0 at every start of 10 minute bar on a 1 minute chart:","newbar(res) => ta.change(time(res)) == 0 ? 0 : 1",'plot(newbar("10"))']},{desc:["While setting up a session you can specify not just the hours and minutes but also the days of the week that will be included in that session.",`If the days aren't specified, the session is considered to have been set from Sunday (1) to Saturday (7), i.e. "1100-2000" is the same as "1100-1200:1234567".`,"","You can change that by specifying the days. For example, on a symbol that is traded seven days a week with the 24-hour trading session the following script will not color Saturdays and Sundays:"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "0000-0000:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]},{desc:["One `session` argument can include several different sessions, separated by commas. For example, the following script will highlight the bars from 10:00 to 11:00 and from 14:00 to 15:00 (workdays only):"],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time(timeframe.period, "1000-1100,1400-1500:23456")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#var_time) (variable)"],syntax:["time(timeframe, session, timezone) → series int"],returnedTypes:["series int"]},{name:"time_close",desc:["Returns the UNIX time of the current bar's close for the specified timeframe and session, or [na](#var_na) if the time point is outside the session. On non-standard price-based chart types (Renko, Line break, Kagi, Point & Figure, and Range), this function returns [na](#var_na) on the chart's realtime bars."],args:[{name:"timeframe",desc:"Resolution. An empty string is interpreted as the current resolution of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time_close(timeframe.period, "1200-1300", "America/New_York")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time_close](#var_time_close) (variable)"],syntax:["time_close(timeframe) → series int"],returnedTypes:["series int"]},{name:"time_close",desc:["Returns the UNIX time of the current bar's close for the specified timeframe and session, or [na](#var_na) if the time point is outside the session. On non-standard price-based chart types (Renko, Line break, Kagi, Point & Figure, and Range), this function returns [na](#var_na) on the chart's realtime bars."],args:[{name:"timeframe",desc:"Resolution. An empty string is interpreted as the current resolution of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"session",desc:"Session specification. Optional argument, session of the symbol is used by default. An empty string is interpreted as the session of the symbol.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time_close(timeframe.period, "1200-1300", "America/New_York")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time_close](#var_time_close) (variable)"],syntax:["time_close(timeframe, session) → series int"],returnedTypes:["series int"]},{name:"time_close",desc:["Returns the UNIX time of the current bar's close for the specified timeframe and session, or [na](#var_na) if the time point is outside the session. On non-standard price-based chart types (Renko, Line break, Kagi, Point & Figure, and Range), this function returns [na](#var_na) on the chart's realtime bars."],args:[{name:"timeframe",desc:"Resolution. An empty string is interpreted as the current resolution of the chart.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"session",desc:"Session specification. Optional argument, session of the symbol is used by default. An empty string is interpreted as the session of the symbol.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"timezone",desc:'Timezone of the `session` argument. Can only be used when a `session` is specified. Optional. The default is [syminfo.timezone](#var_syminfo.timezone). Can be specified in GMT notation (e.g. "GMT-5") or as an [IANA time zone database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g. "America/New_York").',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("Time", overlay=true)','t1 = time_close(timeframe.period, "1200-1300", "America/New_York")',"bgcolor(t1 ? color.new(color.blue, 90) : na)"]}],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time_close](#var_time_close) (variable)"],syntax:["time_close(timeframe, session, timezone) → series int"],returnedTypes:["series int"]},{name:"timestamp",desc:["Function timestamp returns UNIX time of specified date and time."],args:[{name:"dateString",desc:`A string containing the date and, optionally, the time and time zone. Its format must comply with either the [IETF RFC 2822](https://tools.ietf.org/html/rfc2822#section-3.3) or [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standards ("DD MMM YYYY hh:mm:ss ±hhmm" or "YYYY-MM-DDThh:mm:ss±hh:mm", so "20 Feb 2020" or "2020-02-20"). If no time is supplied, "00:00" is used. If no time zone is supplied, GMT+0 will be used. Note that this diverges from the usual behavior of the function where it returns time in the exchange's timezone.`,required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],examples:["//@version=5",'indicator("timestamp")',"plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green)","plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue)","plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow)",'plot(timestamp("GMT+6", 2016, 01, 19, 09, 30))',"plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime)",'plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia)','plot(timestamp("Feb 01 2020 22:10:05"))','plot(timestamp("2011-10-10T14:48:00"))','plot(timestamp("04 Dec 1995 00:12:00 GMT+5"))'],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#fun_time) (function) [time](#var_time) (variable) [timenow](#var_timenow) (variable) [syminfo.timezone](#var_syminfo.timezone) (variable)"],syntax:["timestamp(dateString) → const int"],returnedTypes:["const int"]},{name:"timestamp",desc:["Function timestamp returns UNIX time of specified date and time."],args:[{name:"year",desc:"Year.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"month",desc:"Month.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"day",desc:"Day.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"hour",desc:"(Optional argument) Hour. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"minute",desc:"(Optional argument) Minute. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"second",desc:"(Optional argument) Second. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("timestamp")',"plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green)","plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue)","plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow)",'plot(timestamp("GMT+6", 2016, 01, 19, 09, 30))',"plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime)",'plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia)','plot(timestamp("Feb 01 2020 22:10:05"))','plot(timestamp("2011-10-10T14:48:00"))','plot(timestamp("04 Dec 1995 00:12:00 GMT+5"))'],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#fun_time) (function) [time](#var_time) (variable) [timenow](#var_timenow) (variable) [syminfo.timezone](#var_syminfo.timezone) (variable)"],syntax:["timestamp(year, month, day, hour, minute, second) → simple int"],returnedTypes:["simple int"]},{name:"timestamp",desc:["Function timestamp returns UNIX time of specified date and time."],args:[{name:"year",desc:"Year.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"month",desc:"Month.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"day",desc:"Day.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"hour",desc:"(Optional argument) Hour. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"minute",desc:"(Optional argument) Minute. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"second",desc:"(Optional argument) Second. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("timestamp")',"plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green)","plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue)","plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow)",'plot(timestamp("GMT+6", 2016, 01, 19, 09, 30))',"plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime)",'plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia)','plot(timestamp("Feb 01 2020 22:10:05"))','plot(timestamp("2011-10-10T14:48:00"))','plot(timestamp("04 Dec 1995 00:12:00 GMT+5"))'],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#fun_time) (function) [time](#var_time) (variable) [timenow](#var_timenow) (variable) [syminfo.timezone](#var_syminfo.timezone) (variable)"],syntax:["timestamp(year, month, day, hour, minute, second) → series int"],returnedTypes:["series int"]},{name:"timestamp",desc:["Function timestamp returns UNIX time of specified date and time."],args:[{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"year",desc:"Year.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"month",desc:"Month.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"day",desc:"Day.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"hour",desc:"(Optional argument) Hour. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"minute",desc:"(Optional argument) Minute. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"second",desc:"(Optional argument) Second. Default is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("timestamp")',"plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green)","plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue)","plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow)",'plot(timestamp("GMT+6", 2016, 01, 19, 09, 30))',"plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime)",'plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia)','plot(timestamp("Feb 01 2020 22:10:05"))','plot(timestamp("2011-10-10T14:48:00"))','plot(timestamp("04 Dec 1995 00:12:00 GMT+5"))'],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#fun_time) (function) [time](#var_time) (variable) [timenow](#var_timenow) (variable) [syminfo.timezone](#var_syminfo.timezone) (variable)"],syntax:["timestamp(timezone, year, month, day, hour, minute, second) → simple int"],returnedTypes:["simple int"]},{name:"timestamp",desc:["Function timestamp returns UNIX time of specified date and time."],args:[{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"year",desc:"Year.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"month",desc:"Month.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"day",desc:"Day.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"hour",desc:"(Optional argument) Hour. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"minute",desc:"(Optional argument) Minute. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"second",desc:"(Optional argument) Second. Default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("timestamp")',"plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green)","plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue)","plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow)",'plot(timestamp("GMT+6", 2016, 01, 19, 09, 30))',"plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime)",'plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia)','plot(timestamp("Feb 01 2020 22:10:05"))','plot(timestamp("2011-10-10T14:48:00"))','plot(timestamp("04 Dec 1995 00:12:00 GMT+5"))'],returns:["UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[time](#fun_time) (function) [time](#var_time) (variable) [timenow](#var_timenow) (variable) [syminfo.timezone](#var_syminfo.timezone) (variable)"],syntax:["timestamp(timezone, year, month, day, hour, minute, second) → series int"],returnedTypes:["series int"]},{name:"year",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Year (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the year based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the year of the trading day."],seeAlso:["[year](#var_year)","[time](#fun_time)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["year(time) → series int"],returnedTypes:["series int"]},{name:"year",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Year (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the year based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the year of the trading day."],seeAlso:["[year](#var_year)","[time](#fun_time)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["year(time, timezone) → series int"],returnedTypes:["series int"]},{name:"month",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Month (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the month based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the month of the trading day."],seeAlso:["[month](#var_month)","[time](#fun_time)","[year](#fun_year)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["month(time) → series int"],returnedTypes:["series int"]},{name:"month",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Month (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the month based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the month of the trading day."],seeAlso:["[month](#var_month)","[time](#fun_time)","[year](#fun_year)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["month(time, timezone) → series int"],returnedTypes:["series int"]},{name:"weekofyear",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Week of year (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the week based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the week of the trading day."],seeAlso:["[weekofyear](#var_weekofyear)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["weekofyear(time) → series int"],returnedTypes:["series int"]},{name:"weekofyear",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Week of year (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the week based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the week of the trading day."],seeAlso:["[weekofyear](#var_weekofyear)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["weekofyear(time, timezone) → series int"],returnedTypes:["series int"]},{name:"dayofmonth",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Day of month (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the day of the trading day."],seeAlso:["[dayofmonth](#var_dayofmonth)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["dayofmonth(time) → series int"],returnedTypes:["series int"]},{name:"dayofmonth",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Day of month (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.","Note that this function returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00 UTC-4) this value can be lower by 1 than the day of the trading day."],seeAlso:["[dayofmonth](#var_dayofmonth)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["dayofmonth(time, timezone) → series int"],returnedTypes:["series int"]},{name:"dayofweek",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Day of week (in exchange timezone) for provided UNIX time."],remarks:["Note that this function returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day.","UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[dayofweek](#var_dayofweek)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["dayofweek(time) → series int"],returnedTypes:["series int"]},{name:"dayofweek",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Day of week (in exchange timezone) for provided UNIX time."],remarks:["Note that this function returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day.","UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[dayofweek](#var_dayofweek)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[hour](#fun_hour)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["dayofweek(time, timezone) → series int"],returnedTypes:["series int"]},{name:"hour",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Hour (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[hour](#var_hour)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["hour(time) → series int"],returnedTypes:["series int"]},{name:"hour",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Hour (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[hour](#var_hour)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[minute](#fun_minute)","[second](#fun_second)"],syntax:["hour(time, timezone) → series int"],returnedTypes:["series int"]},{name:"minute",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Minute (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[minute](#var_minute)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[second](#fun_second)"],syntax:["minute(time) → series int"],returnedTypes:["series int"]},{name:"minute",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Minute (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[minute](#var_minute)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[second](#fun_second)"],syntax:["minute(time, timezone) → series int"],returnedTypes:["series int"]},{name:"second",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],returns:["Second (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[second](#var_second)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)"],syntax:["second(time) → series int"],returnedTypes:["series int"]},{name:"second",args:[{name:"time",desc:"UNIX time in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"timezone",desc:'Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is [syminfo.timezone](#var_syminfo.timezone).',required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Second (in exchange timezone) for provided UNIX time."],remarks:["UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970."],seeAlso:["[second](#var_second)","[time](#fun_time)","[year](#fun_year)","[month](#fun_month)","[dayofmonth](#fun_dayofmonth)","[dayofweek](#fun_dayofweek)","[hour](#fun_hour)","[minute](#fun_minute)"],syntax:["second(time, timezone) → series int"],returnedTypes:["series int"]},{name:"ta.cross",args:[{name:"source1",desc:"First data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"source2",desc:"Second data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["true if two series have crossed each other, otherwise false."],seeAlso:["[ta.change](#fun_ta.change)"],syntax:["ta.cross(source1, source2) → series bool"],returnedTypes:["series bool"]},{name:"ta.cog",desc:["The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio."],args:[{name:"source",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.cog", overlay=true) ',"plot(ta.cog(close, 10))","","// the same on pine","pine_cog(source, length) =>"," sum = math.sum(source, length)"," num = 0.0"," for i = 0 to length - 1"," price = source[i]"," num := num + price * (i + 1)"," -num / sum","","plot(pine_cog(close, 10))"],returns:["Center of Gravity."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.stoch](#fun_ta.stoch)"],syntax:["ta.cog(source, length) → series float"],returnedTypes:["series float"]},{name:"ta.alma",desc:["Arnaud Legoux Moving Average. It uses Gaussian distribution as weights for moving average."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"offset",desc:"Controls tradeoff between smoothness (closer to 1) and responsiveness (closer to 0).",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"sigma",desc:"Changes the smoothness of ALMA. The larger sigma the smoother ALMA.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.alma", overlay=true) ',"plot(ta.alma(close, 9, 0.85, 6))","","// same on pine, but much less efficient","pine_alma(series, windowsize, offset, sigma) =>"," m = offset * (windowsize - 1)"," //m = math.floor(offset * (windowsize - 1)) // Used as m when math.floor=true"," s = windowsize / sigma"," norm = 0.0"," sum = 0.0"," for i = 0 to windowsize - 1"," weight = math.exp(-1 * math.pow(i - m, 2) / (2 * math.pow(s, 2)))"," norm := norm + weight"," sum := sum + series[windowsize - i - 1] * weight"," sum / norm","plot(pine_alma(close, 9, 0.85, 6))"],returns:["Arnaud Legoux Moving Average."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)"],syntax:["ta.alma(series, length, offset, sigma) → series float"],returnedTypes:["series float"]},{name:"ta.alma",desc:["Arnaud Legoux Moving Average. It uses Gaussian distribution as weights for moving average."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"offset",desc:"Controls tradeoff between smoothness (closer to 1) and responsiveness (closer to 0).",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"sigma",desc:"Changes the smoothness of ALMA. The larger sigma the smoother ALMA.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"floor",desc:"An optional parameter. Specifies whether the offset calculation is floored before ALMA is calculated. Default value is false.",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("ta.alma", overlay=true) ',"plot(ta.alma(close, 9, 0.85, 6))","","// same on pine, but much less efficient","pine_alma(series, windowsize, offset, sigma) =>"," m = offset * (windowsize - 1)"," //m = math.floor(offset * (windowsize - 1)) // Used as m when math.floor=true"," s = windowsize / sigma"," norm = 0.0"," sum = 0.0"," for i = 0 to windowsize - 1"," weight = math.exp(-1 * math.pow(i - m, 2) / (2 * math.pow(s, 2)))"," norm := norm + weight"," sum := sum + series[windowsize - i - 1] * weight"," sum / norm","plot(pine_alma(close, 9, 0.85, 6))"],returns:["Arnaud Legoux Moving Average."],remarks:["`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.ema](#fun_ta.ema)","[ta.rma](#fun_ta.rma)","[ta.wma](#fun_ta.wma)","[ta.vwma](#fun_ta.vwma)","[ta.swma](#fun_ta.swma)"],syntax:["ta.alma(series, length, offset, sigma, floor) → series float"],returnedTypes:["series float"]},{name:"ta.cmo",desc:["Chande Momentum Oscillator. Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("ta.cmo")',"plot(ta.cmo(close, 5), color=color.yellow)","","// the same on pine","f_cmo(src, length) =>"," float mom = ta.change(src)"," float sm1 = math.sum((mom >= 0) ? mom : 0.0, length)"," float sm2 = math.sum((mom >= 0) ? 0.0 : -mom, length)"," 100 * (sm1 - sm2) / (sm1 + sm2)","","plot(f_cmo(close, 5))"],returns:["Chande Momentum Oscillator."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.rsi](#fun_ta.rsi)","[ta.stoch](#fun_ta.stoch)","[math.sum](#fun_math.sum)"],syntax:["ta.cmo(series, length) → series float"],returnedTypes:["series float"]},{name:"ta.mfi",desc:["Money Flow Index. The Money Flow Index (MFI) is a technical oscillator that uses price and volume for identifying overbought or oversold conditions in an asset."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("Money Flow Index")',"","plot(ta.mfi(hlc3, 14), color=color.yellow)","","// the same on pine","pine_mfi(src, length) =>"," float upper = math.sum(volume * (ta.change(src) <= 0.0 ? 0.0 : src), length)"," float lower = math.sum(volume * (ta.change(src) >= 0.0 ? 0.0 : src), length)"," mfi = 100.0 - (100.0 / (1.0 + upper / lower))"," mfi","","plot(pine_mfi(hlc3, 14))"],returns:["Money Flow Index."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.rsi](#fun_ta.rsi)","[math.sum](#fun_math.sum)"],syntax:["ta.mfi(series, length) → series float"],returnedTypes:["series float"]},{name:"ta.wpr",desc:["Williams %R. The oscillator shows the current closing price in relation to the high and low of the past 'length' bars."],args:[{name:"length",desc:"Number of bars.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("Williams %R", shorttitle="%R", format=format.price, precision=2)','plot(ta.wpr(14), title="%R", color=color.new(#ff6d00, 0))'],returns:["Williams %R."],remarks:["`na` values in the `source` series are ignored."],seeAlso:["[ta.mfi](#fun_ta.mfi)","[ta.cmo](#fun_ta.cmo)"],syntax:["ta.wpr(length) → series float"],returnedTypes:["series float"]},{name:"ta.bb",desc:["Bollinger Bands. A Bollinger Band is a technical analysis tool defined by a set of lines plotted two standard deviations (positively and negatively) away from a simple moving average (SMA) of the security's price, but can be adjusted to user preferences."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.bb")',"","[middle, upper, lower] = ta.bb(close, 5, 4)","plot(middle, color=color.yellow)","plot(upper, color=color.yellow)","plot(lower, color=color.yellow)","","// the same on pine","f_bb(src, length, mult) =>"," float basis = ta.sma(src, length)"," float dev = mult * ta.stdev(src, length)"," [basis, basis + dev, basis - dev]","","[pineMiddle, pineUpper, pineLower] = f_bb(close, 5, 4)","","plot(pineMiddle)","plot(pineUpper)","plot(pineLower)"],returns:["Bollinger Bands."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.sma](#fun_ta.sma)","[ta.stdev](#fun_ta.stdev)","[ta.kc](#fun_ta.kc)"],syntax:["ta.bb(series, length, mult) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.bbw",desc:["Bollinger Bands Width. The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.bbw")',"","plot(ta.bbw(close, 5, 4), color=color.yellow)","","// the same on pine","f_bbw(src, length, mult) =>"," float basis = ta.sma(src, length)"," float dev = mult * ta.stdev(src, length)"," ((basis + dev) - (basis - dev)) / basis","","plot(f_bbw(close, 5, 4))"],returns:["Bollinger Bands Width."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.bb](#fun_ta.bb)","[ta.sma](#fun_ta.sma)","[ta.stdev](#fun_ta.stdev)"],syntax:["ta.bbw(series, length, mult) → series float"],returnedTypes:["series float"]},{name:"ta.kc",desc:["Keltner Channels. Keltner channel is a technical analysis indicator showing a central moving average line plus channel lines at a distance above and below."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.kc")',"","[middle, upper, lower] = ta.kc(close, 5, 4)","plot(middle, color=color.yellow)","plot(upper, color=color.yellow)","plot(lower, color=color.yellow)","","","// the same on pine","f_kc(src, length, mult, useTrueRange) =>"," float basis = ta.ema(src, length)"," float span = (useTrueRange) ? ta.tr : (high - low)"," float rangeEma = ta.ema(span, length)"," [basis, basis + rangeEma * mult, basis - rangeEma * mult]"," ","[pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)","","plot(pineMiddle)","plot(pineUpper)","plot(pineLower)"],returns:["Keltner Channels."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.ema](#fun_ta.ema)","[ta.atr](#fun_ta.atr)","[ta.bb](#fun_ta.bb)"],syntax:["ta.kc(series, length, mult) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.kc",desc:["Keltner Channels. Keltner channel is a technical analysis indicator showing a central moving average line plus channel lines at a distance above and below."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"useTrueRange",desc:"An optional parameter. Specifies if True Range is used; default is true. If the value is false, the range will be calculated with the expression (high - low).",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("ta.kc")',"","[middle, upper, lower] = ta.kc(close, 5, 4)","plot(middle, color=color.yellow)","plot(upper, color=color.yellow)","plot(lower, color=color.yellow)","","","// the same on pine","f_kc(src, length, mult, useTrueRange) =>"," float basis = ta.ema(src, length)"," float span = (useTrueRange) ? ta.tr : (high - low)"," float rangeEma = ta.ema(span, length)"," [basis, basis + rangeEma * mult, basis - rangeEma * mult]"," ","[pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)","","plot(pineMiddle)","plot(pineUpper)","plot(pineLower)"],returns:["Keltner Channels."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.ema](#fun_ta.ema)","[ta.atr](#fun_ta.atr)","[ta.bb](#fun_ta.bb)"],syntax:["ta.kc(series, length, mult, useTrueRange) → [series float, series float, series float]"],returnedTypes:["[series float, series float, series float]"]},{name:"ta.kcw",desc:["Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'indicator("ta.kcw")',"","plot(ta.kcw(close, 5, 4), color=color.yellow)","","// the same on pine","f_kcw(src, length, mult, useTrueRange) =>"," float basis = ta.ema(src, length)"," float span = (useTrueRange) ? ta.tr : (high - low)"," float rangeEma = ta.ema(span, length)"," "," ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basis","","plot(f_kcw(close, 5, 4, true))"],returns:["Keltner Channels Width."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.kc](#fun_ta.kc)","[ta.ema](#fun_ta.ema)","[ta.atr](#fun_ta.atr)","[ta.bb](#fun_ta.bb)"],syntax:["ta.kcw(series, length, mult) → series float"],returnedTypes:["series float"]},{name:"ta.kcw",desc:["Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel."],args:[{name:"series",desc:"Series of values to process.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars (length).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"mult",desc:"Standard deviation factor.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"useTrueRange",desc:"An optional parameter. Specifies if True Range is used; default is true. If the value is false, the range will be calculated with the expression (high - low).",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],examples:["//@version=5",'indicator("ta.kcw")',"","plot(ta.kcw(close, 5, 4), color=color.yellow)","","// the same on pine","f_kcw(src, length, mult, useTrueRange) =>"," float basis = ta.ema(src, length)"," float span = (useTrueRange) ? ta.tr : (high - low)"," float rangeEma = ta.ema(span, length)"," "," ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basis","","plot(f_kcw(close, 5, 4, true))"],returns:["Keltner Channels Width."],remarks:["`na` values in the `source` series are ignored; the function calculates on the `length` quantity of non-`na` values."],seeAlso:["[ta.kc](#fun_ta.kc)","[ta.ema](#fun_ta.ema)","[ta.atr](#fun_ta.atr)","[ta.bb](#fun_ta.bb)"],syntax:["ta.kcw(series, length, mult, useTrueRange) → series float"],returnedTypes:["series float"]},{name:"float",desc:["Casts na to float"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int/float"}],returns:["The value of the argument after casting to float."],seeAlso:["[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["float(x) → const float"],returnedTypes:["const float"]},{name:"float",desc:["Casts na to float"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int/float"}],returns:["The value of the argument after casting to float."],seeAlso:["[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["float(x) → input float"],returnedTypes:["input float"]},{name:"float",desc:["Casts na to float"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["The value of the argument after casting to float."],seeAlso:["[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["float(x) → simple float"],returnedTypes:["simple float"]},{name:"float",desc:["Casts na to float"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The value of the argument after casting to float."],seeAlso:["[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["float(x) → series float"],returnedTypes:["series float"]},{name:"int",desc:["Casts na or truncates float value to int"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int"}],returns:["The value of the argument after casting to int."],seeAlso:["[float](#fun_float)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["int(x) → simple int"],returnedTypes:["simple int"]},{name:"int",desc:["Casts na or truncates float value to int"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["input int","const int","input float","const float"],displayType:"input int"}],returns:["The value of the argument after casting to int."],seeAlso:["[float](#fun_float)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["int(x) → input int"],returnedTypes:["input int"]},{name:"int",desc:["Casts na or truncates float value to int"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["const int","const float"],displayType:"const int"}],returns:["The value of the argument after casting to int."],seeAlso:["[float](#fun_float)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["int(x) → const int"],returnedTypes:["const int"]},{name:"int",desc:["Casts na or truncates float value to int"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["The value of the argument after casting to int."],seeAlso:["[float](#fun_float)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["int(x) → series int"],returnedTypes:["series int"]},{name:"bool",desc:["Casts na to bool"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["const bool"],displayType:"const bool"}],returns:["The value of the argument after casting to bool."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["bool(x) → const bool"],returnedTypes:["const bool"]},{name:"bool",desc:["Casts na to bool"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["input bool","const bool"],displayType:"input bool"}],returns:["The value of the argument after casting to bool."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["bool(x) → input bool"],returnedTypes:["input bool"]},{name:"bool",desc:["Casts na to bool"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["simple bool","input bool","const bool"],displayType:"simple bool"}],returns:["The value of the argument after casting to bool."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["bool(x) → simple bool"],returnedTypes:["simple bool"]},{name:"bool",desc:["Casts na to bool"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],returns:["The value of the argument after casting to bool."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["bool(x) → series bool"],returnedTypes:["series bool"]},{name:"color",desc:["Casts na to color"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["const color"],displayType:"const color"}],returns:["The value of the argument after casting to color."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["color(x) → const color"],returnedTypes:["const color"]},{name:"color",desc:["Casts na to color"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["input color","const color"],displayType:"input color"}],returns:["The value of the argument after casting to color."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["color(x) → input color"],returnedTypes:["input color"]},{name:"color",desc:["Casts na to color"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["simple color","input color","const color"],displayType:"simple color"}],returns:["The value of the argument after casting to color."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["color(x) → simple color"],returnedTypes:["simple color"]},{name:"color",desc:["Casts na to color"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],returns:["The value of the argument after casting to color."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["color(x) → series color"],returnedTypes:["series color"]},{name:"string",desc:["Casts na to string"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["The value of the argument after casting to string."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[line](#fun_line)","[label](#fun_label)"],syntax:["string(x) → const string"],returnedTypes:["const string"]},{name:"string",desc:["Casts na to string"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["input string","const string"],displayType:"input string"}],returns:["The value of the argument after casting to string."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[line](#fun_line)","[label](#fun_label)"],syntax:["string(x) → input string"],returnedTypes:["input string"]},{name:"string",desc:["Casts na to string"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["The value of the argument after casting to string."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[line](#fun_line)","[label](#fun_label)"],syntax:["string(x) → simple string"],returnedTypes:["simple string"]},{name:"string",desc:["Casts na to string"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["The value of the argument after casting to string."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[line](#fun_line)","[label](#fun_label)"],syntax:["string(x) → series string"],returnedTypes:["series string"]},{name:"line",desc:["Casts na to line"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],returns:["The value of the argument after casting to line."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[label](#fun_label)"],syntax:["line(x) → series line"],returnedTypes:["series line"]},{name:"label",desc:["Casts na to label"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],returns:["The value of the argument after casting to label."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)"],syntax:["label(x) → series label"],returnedTypes:["series label"]},{name:"table",desc:["Casts na to table"],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series table"],displayType:"series table"}],returns:["The value of the argument after casting to table."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["table(x) → series table"],returnedTypes:["series table"]},{name:"box",desc:["Casts na to box."],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],returns:["The value of the argument after casting to box."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["box(x) → series box"],returnedTypes:["series box"]},{name:"linefill",desc:["Casts na to linefill."],args:[{name:"x",desc:"The value to convert to the specified type, usually [na](#var_na).",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"}],returns:["The value of the argument after casting to linefill."],seeAlso:["[float](#fun_float)","[int](#fun_int)","[bool](#fun_bool)","[color](#fun_color)","[string](#fun_string)","[line](#fun_line)","[label](#fun_label)"],syntax:["linefill(x) → series linefill"],returnedTypes:["series linefill"]},{name:"str.tostring",args:[{name:"value",desc:"Value or array ID whose elements are converted to a string.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series string","simple string","input string","const string","series bool","simple bool","input bool","const bool","int[]","float[]","bool[]","string[]","matrix<int>","matrix<float>","matrix<bool>","matrix<string>"],displayType:"series int/float"}],returns:["The string representation of the `value` argument.","If the `value` argument is a string, it is returned as is.",'When the `value` is na, the function returns the string "NaN".'],remarks:[`The formatting of float values will also round those values when necessary, e.g. str.tostring(3.99, '#') will return "4".`,"To display trailing zeros, use '0' instead of '#'. For example, '#.000'.","When using [format.mintick](#var_format.mintick), the value will be rounded to the nearest number that can be divided by [syminfo.mintick](#var_syminfo.mintick) without the remainder. The string is returned with trailing zeros.","If the x argument is a string, the same string value will be returned.",'Bool type arguments return "true" or "false".','When x is na, the function returns "NaN".'],syntax:["str.tostring(value) → series string"],returnedTypes:["series string"]},{name:"str.tostring",args:[{name:"value",desc:"Value or array ID whose elements are converted to a string.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float","simple string","input string","const string","simple bool","input bool","const bool"],displayType:"simple int/float"}],returns:["The string representation of the `value` argument.","If the `value` argument is a string, it is returned as is.",'When the `value` is na, the function returns the string "NaN".'],remarks:[`The formatting of float values will also round those values when necessary, e.g. str.tostring(3.99, '#') will return "4".`,"To display trailing zeros, use '0' instead of '#'. For example, '#.000'.","When using [format.mintick](#var_format.mintick), the value will be rounded to the nearest number that can be divided by [syminfo.mintick](#var_syminfo.mintick) without the remainder. The string is returned with trailing zeros.","If the x argument is a string, the same string value will be returned.",'Bool type arguments return "true" or "false".','When x is na, the function returns "NaN".'],syntax:["str.tostring(value) → simple string"],returnedTypes:["simple string"]},{name:"str.tostring",args:[{name:"value",desc:"Value or array ID whose elements are converted to a string.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","int[]","float[]","matrix<int>","matrix<float>"],displayType:"series int/float"},{name:"format",desc:"Format string. Accepts these format.* constants: [format.mintick](#var_format.mintick), [format.percent](#var_format.percent), [format.volume](#var_format.volume). Optional. The default value is '#.##########'.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["The string representation of the `value` argument.","If the `value` argument is a string, it is returned as is.",'When the `value` is na, the function returns the string "NaN".'],remarks:[`The formatting of float values will also round those values when necessary, e.g. str.tostring(3.99, '#') will return "4".`,"To display trailing zeros, use '0' instead of '#'. For example, '#.000'.","When using [format.mintick](#var_format.mintick), the value will be rounded to the nearest number that can be divided by [syminfo.mintick](#var_syminfo.mintick) without the remainder. The string is returned with trailing zeros.","If the x argument is a string, the same string value will be returned.",'Bool type arguments return "true" or "false".','When x is na, the function returns "NaN".'],syntax:["str.tostring(value, format) → series string"],returnedTypes:["series string"]},{name:"str.tostring",args:[{name:"value",desc:"Value or array ID whose elements are converted to a string.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"format",desc:"Format string. Accepts these format.* constants: [format.mintick](#var_format.mintick), [format.percent](#var_format.percent), [format.volume](#var_format.volume). Optional. The default value is '#.##########'.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["The string representation of the `value` argument.","If the `value` argument is a string, it is returned as is.",'When the `value` is na, the function returns the string "NaN".'],remarks:[`The formatting of float values will also round those values when necessary, e.g. str.tostring(3.99, '#') will return "4".`,"To display trailing zeros, use '0' instead of '#'. For example, '#.000'.","When using [format.mintick](#var_format.mintick), the value will be rounded to the nearest number that can be divided by [syminfo.mintick](#var_syminfo.mintick) without the remainder. The string is returned with trailing zeros.","If the x argument is a string, the same string value will be returned.",'Bool type arguments return "true" or "false".','When x is na, the function returns "NaN".'],syntax:["str.tostring(value, format) → simple string"],returnedTypes:["simple string"]},{name:"str.tonumber",desc:['Converts a value represented in `string` to its "float" equivalent.'],args:[{name:"string",desc:"String containing the representation of an integer or floating point value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:['A "float" equivalent of the value in `string`. If the value is not a properly formed integer or floating point value, the function returns [na](#var_na).'],syntax:["str.tonumber(string) → series float"],returnedTypes:["series float"]},{name:"str.tonumber",desc:['Converts a value represented in `string` to its "float" equivalent.'],args:[{name:"string",desc:"String containing the representation of an integer or floating point value.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:['A "float" equivalent of the value in `string`. If the value is not a properly formed integer or floating point value, the function returns [na](#var_na).'],syntax:["str.tonumber(string) → const float"],returnedTypes:["const float"]},{name:"str.tonumber",desc:['Converts a value represented in `string` to its "float" equivalent.'],args:[{name:"string",desc:"String containing the representation of an integer or floating point value.",required:!0,allowedTypeIDs:["input string","const string"],displayType:"input string"}],returns:['A "float" equivalent of the value in `string`. If the value is not a properly formed integer or floating point value, the function returns [na](#var_na).'],syntax:["str.tonumber(string) → input float"],returnedTypes:["input float"]},{name:"str.tonumber",desc:['Converts a value represented in `string` to its "float" equivalent.'],args:[{name:"string",desc:"String containing the representation of an integer or floating point value.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:['A "float" equivalent of the value in `string`. If the value is not a properly formed integer or floating point value, the function returns [na](#var_na).'],syntax:["str.tonumber(string) → simple float"],returnedTypes:["simple float"]},{name:"str.replace_all",desc:["Replaces each occurrence of the target string in the source string with the replacement string."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"target",desc:"String to be replaced.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"replacement",desc:"String to be substituted for each occurrence of target string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["Processed string."],syntax:["str.replace_all(source, target, replacement) → simple string"],returnedTypes:["simple string"]},{name:"str.replace_all",desc:["Replaces each occurrence of the target string in the source string with the replacement string."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"target",desc:"String to be replaced.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"replacement",desc:"String to be substituted for each occurrence of target string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Processed string."],syntax:["str.replace_all(source, target, replacement) → series string"],returnedTypes:["series string"]},{name:"str.contains",desc:["Returns true if the `source` string contains the `str` substring, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],examples:["//@version=5",'indicator("str.contains")',"// If the current chart is a continuous futures chart, e.g “BTC1!”, then the function will return true, false otherwise.",'var isFutures = str.contains(syminfo.tickerid, "!")',"plot(isFutures ? 1 : 0)"],returns:["True if the `str` was found in the `source` string, false otherwise."],seeAlso:["[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.contains(source, str) → const bool"],returnedTypes:["const bool"]},{name:"str.contains",desc:["Returns true if the `source` string contains the `str` substring, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("str.contains")',"// If the current chart is a continuous futures chart, e.g “BTC1!”, then the function will return true, false otherwise.",'var isFutures = str.contains(syminfo.tickerid, "!")',"plot(isFutures ? 1 : 0)"],returns:["True if the `str` was found in the `source` string, false otherwise."],seeAlso:["[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.contains(source, str) → simple bool"],returnedTypes:["simple bool"]},{name:"str.contains",desc:["Returns true if the `source` string contains the `str` substring, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("str.contains")',"// If the current chart is a continuous futures chart, e.g “BTC1!”, then the function will return true, false otherwise.",'var isFutures = str.contains(syminfo.tickerid, "!")',"plot(isFutures ? 1 : 0)"],returns:["True if the `str` was found in the `source` string, false otherwise."],seeAlso:["[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.contains(source, str) → series bool"],returnedTypes:["series bool"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos) → const string"],returnedTypes:["const string"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos) → simple string"],returnedTypes:["simple string"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos) → series string"],returnedTypes:["series string"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["const int"],displayType:"const int"},{name:"end_pos",desc:"The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the `source` string.",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos, end_pos) → const string"],returnedTypes:["const string"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"end_pos",desc:"The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the `source` string.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos, end_pos) → simple string"],returnedTypes:["simple string"]},{name:"str.substring",desc:["Returns a new string that is a substring of the `source` string. The substring begins with the character at the index specified by `begin_pos` and extends to 'end_pos - 1' of the `source` string."],args:[{name:"source",desc:"Source string from which to extract the substring.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"begin_pos",desc:"The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_pos",desc:"The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the `source` string.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("str.substring", overlay = true)','sym= input.symbol("NASDAQ:AAPL")','pos = str.pos(sym, ":") // Get position of ":" character','tkr= str.substring(sym, pos+1) // "AAPL"',"if barstate.islastconfirmedhistory"," label.new(bar_index, high, text = tkr)"],returns:["The substring extracted from the source string."],remarks:"Strings indexing starts from 0. If `begin_pos` is equal to `end_pos`, the function returns an empty string.",seeAlso:["[str.contains](#fun_str.contains)","[str.pos](#fun_str.pos)","[str.match](#fun_str.match)"],syntax:["str.substring(source, begin_pos, end_pos) → series string"],returnedTypes:["series string"]},{name:"str.replace",desc:["Returns a new string with the Nth occurrence of the `target` string replaced by the `replacement` string, where N is specified in `occurrence`."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"target",desc:"String to be replaced.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"replacement",desc:"String to be inserted instead of the target string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"occurrence",desc:"N-th occurrence of the target string to replace. Indexing starts at 0 for the first match. Optional. Default value is 0.",allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'indicator("str.replace")','var source = "FTX:BTCUSD / FTX:BTCEUR"',"",'// Replace first occurrence of "FTX" with "BINANCE" replacement string','var newSource = str.replace(source, "FTX", "BINANCE", 0)',"","if barstate.islastconfirmedhistory",' // Display "BINANCE:BTCUSD / FTX:BTCEUR"'," label.new(bar_index, high, text = newSource)"],returns:["Processed string."],seeAlso:["[str.replace_all](#fun_str.replace_all)","[str.match](#fun_str.match)"],syntax:["str.replace(source, target, replacement, occurrence) → const string"],returnedTypes:["const string"]},{name:"str.replace",desc:["Returns a new string with the Nth occurrence of the `target` string replaced by the `replacement` string, where N is specified in `occurrence`."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"target",desc:"String to be replaced.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"replacement",desc:"String to be inserted instead of the target string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"occurrence",desc:"N-th occurrence of the target string to replace. Indexing starts at 0 for the first match. Optional. Default value is 0.",allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"}],examples:["//@version=5",'indicator("str.replace")','var source = "FTX:BTCUSD / FTX:BTCEUR"',"",'// Replace first occurrence of "FTX" with "BINANCE" replacement string','var newSource = str.replace(source, "FTX", "BINANCE", 0)',"","if barstate.islastconfirmedhistory",' // Display "BINANCE:BTCUSD / FTX:BTCEUR"'," label.new(bar_index, high, text = newSource)"],returns:["Processed string."],seeAlso:["[str.replace_all](#fun_str.replace_all)","[str.match](#fun_str.match)"],syntax:["str.replace(source, target, replacement, occurrence) → simple string"],returnedTypes:["simple string"]},{name:"str.replace",desc:["Returns a new string with the Nth occurrence of the `target` string replaced by the `replacement` string, where N is specified in `occurrence`."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"target",desc:"String to be replaced.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"replacement",desc:"String to be inserted instead of the target string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"occurrence",desc:"N-th occurrence of the target string to replace. Indexing starts at 0 for the first match. Optional. Default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("str.replace")','var source = "FTX:BTCUSD / FTX:BTCEUR"',"",'// Replace first occurrence of "FTX" with "BINANCE" replacement string','var newSource = str.replace(source, "FTX", "BINANCE", 0)',"","if barstate.islastconfirmedhistory",' // Display "BINANCE:BTCUSD / FTX:BTCEUR"'," label.new(bar_index, high, text = newSource)"],returns:["Processed string."],seeAlso:["[str.replace_all](#fun_str.replace_all)","[str.match](#fun_str.match)"],syntax:["str.replace(source, target, replacement, occurrence) → series string"],returnedTypes:["series string"]},{name:"str.lower",desc:["Returns a new string with all letters converted to lowercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["A new string with all letters converted to lowercase."],seeAlso:["[str.upper](#fun_str.upper)"],syntax:["str.lower(source) → const string"],returnedTypes:["const string"]},{name:"str.lower",desc:["Returns a new string with all letters converted to lowercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["A new string with all letters converted to lowercase."],seeAlso:["[str.upper](#fun_str.upper)"],syntax:["str.lower(source) → simple string"],returnedTypes:["simple string"]},{name:"str.lower",desc:["Returns a new string with all letters converted to lowercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["A new string with all letters converted to lowercase."],seeAlso:["[str.upper](#fun_str.upper)"],syntax:["str.lower(source) → series string"],returnedTypes:["series string"]},{name:"str.upper",desc:["Returns a new string with all letters converted to uppercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["A new string with all letters converted to uppercase."],seeAlso:["[str.lower](#fun_str.lower)"],syntax:["str.upper(source) → const string"],returnedTypes:["const string"]},{name:"str.upper",desc:["Returns a new string with all letters converted to uppercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["A new string with all letters converted to uppercase."],seeAlso:["[str.lower](#fun_str.lower)"],syntax:["str.upper(source) → simple string"],returnedTypes:["simple string"]},{name:"str.upper",desc:["Returns a new string with all letters converted to uppercase."],args:[{name:"source",desc:"String to be converted.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["A new string with all letters converted to uppercase."],seeAlso:["[str.lower](#fun_str.lower)"],syntax:["str.upper(source) → series string"],returnedTypes:["series string"]},{name:"str.startswith",desc:["Returns true if the `source` string starts with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["True if the `source` string starts with the substring specified in `str`, false otherwise."],seeAlso:["[str.endswith](#fun_str.endswith)"],syntax:["str.startswith(source, str) → const bool"],returnedTypes:["const bool"]},{name:"str.startswith",desc:["Returns true if the `source` string starts with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["True if the `source` string starts with the substring specified in `str`, false otherwise."],seeAlso:["[str.endswith](#fun_str.endswith)"],syntax:["str.startswith(source, str) → simple bool"],returnedTypes:["simple bool"]},{name:"str.startswith",desc:["Returns true if the `source` string starts with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["True if the `source` string starts with the substring specified in `str`, false otherwise."],seeAlso:["[str.endswith](#fun_str.endswith)"],syntax:["str.startswith(source, str) → series bool"],returnedTypes:["series bool"]},{name:"str.endswith",desc:["Returns true if the `source` string ends with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["True if the `source` string ends with the substring specified in `str`, false otherwise."],seeAlso:["[str.startswith](#fun_str.startswith)"],syntax:["str.endswith(source, str) → const bool"],returnedTypes:["const bool"]},{name:"str.endswith",desc:["Returns true if the `source` string ends with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["True if the `source` string ends with the substring specified in `str`, false otherwise."],seeAlso:["[str.startswith](#fun_str.startswith)"],syntax:["str.endswith(source, str) → simple bool"],returnedTypes:["simple bool"]},{name:"str.endswith",desc:["Returns true if the `source` string ends with the substring specified in `str`, false otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["True if the `source` string ends with the substring specified in `str`, false otherwise."],seeAlso:["[str.startswith](#fun_str.startswith)"],syntax:["str.endswith(source, str) → series bool"],returnedTypes:["series bool"]},{name:"str.match",desc:["Returns the new substring of the `source` string if it matches a `regex` regular expression, an empty string otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"regex",desc:"The regular expression to which this string is to be matched.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("str.match")',"",`s = input.string("It's time to sell some NASDAQ:AAPL!")`,"",'// finding first substring that matches regular expression "[\\w]+:[\\w]+"','var string tickerid = str.match(s, "[\\\\w]+:[\\\\w]+")',"","if barstate.islastconfirmedhistory",' label.new(bar_index, high, text = tickerid) // "NASDAQ:AAPL"'],returns:["The new substring of the `source` string if it matches a `regex` regular expression, an empty string otherwise."],remarks:["Function returns first occurrence of the [regular expression](https://en.wikipedia.org/wiki/Regular_expression#Perl_and_PCRE) in the `source` string.",'The backslash "\\" symbol in the`regex` string needs to be escaped with additional backslash, e.g. "\\\\d" stands for regular expression "\\d".'],seeAlso:["[str.contains](#fun_str.contains)","[str.substring](#fun_str.substring)"],syntax:["str.match(source, regex) → simple string"],returnedTypes:["simple string"]},{name:"str.match",desc:["Returns the new substring of the `source` string if it matches a `regex` regular expression, an empty string otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"regex",desc:"The regular expression to which this string is to be matched.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("str.match")',"",`s = input.string("It's time to sell some NASDAQ:AAPL!")`,"",'// finding first substring that matches regular expression "[\\w]+:[\\w]+"','var string tickerid = str.match(s, "[\\\\w]+:[\\\\w]+")',"","if barstate.islastconfirmedhistory",' label.new(bar_index, high, text = tickerid) // "NASDAQ:AAPL"'],returns:["The new substring of the `source` string if it matches a `regex` regular expression, an empty string otherwise."],remarks:["Function returns first occurrence of the [regular expression](https://en.wikipedia.org/wiki/Regular_expression#Perl_and_PCRE) in the `source` string.",'The backslash "\\" symbol in the`regex` string needs to be escaped with additional backslash, e.g. "\\\\d" stands for regular expression "\\d".'],seeAlso:["[str.contains](#fun_str.contains)","[str.substring](#fun_str.substring)"],syntax:["str.match(source, regex) → series string"],returnedTypes:["series string"]},{name:"str.pos",desc:["Returns the position of the first occurrence of the `str` string in the `source` string, 'na' otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["Position of the `str` string in the `source` string."],remarks:"Strings indexing starts at 0.",seeAlso:["[str.contains](#fun_str.contains)","[str.match](#fun_str.match)","[str.substring](#fun_str.substring)"],syntax:["str.pos(source, str) → const int"],returnedTypes:["const int"]},{name:"str.pos",desc:["Returns the position of the first occurrence of the `str` string in the `source` string, 'na' otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["Position of the `str` string in the `source` string."],remarks:"Strings indexing starts at 0.",seeAlso:["[str.contains](#fun_str.contains)","[str.match](#fun_str.match)","[str.substring](#fun_str.substring)"],syntax:["str.pos(source, str) → simple int"],returnedTypes:["simple int"]},{name:"str.pos",desc:["Returns the position of the first occurrence of the `str` string in the `source` string, 'na' otherwise."],args:[{name:"source",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"str",desc:"The substring to search for.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["Position of the `str` string in the `source` string."],remarks:"Strings indexing starts at 0.",seeAlso:["[str.contains](#fun_str.contains)","[str.match](#fun_str.match)","[str.substring](#fun_str.substring)"],syntax:["str.pos(source, str) → series int"],returnedTypes:["series int"]},{name:"str.split",desc:["Divides a string into an array of substrings and returns its array id."],args:[{name:"string",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"separator",desc:"The string separating each substring.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["The id of an array of strings."],syntax:["str.split(string, separator) → string[]"],returnedTypes:["string[]"]},{name:"str.length",desc:["Returns an integer corresponding to the amount of chars in that string."],args:[{name:"string",desc:"Source string.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"}],returns:["The number of chars in source string."],syntax:["str.length(string) → const int"],returnedTypes:["const int"]},{name:"str.length",desc:["Returns an integer corresponding to the amount of chars in that string."],args:[{name:"string",desc:"Source string.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],returns:["The number of chars in source string."],syntax:["str.length(string) → simple int"],returnedTypes:["simple int"]},{name:"str.length",desc:["Returns an integer corresponding to the amount of chars in that string."],args:[{name:"string",desc:"Source string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],returns:["The number of chars in source string."],syntax:["str.length(string) → series int"],returnedTypes:["series int"]},{name:"ta.percentile_nearest_rank",desc:["Calculates percentile using method of Nearest Rank."],args:[{name:"source",desc:"Series of values to process (source).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars back (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"percentage",desc:"Percentage, a number from range 0..100.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["P-th percentile of `source` series for `length` bars back."],remarks:["Using the Nearest Rank method on lengths less than 100 bars back can result in the same number being used for more than one percentile.","A percentile calculated using the Nearest Rank method will always be a member of the input data set.","The 100th percentile is defined to be the largest value in the input data set.","`na` values in the `source` series are ignored."],seeAlso:["[ta.percentile_linear_interpolation](#fun_ta.percentile_linear_interpolation)","http://en.wikipedia.org/wiki/Percentile#The_Nearest_Rank_method"],syntax:["ta.percentile_nearest_rank(source, length, percentage) → series float"],returnedTypes:["series float"]},{name:"ta.percentile_linear_interpolation",desc:["Calculates percentile using method of linear interpolation between the two nearest ranks."],args:[{name:"source",desc:"Series of values to process (source).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"length",desc:"Number of bars back (length).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"percentage",desc:"Percentage, a number from range 0..100.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],returns:["P-th percentile of `source` series for `length` bars back."],remarks:["Note that a percentile calculated using this method will NOT always be a member of the input data set.","`na` values in the `source` series are included in calculations and will produce an `na` result."],seeAlso:["[ta.percentile_nearest_rank](#fun_ta.percentile_nearest_rank)"],syntax:["ta.percentile_linear_interpolation(source, length, percentage) → series float"],returnedTypes:["series float"]},{name:"ta.crossover",desc:["The `source1`-series is defined as having crossed over `source2`-series if, on the current bar, the value of `source1` is greater than the value of `source2`, and on the previous bar, the value of `source1` was less than or equal to the value of `source2`."],args:[{name:"source1",desc:"First data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"source2",desc:"Second data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["true if `source1` crossed over `source2` otherwise false."],syntax:["ta.crossover(source1, source2) → series bool"],returnedTypes:["series bool"]},{name:"ta.crossunder",desc:["The `source1`-series is defined as having crossed under `source2`-series if, on the current bar, the value of `source1` is less than the value of `source2`, and on the previous bar, the value of `source1` was greater than or equal to the value of `source2`."],args:[{name:"source1",desc:"First data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"source2",desc:"Second data series.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],returns:["true if `source1` crossed under `source2` otherwise false."],syntax:["ta.crossunder(source1, source2) → series bool"],returnedTypes:["series bool"]},{name:"strategy",desc:["This declaration statement designates the script as a strategy and sets a number of strategy-related properties."],args:[{name:"title",desc:"The title of the script. It is displayed on the chart when no `shorttitle` argument is used, and becomes the publication's default title when publishing the script.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"shorttitle",desc:"The script's display name on charts. If specified, it will replace the `title` argument in most chart-related windows. Optional. The default is the argument used for `title`.",allowedTypeIDs:["const string"],displayType:"const string"},{name:"overlay",desc:"If [true](#var_true), the strategy will be displayed over the chart. If [false](#var_false), it will be added in a separate pane. Strategy-specific labels that display entries and exits will be displayed over the main chart regardless of this setting. Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"format",desc:"Specifies the formatting of the script's displayed values. Possible values: [format.inherit](#var_format.inherit), [format.price](#var_format.price), [format.volume](#var_format.volume), [format.percent](#var_format.percent). Optional. The default is [format.inherit](#var_format.inherit).",allowedTypeIDs:["const string"],displayType:"const string"},{name:"precision",desc:"Specifies the number of digits after the floating point of the script's displayed values. Must be a non-negative integer no greater than 16. If `format` is set to [format.inherit](#var_format.inherit) and `precision` is specified, the format will instead be set to [format.price](#var_format.price). Optional. The default is inherited from the precision of the chart's symbol.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"scale",desc:"The price scale used. Possible values: [scale.right](#var_scale.right), [scale.left](#var_scale.left), [scale.none](#var_scale.none). The [scale.none](#var_scale.none) value can only be applied in combination with `overlay = true`. Optional. By default, the script uses the same scale as the chart.",allowedTypeIDs:["const scale_type"],displayType:"const scale_type"},{name:"pyramiding",desc:`The maximum number of entries allowed in the same direction. If the value is 0, only one entry order in the same direction can be opened, and additional entry orders are rejected. This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is 0.`,allowedTypeIDs:["const int"],displayType:"const int"},{name:"calc_on_order_fills",desc:`Specifies whether the strategy should be recalculated after an order is filled. If [true](#var_true), the strategy recalculates after an order is filled, as opposed to recalculating only when the bar closes. This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is [false](#var_false).`,allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"calc_on_every_tick",desc:`Specifies whether the strategy should be recalculated on each realtime tick. If [true](#var_true), when the strategy is running on a realtime bar, it will recalculate on each chart update. If [false](#var_false), the strategy only calculates when the realtime bar closes. The argument used does not affect strategy calculation on historical data. This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is [false](#var_false).`,allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"max_bars_back",desc:"The length of the historical buffer the script keeps for every variable and function, which determines how many past values can be referenced using the `[]` history-referencing operator. The required buffer size is automatically detected by the Pine Script® runtime. Using this parameter is only necessary when a runtime error occurs because automatic detection fails. More information on the underlying mechanics of the historical buffer can be found [in our Help Center](https://www.tradingview.com/chart/?solution=43000587849). Optional. The default is 0.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"backtest_fill_limits_assumption",desc:"Limit order execution threshold in ticks. When it is used, limit orders are only filled if the market price exceeds the order's limit level by the specified number of ticks. Optional. The default is 0.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"default_qty_type",desc:'Specifies the units used for `default_qty_value`. Possible values are: [strategy.fixed](#var_strategy.fixed) for contracts/shares/lots, [strategy.cash](#var_strategy.cash) for currency amounts, or [strategy.percent_of_equity](#var_strategy.percent_of_equity) for a percentage of available equity. This setting can also be changed in the strategy\'s "Settings/Properties" tab. Optional. The default is [strategy.fixed](#var_strategy.fixed).',allowedTypeIDs:["const string"],displayType:"const string"},{name:"default_qty_value",desc:'The default quantity to trade, in units determined by the argument used with the `default_qty_type` parameter. This setting can also be changed in the strategy\'s "Settings/Properties" tab. Optional. The default is 1.',allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"initial_capital",desc:"The amount of funds initially available for the strategy to trade, in units of `currency`. Optional. The default is 1000000.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"currency",desc:"Currency used by the strategy in currency-related calculations. Market positions are still opened by converting `currency` into the chart symbol's currency. The conversion rates used are based on the FX_IDC pairs' daily rates of the previous day (relative to the bar where the calculation is done). This setting can also be changed in the strategy's \"Settings/Properties\" tab. Optional. The default is [currency.NONE](#var_currency.NONE), in which case the chart's currency is used. Possible values: one of the constants in the `currency.*` namespace, e.g. [currency.USD](#var_currency.USD).",allowedTypeIDs:["const string"],displayType:"const string"},{name:"slippage",desc:'Slippage expressed in ticks. This value is added to or subtracted from the fill price of market/stop orders to make the fill price less favorable for the strategy. E.g., if [syminfo.mintick](#var_syminfo.mintick) is 0.01 and `slippage` is set to 5, a long market order will enter at 5 * 0.01 = 0.05 points above the actual price. This setting can also be changed in the strategy\'s "Settings/Properties" tab. Optional. The default is 0.',allowedTypeIDs:["const int"],displayType:"const int"},{name:"commission_type",desc:'Determines what the number passed to the `commission_value` expresses: [strategy.commission.percent](#var_strategy.commission.percent) for a percentage of the cash volume of the order, [strategy.commission.cash_per_contract](#var_strategy.commission.cash_per_contract) for currency per contract, [strategy.commission.cash_per_order](#var_strategy.commission.cash_per_order) for currency per order. This setting can also be changed in the strategy\'s "Settings/Properties" tab. Optional. The default is [strategy.commission.percent](#var_strategy.commission.percent).',allowedTypeIDs:["const string"],displayType:"const string"},{name:"commission_value",desc:"Commission applied to the strategy's orders in units determined by the argument passed to the `commission_type` parameter. This setting can also be changed in the strategy's \"Settings/Properties\" tab. Optional. The default is 0.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"process_orders_on_close",desc:`When set to [true](#var_true), generates an additional attempt to execute orders after a bar closes and strategy calculations are completed. If the orders are market orders, the broker emulator executes them before the next bar's open. If the orders are price-dependent, they will only be filled if the price conditions are met. This option is useful if you wish to close positions on the current bar. This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is [false](#var_false).`,allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"close_entries_rule",desc:'Determines the order in which trades are closed. Possible values are: "FIFO" (First-In, First-Out) if the earliest exit order must close the earliest entry order, or "ANY" if the orders are closed based on the `from_entry` parameter of the [strategy.exit](#fun_strategy.exit) function. "FIFO" can only be used with stocks, futures and US forex (NFA Compliance Rule 2-43b), while "ANY" is allowed in non-US forex. Optional. The default is "FIFO".',allowedTypeIDs:["const string"],displayType:"const string"},{name:"margin_long",desc:`Margin long is the percentage of the purchase price of a security that must be covered by cash or collateral for long positions. Must be a non-negative number. The logic used to simulate margin calls is explained in the [Help Center](https://www.tradingview.com/chart/?solution=43000628599). This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is 0, in which case the strategy does not enforce any limits on position size.`,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"margin_short",desc:`Margin short is the percentage of the purchase price of a security that must be covered by cash or collateral for short positions. Must be a non-negative number. The logic used to simulate margin calls is explained in the [Help Center](https://www.tradingview.com/chart/?solution=43000628599). This setting can also be changed in the strategy's "Settings/Properties" tab. Optional. The default is 0, in which case the strategy does not enforce any limits on position size.`,allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"explicit_plot_zorder",desc:"Specifies the order in which the script's plots, fills, and hlines are rendered. If [true](#var_true), plots are drawn in the order in which they appear in the script's code, each newer plot being drawn above the previous ones. This only applies to `plot*()` functions, [fill](#fun_fill), and [hline](#fun_hline). Optional. The default is [false](#var_false).",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"max_lines_count",desc:"The number of last [line](#op_line) drawings displayed. Possible values: 1-500. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"max_labels_count",desc:"The number of last [label](#op_label) drawings displayed. Possible values: 1-500. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"max_boxes_count",desc:"The number of last [box](#op_box) drawings displayed. Possible values: 1-500. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"},{name:"risk_free_rate",desc:"The risk-free rate of return is the annual percentage change in the value of an investment with minimal or zero risk. It is used to calculate the [Sharpe](https://www.tradingview.com/support/solutions/43000681694) and [Sortino](https://www.tradingview.com/support/solutions/43000681697) ratios. Optional. The default is 2.",allowedTypeIDs:["const int","const float"],displayType:"const int/float"},{name:"use_bar_magnifier",desc:"When true, the [Broker Emulator](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Strategies.html#broker-emulator) uses lower timeframe data during history backtesting to achieve more realistic results. Optional. The default is [false](#var_false). Only [Premium](https://www.tradingview.com/pricing/) accounts have access to this feature.",allowedTypeIDs:["const bool"],displayType:"const bool"},{name:"max_polylines_count",desc:"The number of last [polyline](#op_polyline) drawings displayed. Possible values: 1-100. The count is approximate; more drawings than the specified count may be displayed. Optional. The default is 50.",allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100)',"","// Enter long by market if current open is greater than previous high.","if open > high[1]",' strategy.entry("Long", strategy.long, 1)','// Generate a full exit bracket (profit 10 points, loss 5 points per contract) from the entry named "Long".','strategy.exit("Exit", "Long", profit = 10, loss = 5)'],remarks:["You can learn more about strategies in our [User Manual](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Strategies.html).","Every strategy script must have one [strategy](#fun_strategy) call.","Strategies using `calc_on_every_tick = true` parameter may calculate differently on historical and realtime bars, which causes [repainting](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html).","Strategies always use the chart's prices to enter and exit positions. Using them on non-standard chart types (Heikin Ashi, Renko, etc.) will produce misleading results, as their prices are synthetic. Backtesting on non-standard charts is thus not recommended."],seeAlso:["[indicator](#fun_indicator)","[library](#fun_library)"],syntax:["strategy(title, shorttitle, overlay, format, precision, scale, pyramiding, calc_on_order_fills, calc_on_every_tick, max_bars_back, backtest_fill_limits_assumption, default_qty_type, default_qty_value, initial_capital, currency, slippage, commission_type, commission_value, process_orders_on_close, close_entries_rule, margin_long, margin_short, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count, risk_free_rate, use_bar_magnifier, max_polylines_count) → void"],returnedTypes:["void"]},{name:"strategy.entry",desc:["It is a command to enter market position. If an order with the same ID is already pending, it is possible to modify the order. If there is no order with the specified ID, a new order is placed. To deactivate an entry order, the command [strategy.cancel](#fun_strategy.cancel) or [strategy.cancel_all](#fun_strategy.cancel_all) should be used. In comparison to the function [strategy.order](#fun_strategy.order), the function [strategy.entry](#fun_strategy.entry) is affected by pyramiding and it can reverse market position correctly. If both 'limit' and 'stop' parameters are 'NaN', the order type is market order."],args:[{name:"id",desc:"A required parameter. The order identifier. It is possible to cancel or modify an order by referencing its identifier.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"direction",desc:"A required parameter. Market position direction: 'strategy.long' is for long, 'strategy.short' is for short.",required:!0,allowedTypeIDs:["series strategy_direction","simple strategy_direction","input strategy_direction","const strategy_direction"],displayType:"series strategy_direction"},{name:"qty",desc:"An optional parameter. Number of contracts/shares/lots/units to trade. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"limit",desc:"An optional parameter. Limit price of the order. If it is specified, the order type is either 'limit', or 'stop-limit'. 'NaN' should be specified for any other order type.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"stop",desc:"An optional parameter. Stop price of the order. If it is specified, the order type is either 'stop', or 'stop-limit'. 'NaN' should be specified for any other order type.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"oca_name",desc:"An optional parameter. Name of the OCA group the order belongs to. If the order should not belong to any particular OCA group, there should be an empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"oca_type",desc:"An optional parameter. Type of the OCA group. The allowed values are: [strategy.oca.none](#var_strategy.oca.none) - the order should not belong to any particular OCA group; [strategy.oca.cancel](#var_strategy.oca.cancel) - the order should belong to an OCA group, where as soon as an order is filled, all other orders of the same group are cancelled; [strategy.oca.reduce](#var_strategy.oca.reduce) - the order should belong to an OCA group, where if X number of contracts of an order is filled, number of contracts for each other order of the same OCA group is decreased by X.",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"comment",desc:"An optional parameter. Additional notes on the order.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"disable_alert",desc:"If [true](#var_true) when the function creates an order, the strategy alert will not fire upon the execution of that order. The parameter accepts a 'series bool' argument, allowing users to control which orders will trigger alerts when they fill. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'strategy(title = "simple strategy entry example")',"if open > high[1]",' strategy.entry("enter long", strategy.long, 1) // enter long by market if current open great then previous high',"if open < low[1]",' strategy.entry("enter short", strategy.short, 1) // enter short by market if current open less then previous low'],syntax:["strategy.entry(id, direction, qty, limit, stop, oca_name, oca_type, comment, alert_message, disable_alert) → void"],returnedTypes:["void"]},{name:"strategy.order",desc:["It is a command to place order. If an order with the same ID is already pending, it is possible to modify the order. If there is no order with the specified ID, a new order is placed. To deactivate order, the command [strategy.cancel](#fun_strategy.cancel) or [strategy.cancel_all](#fun_strategy.cancel_all) should be used. In comparison to the function [strategy.entry](#fun_strategy.entry), the function [strategy.order](#fun_strategy.order) is not affected by pyramiding. If both 'limit' and 'stop' parameters are 'NaN', the order type is market order."],args:[{name:"id",desc:"A required parameter. The order identifier. It is possible to cancel or modify an order by referencing its identifier.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"direction",desc:"A required parameter. Order direction: 'strategy.long' is for buy, 'strategy.short' is for sell.",required:!0,allowedTypeIDs:["series strategy_direction","simple strategy_direction","input strategy_direction","const strategy_direction"],displayType:"series strategy_direction"},{name:"qty",desc:"An optional parameter. Number of contracts/shares/lots/units to trade. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"limit",desc:"An optional parameter. Limit price of the order. If it is specified, the order type is either 'limit', or 'stop-limit'. 'NaN' should be specified for any other order type.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"stop",desc:"An optional parameter. Stop price of the order. If it is specified, the order type is either 'stop', or 'stop-limit'. 'NaN' should be specified for any other order type.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"oca_name",desc:"An optional parameter. Name of the OCA group the order belongs to. If the order should not belong to any particular OCA group, there should be an empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"oca_type",desc:"An optional parameter. Type of the OCA group. The allowed values are: [strategy.oca.none](#var_strategy.oca.none) - the order should not belong to any particular OCA group; [strategy.oca.cancel](#var_strategy.oca.cancel) - the order should belong to an OCA group, where as soon as an order is filled, all other orders of the same group are cancelled; [strategy.oca.reduce](#var_strategy.oca.reduce) - the order should belong to an OCA group, where if X number of contracts of an order is filled, number of contracts for each other order of the same OCA group is decreased by X.",allowedTypeIDs:["input string","const string"],displayType:"input string"},{name:"comment",desc:"An optional parameter. Additional notes on the order.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"disable_alert",desc:"If [true](#var_true) when the function creates an order, the strategy alert will not fire upon the execution of that order. The parameter accepts a 'series bool' argument, allowing users to control which orders will trigger alerts when they fill. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'strategy(title = "simple strategy order example")',"if open > high[1]",' strategy.order("buy", strategy.long, 1) // buy by market if current open great then previous high',"if open < low[1]",' strategy.order("sell", strategy.short, 1) // sell by market if current open less then previous low'],syntax:["strategy.order(id, direction, qty, limit, stop, oca_name, oca_type, comment, alert_message, disable_alert) → void"],returnedTypes:["void"]},{name:"strategy.exit",desc:["It is a command to exit either a specific entry, or whole market position. If an order with the same ID is already pending, it is possible to modify the order. If an entry order was not filled, but an exit order is generated, the exit order will wait till entry order is filled and then the exit order is placed. To deactivate an exit order, the command [strategy.cancel](#fun_strategy.cancel) or [strategy.cancel_all](#fun_strategy.cancel_all) should be used. If the function [strategy.exit](#fun_strategy.exit) is called once, it exits a position only once. If you want to exit multiple times, the command [strategy.exit](#fun_strategy.exit) should be called multiple times. If you use a stop loss and a trailing stop, their order type is 'stop', so only one of them is placed (the one that is supposed to be filled first). If all the following parameters 'profit', 'limit', 'loss', 'stop', 'trail_points', 'trail_offset' are 'NaN', the command will fail. To use market order to exit, the command [strategy.close](#fun_strategy.close) or [strategy.close_all](#fun_strategy.close_all) should be used."],args:[{name:"id",desc:"A required parameter. The order identifier. It is possible to cancel or modify an order by referencing its identifier.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"from_entry",desc:"An optional parameter. The identifier of a specific entry order to exit from it. To exit all entries an empty string should be used. The default values is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"qty",desc:"An optional parameter. Number of contracts/shares/lots/units to exit a trade with. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"qty_percent",desc:"Defines the percentage of (0-100) the position to close. Its priority is lower than that of the 'qty' parameter. Optional. The default is 100.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"profit",desc:"An optional parameter. Profit target (specified in ticks). If it is specified, a limit order is placed to exit market position when the specified amount of profit (in ticks) is reached. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"limit",desc:"An optional parameter. Profit target (requires a specific price). If it is specified, a limit order is placed to exit market position at the specified price (or better). Priority of the parameter 'limit' is higher than priority of the parameter 'profit' ('limit' is used instead of 'profit', if its value is not 'NaN'). The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"loss",desc:"An optional parameter. Stop loss (specified in ticks). If it is specified, a stop order is placed to exit market position when the specified amount of loss (in ticks) is reached. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"stop",desc:"An optional parameter. Stop loss (requires a specific price). If it is specified, a stop order is placed to exit market position at the specified price (or worse). Priority of the parameter 'stop' is higher than priority of the parameter 'loss' ('stop' is used instead of 'loss', if its value is not 'NaN'). The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"trail_price",desc:"An optional parameter. Trailing stop activation level (requires a specific price). If it is specified, a trailing stop order will be placed when the specified price level is reached. The offset (in ticks) to determine initial price of the trailing stop order is specified in the 'trail_offset' parameter: X ticks lower than activation level to exit long position; X ticks higher than activation level to exit short position. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"trail_points",desc:"An optional parameter. Trailing stop activation level (profit specified in ticks). If it is specified, a trailing stop order will be placed when the calculated price level (specified amount of profit) is reached. The offset (in ticks) to determine initial price of the trailing stop order is specified in the 'trail_offset' parameter: X ticks lower than activation level to exit long position; X ticks higher than activation level to exit short position. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"trail_offset",desc:"An optional parameter. Trailing stop price (specified in ticks). The offset in ticks to determine initial price of the trailing stop order: X ticks lower than 'trail_price' or 'trail_points' to exit long position; X ticks higher than 'trail_price' or 'trail_points' to exit short position. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"oca_name",desc:"An optional parameter. Name of the OCA group (oca_type = [strategy.oca.reduce](#var_strategy.oca.reduce)) the profit target, the stop loss / the trailing stop orders belong to. If the name is not specified, it will be generated automatically.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"comment",desc:"Additional notes on the order. If specified, displays near the order marker on the chart. Optional. The default is [na](#var_na).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"comment_profit",desc:"Additional notes on the order if the exit was triggered by crossing `profit` or `limit` specifically. If specified, supercedes the `comment` parameter and displays near the order marker on the chart. Optional. The default is [na](#var_na).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"comment_loss",desc:"Additional notes on the order if the exit was triggered by crossing `stop` or `loss` specifically. If specified, supercedes the `comment` parameter and displays near the order marker on the chart. Optional. The default is [na](#var_na).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"comment_trailing",desc:"Additional notes on the order if the exit was triggered by crossing `trail_offset` specifically. If specified, supercedes the `comment` parameter and displays near the order marker on the chart. Optional. The default is [na](#var_na).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_message",desc:`Text that will replace the '{{strategy.order.alert_message}}' placeholder when one is used in the "Message" field of the "Create Alert" dialog. Optional. The default is [na](#var_na).`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_profit",desc:'Text that will replace the \'{{strategy.order.alert_message}}\' placeholder when one is used in the "Message" field of the "Create Alert" dialog. Only replaces the text if the exit was triggered by crossing `profit` or `limit` specifically. Optional. The default is [na](#var_na).',allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_loss",desc:'Text that will replace the \'{{strategy.order.alert_message}}\' placeholder when one is used in the "Message" field of the "Create Alert" dialog. Only replaces the text if the exit was triggered by crossing `stop` or `loss` specifically. Optional. The default is [na](#var_na).',allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_trailing",desc:'Text that will replace the \'{{strategy.order.alert_message}}\' placeholder when one is used in the "Message" field of the "Create Alert" dialog. Only replaces the text if the exit was triggered by crossing `trail_offset` specifically. Optional. The default is [na](#var_na).',allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"disable_alert",desc:"If [true](#var_true) when the function creates an order, the strategy alert will not fire upon the execution of that order. The parameter accepts a 'series bool' argument, allowing users to control which orders will trigger alerts when they fill. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'strategy(title = "simple strategy exit example")',"if open > high[1]",' strategy.entry("long", strategy.long, 1) // enter long by market if current open great then previous high','strategy.exit("exit", "long", profit = 10, loss = 5) // generate full exit bracket (profit 10 points, loss 5 points per contract) from entry with name "long"'],syntax:["strategy.exit(id, from_entry, qty, qty_percent, profit, limit, loss, stop, trail_price, trail_points, trail_offset, oca_name, comment, comment_profit, comment_loss, comment_trailing, alert_message, alert_profit, alert_loss, alert_trailing, disable_alert) → void"],returnedTypes:["void"]},{name:"strategy.cancel",desc:["It is a command to cancel/deactivate pending orders by referencing their names, which were generated by the functions: [strategy.order](#fun_strategy.order), [strategy.entry](#fun_strategy.entry) and [strategy.exit](#fun_strategy.exit)."],args:[{name:"id",desc:"A required parameter. The order identifier. It is possible to cancel an order by referencing its identifier.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'strategy(title = "simple order cancellation example")',"conditionForBuy = open > high[1]","if conditionForBuy",' strategy.entry("long", strategy.long, 1, limit = low) // enter long using limit order at low price of current bar if conditionForBuy is true',"if not conditionForBuy",' strategy.cancel("long") // cancel the entry order with name "long" if conditionForBuy is false'],syntax:["strategy.cancel(id) → void"],returnedTypes:["void"]},{name:"strategy.cancel_all",desc:["A command to cancel/deactivate all pending orders generated by any of the following functions: [strategy.order](#fun_strategy.order), [strategy.entry](#fun_strategy.entry), [strategy.exit](#fun_strategy.exit), and [strategy.close](#fun_strategy.close)."],examples:["//@version=5",'strategy(title = "simple all orders cancellation example")',"conditionForBuy1 = open > high[1]","if conditionForBuy1",' strategy.entry("long entry 1", strategy.long, 1, limit = low) // enter long by limit if conditionForBuy1 is true',"conditionForBuy2 = conditionForBuy1 and open[1] > high[2]","if conditionForBuy2",' strategy.entry("long entry 2", strategy.long, 1, limit = ta.lowest(low, 2)) // enter long by limit if conditionForBuy2 is true',"conditionForStopTrading = open < ta.lowest(low, 2)","if conditionForStopTrading"," strategy.cancel_all() // cancel both limit orders if the conditon conditionForStopTrading is true"],syntax:["strategy.cancel_all() → void"],returnedTypes:["void"]},{name:"ta.pivothigh",desc:["This function returns price of the pivot high point. It returns 'NaN', if there was no pivot high point."],args:[{name:"leftbars",desc:"Left strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"rightbars",desc:"Right strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("PivotHigh", overlay=true)',"leftBars = input(2)","rightBars=input(2)","ph = ta.pivothigh(leftBars, rightBars)","plot(ph, style=plot.style_cross, linewidth=3, color= color.red, offset=-rightBars)"],returns:["Price of the point or 'NaN'."],remarks:["If parameters 'leftbars' or 'rightbars' are series you should use [max_bars_back](#fun_max_bars_back) function for the 'source' variable."],syntax:["ta.pivothigh(leftbars, rightbars) → series float"],returnedTypes:["series float"]},{name:"ta.pivothigh",desc:["This function returns price of the pivot high point. It returns 'NaN', if there was no pivot high point."],args:[{name:"source",desc:"An optional parameter. Data series to calculate the value. 'High' by default.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"leftbars",desc:"Left strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"rightbars",desc:"Right strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("PivotHigh", overlay=true)',"leftBars = input(2)","rightBars=input(2)","ph = ta.pivothigh(leftBars, rightBars)","plot(ph, style=plot.style_cross, linewidth=3, color= color.red, offset=-rightBars)"],returns:["Price of the point or 'NaN'."],remarks:["If parameters 'leftbars' or 'rightbars' are series you should use [max_bars_back](#fun_max_bars_back) function for the 'source' variable."],syntax:["ta.pivothigh(source, leftbars, rightbars) → series float"],returnedTypes:["series float"]},{name:"ta.pivotlow",desc:["This function returns price of the pivot low point. It returns 'NaN', if there was no pivot low point."],args:[{name:"leftbars",desc:"Left strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"rightbars",desc:"Right strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("PivotLow", overlay=true)',"leftBars = input(2)","rightBars=input(2)","pl = ta.pivotlow(close, leftBars, rightBars)","plot(pl, style=plot.style_cross, linewidth=3, color= color.blue, offset=-rightBars)"],returns:["Price of the point or 'NaN'."],remarks:["If parameters 'leftbars' or 'rightbars' are series you should use [max_bars_back](#fun_max_bars_back) function for the 'source' variable."],syntax:["ta.pivotlow(leftbars, rightbars) → series float"],returnedTypes:["series float"]},{name:"ta.pivotlow",desc:["This function returns price of the pivot low point. It returns 'NaN', if there was no pivot low point."],args:[{name:"source",desc:"An optional parameter. Data series to calculate the value. 'Low' by default.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"leftbars",desc:"Left strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"rightbars",desc:"Right strength.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("PivotLow", overlay=true)',"leftBars = input(2)","rightBars=input(2)","pl = ta.pivotlow(close, leftBars, rightBars)","plot(pl, style=plot.style_cross, linewidth=3, color= color.blue, offset=-rightBars)"],returns:["Price of the point or 'NaN'."],remarks:["If parameters 'leftbars' or 'rightbars' are series you should use [max_bars_back](#fun_max_bars_back) function for the 'source' variable."],syntax:["ta.pivotlow(source, leftbars, rightbars) → series float"],returnedTypes:["series float"]},{name:"strategy.close_all",desc:["Exits the current market position, making it flat."],args:[{name:"comment",desc:"An optional parameter. Additional notes on the order.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'strategy("closeAll Demo", overlay=false)',"if open > close",' strategy.entry("buy", strategy.long)',"if open < close",' strategy.close_all(comment = "close all entries")',"plot(strategy.position_size)"],syntax:["strategy.close_all(comment, alert_message) → void"],returnedTypes:["void"]},{name:"strategy.close_all",desc:["Exits the current market position, making it flat."],args:[{name:"comment",desc:"An optional parameter. Additional notes on the order.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"immediately",desc:"An optional parameter. If [true](#var_true), 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. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"disable_alert",desc:"If [true](#var_true) when the function creates an order, the strategy alert will not fire upon the execution of that order. The parameter accepts a 'series bool' argument, allowing users to control which orders will trigger alerts when they fill. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'strategy("closeAll Demo", overlay=false)',"if open > close",' strategy.entry("buy", strategy.long)',"if open < close",' strategy.close_all(comment = "close all entries")',"plot(strategy.position_size)"],syntax:["strategy.close_all(comment, alert_message, immediately, disable_alert) → void"],returnedTypes:["void"]},{name:"strategy.close",desc:["It is a command to exit from the entry with the specified ID. If there were multiple entry orders with the same ID, all of them are exited at once. If there are no open entries with the specified ID by the moment the command is triggered, the command will not come into effect. The command uses market order. Every entry is closed by a separate market order."],args:[{name:"id",desc:"A required parameter. The order identifier. It is possible to close an order by referencing its identifier.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"comment",desc:"An optional parameter. Additional notes on the order.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"qty",desc:"An optional parameter. Number of contracts/shares/lots/units to exit a trade with. The default value is 'NaN'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"qty_percent",desc:"Defines the percentage (0-100) of the position to close. Its priority is lower than that of the 'qty' parameter. Optional. The default is 100.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"immediately",desc:"An optional parameter. If [true](#var_true), 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. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"disable_alert",desc:"If [true](#var_true) when the function creates an order, the strategy alert will not fire upon the execution of that order. The parameter accepts a 'series bool' argument, allowing users to control which orders will trigger alerts when they fill. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'strategy("closeEntry Demo", overlay=false)',"if open > close",' strategy.entry("buy", strategy.long)',"if open < close",' strategy.close("buy", qty_percent = 50, comment = "close buy entry for 50%")',"plot(strategy.position_size)"],syntax:["strategy.close(id, comment, qty, qty_percent, alert_message, immediately, disable_alert) → void"],returnedTypes:["void"]},{name:"strategy.risk.max_position_size",desc:["The purpose of this rule is to determine maximum size of a market position. The rule affects the following function: [strategy.entry](#fun_strategy.entry). The 'entry' quantity can be reduced (if needed) to such number of contracts/shares/lots/units, so the total position size doesn't exceed the value specified in 'strategy.risk.max_position_size'. If minimum possible quantity still violates the rule, the order will not be placed."],args:[{name:"contracts",desc:"A required parameter. Maximum number of contracts/shares/lots/units in a position.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"}],examples:["//@version=5",'strategy("risk.max_position_size Demo", default_qty_value = 100)',"strategy.risk.max_position_size(10)","if open > close",' strategy.entry("buy", strategy.long)',"plot(strategy.position_size) // max plot value will be 10"],syntax:["strategy.risk.max_position_size(contracts) → void"],returnedTypes:["void"]},{name:"strategy.risk.max_intraday_loss",desc:["The maximum loss value allowed during a day. It is specified either in money (base currency), or in percentage of maximum intraday equity (0 -100)."],args:[{name:"value",desc:"A required parameter. The maximum loss value. It is specified either in money (base currency), or in percentage of maximum intraday equity. For % of equity the range of allowed values is from 0 to 100.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"type",desc:"A required parameter. The type of the value. Please specify one of the following values: [strategy.percent_of_equity](#var_strategy.percent_of_equity) or [strategy.cash](#var_strategy.cash). Note: if equity drops down to zero or to a negative and the [strategy.percent_of_equity](#var_strategy.percent_of_equity) is specified, all pending orders are cancelled, all open positions are closed and no new orders can be placed for good.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],detailedDesc:[{desc:[],examples:["// Sets the maximum intraday loss using the strategy's equity value.","//@version=5",'strategy("strategy.risk.max_intraday_loss Example 1", overlay = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)',"","// Input for maximum intraday loss %. ","lossPct = input.float(10)","","// Set maximum intraday loss to our lossPct input","strategy.risk.max_intraday_loss(lossPct, strategy.percent_of_equity)","","// Enter Short at bar_index zero.","if bar_index == 0",' strategy.entry("Short", strategy.short)',"","// Store equity value from the beginning of the day","eqFromDayStart = ta.valuewhen(ta.change(dayofweek) > 0, strategy.equity, 0)","","// Calculate change of the current equity from the beginning of the current day.","eqChgPct = 100 * ((strategy.equity - eqFromDayStart) / strategy.equity)","","// Plot it","plot(eqChgPct) ","hline(-lossPct)"]},{desc:[],examples:["// Sets the maximum intraday loss using the strategy's cash value.","//@version=5",'strategy("strategy.risk.max_intraday_loss Example 2", overlay = false)',"","// Input for maximum intraday loss in absolute cash value of the symbol. ","absCashLoss = input.float(5)","","// Set maximum intraday loss to `absCashLoss` in account currency.","strategy.risk.max_intraday_loss(absCashLoss, strategy.cash)","","// Enter Short at bar_index zero.","if bar_index == 0",' strategy.entry("Short", strategy.short)',"","// Store the open price value from the beginning of the day.","beginPrice = ta.valuewhen(ta.change(dayofweek) > 0, open, 0)","","// Calculate the absolute price change for the current period.","priceChg = (close - beginPrice)","","hline(absCashLoss)","plot(priceChg)"]}],seeAlso:["[strategy](#fun_strategy)","[strategy.percent_of_equity](#var_strategy.percent_of_equity)","[strategy.cash](#var_strategy.cash)"],syntax:["strategy.risk.max_intraday_loss(value, type, alert_message) → void"],returnedTypes:["void"]},{name:"strategy.risk.max_intraday_filled_orders",desc:["The purpose of this rule is to determine maximum number of filled orders per 1 day (per 1 bar, if chart resolution is higher than 1 day). The rule affects the whole strategy. Once the maximum number of filled orders is reached, all pending orders are cancelled, all open positions are closed and no new orders can be placed till the end of the current trading session."],args:[{name:"count",desc:"A required parameter. The maximum number of filled orders per 1 day.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'strategy("risk.max_intraday_filled_orders Demo")',"strategy.risk.max_intraday_filled_orders(10) // After 10 orders are filled, no more strategy orders will be placed (except for a market order to exit current open market position, if there is any).","if open > close",' strategy.entry("buy", strategy.long)',"if open < close",' strategy.entry("sell", strategy.short)'],syntax:["strategy.risk.max_intraday_filled_orders(count, alert_message) → void"],returnedTypes:["void"]},{name:"strategy.risk.allow_entry_in",desc:["This function can be used to specify in which market direction the [strategy.entry](#fun_strategy.entry) function is allowed to open positions."],args:[{name:"value",desc:"The allowed direction. Possible values: [strategy.direction.all](#var_strategy.direction.all), [strategy.direction.long](#var_strategy.direction.long), [strategy.direction.short](#var_strategy.direction.short)",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'strategy("strategy.risk.allow_entry_in")',"","strategy.risk.allow_entry_in(strategy.direction.long)","if open > close",' strategy.entry("Long", strategy.long)',"// Instead of opening a short position with 10 contracts, this command will close long entries.","if open < close",' strategy.entry("Short", strategy.short, qty = 10)'],syntax:["strategy.risk.allow_entry_in(value) → void"],returnedTypes:["void"]},{name:"strategy.risk.max_cons_loss_days",desc:["The purpose of this rule is to cancel all pending orders, close all open positions and stop placing orders after a specified number of consecutive days with losses. The rule affects the whole strategy."],args:[{name:"count",desc:"A required parameter. The allowed number of consecutive days with losses.",required:!0,allowedTypeIDs:["simple int","input int","const int"],displayType:"simple int"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'strategy("risk.max_cons_loss_days Demo 1")',"strategy.risk.max_cons_loss_days(3) // No orders will be placed after 3 days, if each day is with loss.","plot(strategy.position_size)"],syntax:["strategy.risk.max_cons_loss_days(count, alert_message) → void"],returnedTypes:["void"]},{name:"strategy.risk.max_drawdown",desc:["The purpose of this rule is to determine maximum drawdown. The rule affects the whole strategy. Once the maximum drawdown value is reached, all pending orders are cancelled, all open positions are closed and no new orders can be placed."],args:[{name:"value",desc:"A required parameter. The maximum drawdown value. It is specified either in money (base currency), or in percentage of maximum equity. For % of equity the range of allowed values is from 0 to 100.",required:!0,allowedTypeIDs:["simple int","input int","const int","simple float","input float","const float"],displayType:"simple int/float"},{name:"type",desc:"A required parameter. The type of the value. Please specify one of the following values: [strategy.percent_of_equity](#var_strategy.percent_of_equity) or [strategy.cash](#var_strategy.cash). Note: if equity drops down to zero or to a negative and the 'strategy.percent_of_equity' is specified, all pending orders are cancelled, all open positions are closed and no new orders can be placed for good.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"alert_message",desc:`An optional parameter which replaces the {{strategy.order.alert_message}} placeholder when it is used in the "Create Alert" dialog box's "Message" field.`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("risk.max_drawdown Demo 1")',"strategy.risk.max_drawdown(50, strategy.percent_of_equity) // set maximum drawdown to 50% of maximum equity","plot(strategy.position_size)"]},{desc:[],examples:["//@version=5",'strategy("risk.max_drawdown Demo 2", currency = "EUR")',"strategy.risk.max_drawdown(2000, strategy.cash) // set maximum drawdown to 2000 EUR from maximum equity","plot(strategy.position_size)"]}],syntax:["strategy.risk.max_drawdown(value, type, alert_message) → void"],returnedTypes:["void"]},{name:"box.copy",desc:["Clones the box object."],args:[{name:"id",desc:"Box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],examples:["//@version=5","indicator('Last 50 bars price ranges', overlay = true)","LOOKBACK = 50","highest = ta.highest(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","if barstate.islastconfirmedhistory"," var BoxLast = box.new(bar_index[LOOKBACK], highest, bar_index, lowest, bgcolor = color.new(color.green, 80))"," var BoxPrev = box.copy(BoxLast)"," box.set_lefttop(BoxPrev, bar_index[LOOKBACK * 2], highest[50])"," box.set_rightbottom(BoxPrev, bar_index[LOOKBACK], lowest[50])"," box.set_bgcolor(BoxPrev, color.new(color.red, 80))"],seeAlso:["[box.new](#fun_box.new)","[box.delete](#fun_box.delete)"],syntax:["box.copy(id) → series box"],returnedTypes:["series box"]},{name:"box.new",desc:["Creates a new box object."],args:[{name:"top_left",desc:"A [chart.point](#op_chart.point) object that specifies the top-left corner location of the box.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"},{name:"bottom_right",desc:"A [chart.point](#op_chart.point) object that specifies the bottom-right corner location of the box.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"},{name:"border_color",desc:"Color of the four borders. Optional. The default is [color.blue](#var_color.blue).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"border_width",desc:"Width of the four borders, in pixels. Optional. The default is 1 pixel.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"border_style",desc:"Style of the four borders. Possible values: [line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed). Optional. The default value is [line.style_solid](#var_line.style_solid).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"extend",desc:"When [extend.none](#var_extend.none) is used, the horizontal borders start at the left border and end at the right border. With [extend.left](#var_extend.left) or [extend.right](#var_extend.right), the horizontal borders are extended indefinitely to the left or right of the box, respectively. With [extend.both](#var_extend.both), the horizontal borders are extended on both sides. Optional. The default value is [extend.none](#var_extend.none).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"xloc",desc:"Determines whether the arguments to 'left' and 'right' are a bar index or a time value. If xloc = [xloc.bar_index](#var_xloc.bar_index), the arguments must be a bar index. If xloc = [xloc.bar_time](#var_xloc.bar_time), the arguments must be a UNIX time. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Optional. The default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"bgcolor",desc:"Background color of the box. Optional. The default is [color.blue](#var_color.blue).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text",desc:"The text to be displayed inside the box. Optional. The default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_size",desc:"The size of the text. An optional parameter, the default value is [size.auto](#var_size.auto). Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_color",desc:"The color of the text. Optional. The default is [color.black](#var_color.black).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text_halign",desc:"The horizontal alignment of the box's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_valign",desc:"The vertical alignment of the box's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_wrap",desc:"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 (and clipped by the bottom border of the box if the height of the resulting wrapped text is higher than the height of the box). Optional. The default value is [text.wrap_none](#var_text.wrap_none). Possible values: [text.wrap_none](#var_text.wrap_none), [text.wrap_auto](#var_text.wrap_auto).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("box.new")',"var b = box.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, border_style=line.style_dashed)","box.set_lefttop(b, time, 100)","box.set_rightbottom(b, time + 60 * 60 * 24, 500)","box.set_bgcolor(b, color.green)"],returns:["The ID of a box object which may be used in box.set_*() and box.get_*() functions."],seeAlso:["[box.delete](#fun_box.delete)","[box.get_left](#fun_box.get_left)","[box.get_top](#fun_box.get_top)","[box.get_right](#fun_box.get_right)","[box.get_bottom](#fun_box.get_bottom)","[box.set_top_left_point](#fun_box.set_top_left_point)","[box.set_left](#fun_box.set_left)","[box.set_top](#fun_box.set_top)","[box.set_bottom_right_point](#fun_box.set_bottom_right_point)","[box.set_right](#fun_box.set_right)","[box.set_bottom](#fun_box.set_bottom)","[box.set_border_color](#fun_box.set_border_color)","[box.set_bgcolor](#fun_box.set_bgcolor)","[box.set_border_width](#fun_box.set_border_width)","[box.set_border_style](#fun_box.set_border_style)","[box.set_extend](#fun_box.set_extend)"],syntax:["box.new(top_left, bottom_right, border_color, border_width, border_style, extend, xloc, bgcolor, text, text_size, text_color, text_halign, text_valign, text_wrap, text_font_family) → series box"],returnedTypes:["series box"]},{name:"box.new",desc:["Creates a new box object."],args:[{name:"left",desc:"Bar index (if xloc = [xloc.bar_index](#var_xloc.bar_index)) or UNIX time (if xloc = [xloc.bar_time](#var_xloc.bar_time)) of the left border of the box. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"top",desc:"Price of the top border of the box.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"right",desc:"Bar index (if xloc = [xloc.bar_index](#var_xloc.bar_index)) or UNIX time (if xloc = [xloc.bar_time](#var_xloc.bar_time)) of the right border of the box. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bottom",desc:"Price of the bottom border of the box.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"border_color",desc:"Color of the four borders. Optional. The default is [color.blue](#var_color.blue).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"border_width",desc:"Width of the four borders, in pixels. Optional. The default is 1 pixel.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"border_style",desc:"Style of the four borders. Possible values: [line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed). Optional. The default value is [line.style_solid](#var_line.style_solid).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"extend",desc:"When [extend.none](#var_extend.none) is used, the horizontal borders start at the left border and end at the right border. With [extend.left](#var_extend.left) or [extend.right](#var_extend.right), the horizontal borders are extended indefinitely to the left or right of the box, respectively. With [extend.both](#var_extend.both), the horizontal borders are extended on both sides. Optional. The default value is [extend.none](#var_extend.none).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"xloc",desc:"Determines whether the arguments to 'left' and 'right' are a bar index or a time value. If xloc = [xloc.bar_index](#var_xloc.bar_index), the arguments must be a bar index. If xloc = [xloc.bar_time](#var_xloc.bar_time), the arguments must be a UNIX time. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Optional. The default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"bgcolor",desc:"Background color of the box. Optional. The default is [color.blue](#var_color.blue).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text",desc:"The text to be displayed inside the box. Optional. The default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_size",desc:"The size of the text. An optional parameter, the default value is [size.auto](#var_size.auto). Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_color",desc:"The color of the text. Optional. The default is [color.black](#var_color.black).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text_halign",desc:"The horizontal alignment of the box's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_valign",desc:"The vertical alignment of the box's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_wrap",desc:"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 (and clipped by the bottom border of the box if the height of the resulting wrapped text is higher than the height of the box). Optional. The default value is [text.wrap_none](#var_text.wrap_none). Possible values: [text.wrap_none](#var_text.wrap_none), [text.wrap_auto](#var_text.wrap_auto).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("box.new")',"var b = box.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, border_style=line.style_dashed)","box.set_lefttop(b, time, 100)","box.set_rightbottom(b, time + 60 * 60 * 24, 500)","box.set_bgcolor(b, color.green)"],returns:["The ID of a box object which may be used in box.set_*() and box.get_*() functions."],seeAlso:["[box.delete](#fun_box.delete)","[box.get_left](#fun_box.get_left)","[box.get_top](#fun_box.get_top)","[box.get_right](#fun_box.get_right)","[box.get_bottom](#fun_box.get_bottom)","[box.set_top_left_point](#fun_box.set_top_left_point)","[box.set_left](#fun_box.set_left)","[box.set_top](#fun_box.set_top)","[box.set_bottom_right_point](#fun_box.set_bottom_right_point)","[box.set_right](#fun_box.set_right)","[box.set_bottom](#fun_box.set_bottom)","[box.set_border_color](#fun_box.set_border_color)","[box.set_bgcolor](#fun_box.set_bgcolor)","[box.set_border_width](#fun_box.set_border_width)","[box.set_border_style](#fun_box.set_border_style)","[box.set_extend](#fun_box.set_extend)"],syntax:["box.new(left, top, right, bottom, border_color, border_width, border_style, extend, xloc, bgcolor, text, text_size, text_color, text_halign, text_valign, text_wrap, text_font_family) → series box"],returnedTypes:["series box"]},{name:"box.delete",desc:["Deletes the specified box object. If it has already been deleted, does nothing."],args:[{name:"id",desc:"A box object to delete.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.delete(id) → void"],returnedTypes:["void"]},{name:"box.get_left",desc:["Returns the bar index or the UNIX time (depending on the last value used for 'xloc') of the left border of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],returns:["A bar index or a UNIX timestamp (in milliseconds)."],seeAlso:["[box.new](#fun_box.new)","[box.set_left](#fun_box.set_left)"],syntax:["box.get_left(id) → series int"],returnedTypes:["series int"]},{name:"box.get_right",desc:["Returns the bar index or the UNIX time (depending on the last value used for 'xloc') of the right border of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],returns:["A bar index or a UNIX timestamp (in milliseconds)."],seeAlso:["[box.new](#fun_box.new)","[box.set_right](#fun_box.set_right)"],syntax:["box.get_right(id) → series int"],returnedTypes:["series int"]},{name:"box.get_top",desc:["Returns the price value of the top border of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],returns:["The price value."],seeAlso:["[box.new](#fun_box.new)","[box.set_top](#fun_box.set_top)"],syntax:["box.get_top(id) → series float"],returnedTypes:["series float"]},{name:"box.get_bottom",desc:["Returns the price value of the bottom border of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],returns:["The price value."],seeAlso:["[box.new](#fun_box.new)","[box.set_bottom](#fun_box.set_bottom)"],syntax:["box.get_bottom(id) → series float"],returnedTypes:["series float"]},{name:"box.set_left",desc:["Sets the left coordinate of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"left",desc:"Bar index or bar time of the left border. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)","[box.get_left](#fun_box.get_left)"],syntax:["box.set_left(id, left) → void"],returnedTypes:["void"]},{name:"box.set_lefttop",desc:["Sets the left and top coordinates of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"left",desc:"Bar index or bar time of the left border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"top",desc:"Price value of the top border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_left](#fun_box.get_left)","[box.get_top](#fun_box.get_top)"],syntax:["box.set_lefttop(id, left, top) → void"],returnedTypes:["void"]},{name:"box.set_right",desc:["Sets the right coordinate of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"right",desc:"Bar index or bar time of the right border. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)","[box.get_right](#fun_box.get_right)"],syntax:["box.set_right(id, right) → void"],returnedTypes:["void"]},{name:"box.set_rightbottom",desc:["Sets the right and bottom coordinates of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"right",desc:"Bar index or bar time of the right border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bottom",desc:"Price value of the bottom border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_right](#fun_box.get_right)","[box.get_bottom](#fun_box.get_bottom)"],syntax:["box.set_rightbottom(id, right, bottom) → void"],returnedTypes:["void"]},{name:"box.set_top",desc:["Sets the top coordinate of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"top",desc:"Price value of the top border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_top](#fun_box.get_top)"],syntax:["box.set_top(id, top) → void"],returnedTypes:["void"]},{name:"box.set_bottom",desc:["Sets the bottom coordinate of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"bottom",desc:"Price value of the bottom border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_bottom](#fun_box.get_bottom)"],syntax:["box.set_bottom(id, bottom) → void"],returnedTypes:["void"]},{name:"box.set_border_color",desc:["Sets the border color of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"color",desc:"New border color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_border_color(id, color) → void"],returnedTypes:["void"]},{name:"box.set_bgcolor",desc:["Sets the background color of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"color",desc:"New background color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_bgcolor(id, color) → void"],returnedTypes:["void"]},{name:"box.set_border_width",desc:["Sets the border width of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"width",desc:"Width of the four borders, in pixels.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_border_width(id, width) → void"],returnedTypes:["void"]},{name:"box.set_border_style",desc:["Sets the border style of the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"style",desc:"New border style.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.new](#fun_box.new)","[line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed)"],syntax:["box.set_border_style(id, style) → void"],returnedTypes:["void"]},{name:"box.set_extend",desc:["Sets extending type of the border of this box object. When [extend.none](#var_extend.none) is used, the horizontal borders start at the left border and end at the right border. With [extend.left](#var_extend.left) or [extend.right](#var_extend.right), the horizontal borders are extended indefinitely to the left or right of the box, respectively. With [extend.both](#var_extend.both), the horizontal borders are extended on both sides."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"extend",desc:"New extending type.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.new](#fun_box.new)","[extend.none](#var_extend.none), [extend.right](#var_extend.right), [extend.left](#var_extend.left), [extend.both](#var_extend.both)"],syntax:["box.set_extend(id, extend) → void"],returnedTypes:["void"]},{name:"box.set_text_font_family",desc:["The function sets the font family of the text inside the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the box font")',"if barstate.islastconfirmedhistory",' b = box.new(bar_index, open-ta.tr, bar_index-50, open-ta.tr*5, text="monospace")'," box.set_text_font_family(b, font.family_monospace)"],seeAlso:["[box.new](#fun_box.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["box.set_text_font_family(id, text_font_family) → void"],returnedTypes:["void"]},{name:"box.set_text_halign",desc:["The function sets the horizontal alignment of the box's text."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_halign",desc:"The horizontal alignment of a box's text. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_color](#fun_box.set_text_color)"],syntax:["box.set_text_halign(id, text_halign) → void"],returnedTypes:["void"]},{name:"box.set_text_valign",desc:["The function sets the vertical alignment of a box's text."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_valign",desc:"The vertical alignment of the box's text. Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_color](#fun_box.set_text_color)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_valign(id, text_valign) → void"],returnedTypes:["void"]},{name:"box.set_text_size",desc:["The function sets the size of the box's text."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_size",desc:"The size of the text. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_color](#fun_box.set_text_color)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_size(id, text_size) → void"],returnedTypes:["void"]},{name:"box.set_text",desc:["The function sets the text in the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text",desc:"The text to be displayed inside the box.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text_color](#fun_box.set_text_color)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text(id, text) → void"],returnedTypes:["void"]},{name:"box.set_text_color",desc:["The function sets the color of the text inside the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_color",desc:"The color of the text.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_color(id, text_color) → void"],returnedTypes:["void"]},{name:"line.copy",desc:["Clones the line object."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],examples:["//@version=5","indicator('Last 100 bars price range', overlay = true)","LOOKBACK = 100","highest = ta.highest(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","if barstate.islastconfirmedhistory"," var lineTop = line.new(bar_index[LOOKBACK], highest, bar_index, highest, color = color.green)"," var lineBottom = line.copy(lineTop)"," line.set_y1(lineBottom, lowest)"," line.set_y2(lineBottom, lowest)"," line.set_color(lineBottom, color.red)"],returns:["New line ID object which may be passed to line.setXXX and line.getXXX functions."],seeAlso:["[line.new](#fun_line.new)","[line.delete](#fun_line.delete)"],syntax:["line.copy(id) → series line"],returnedTypes:["series line"]},{name:"box.set_text_wrap",desc:["The function sets the mode of wrapping of the text inside the box."],args:[{name:"id",desc:"A box object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"text_wrap",desc:"The mode of the wrapping. Possible values: [text.wrap_auto](#var_text.wrap_auto), [text.wrap_none](#var_text.wrap_none).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)","[box.set_text_color](#fun_box.set_text_color)"],syntax:["box.set_text_wrap(id, text_wrap) → void"],returnedTypes:["void"]},{name:"line.new",desc:["Creates new line object."],args:[{name:"first_point",desc:"A [chart.point](#op_chart.point) object that specifies the line's starting coordinate.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"},{name:"second_point",desc:"A [chart.point](#op_chart.point) object that specifies the line's ending coordinate.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"},{name:"xloc",desc:"See description of **x1** argument. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"extend",desc:"If extend=[extend.none](#var_extend.none), draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to [extend.right](#var_extend.right) or [extend.left](#var_extend.left), draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=[extend.both](#var_extend.both), draws a straight line that goes through these points. Default value is [extend.none](#var_extend.none).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"color",desc:"Line color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"style",desc:"Line style. Possible values: [line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed), [line.style_arrow_left](#var_line.style_arrow_left), [line.style_arrow_right](#var_line.style_arrow_right), [line.style_arrow_both](#var_line.style_arrow_both).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"width",desc:"Line width in pixels.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("line.new")',"var line1 = line.new(0, low, bar_index, high, extend=extend.right)","var line2 = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, style=line.style_dashed)","line.set_x2(line1, 0)","line.set_xloc(line1, time, time + 60 * 60 * 24, xloc.bar_time)","line.set_color(line2, color.green)","line.set_width(line2, 5)"],returns:["Line ID object which may be passed to line.setXXX and line.getXXX functions."],seeAlso:["[line.delete](#fun_line.delete)","[line.set_x1](#fun_line.set_x1)","[line.set_y1](#fun_line.set_y1)","[line.set_xy1](#fun_line.set_xy1)","[line.set_x2](#fun_line.set_x2)","[line.set_y2](#fun_line.set_y2)","[line.set_xy2](#fun_line.set_xy2)","[line.set_xloc](#fun_line.set_xloc)","[line.set_color](#fun_line.set_color)","[line.set_extend](#fun_line.set_extend)","[line.set_style](#fun_line.set_style)","[line.set_width](#fun_line.set_width)"],syntax:["line.new(first_point, second_point, xloc, extend, color, style, width) → series line"],returnedTypes:["series line"]},{name:"line.new",desc:["Creates new line object."],args:[{name:"x1",desc:"Bar index (if xloc = [xloc.bar_index](#var_xloc.bar_index)) or bar UNIX time (if xloc = [xloc.bar_time](#var_xloc.bar_time)) of the first point of the line. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y1",desc:"Price of the first point of the line.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"x2",desc:"Bar index (if xloc = [xloc.bar_index](#var_xloc.bar_index)) or bar UNIX time (if xloc = [xloc.bar_time](#var_xloc.bar_time)) of the second point of the line. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y2",desc:"Price of the second point of the line.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"xloc",desc:"See description of **x1** argument. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"extend",desc:"If extend=[extend.none](#var_extend.none), draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to [extend.right](#var_extend.right) or [extend.left](#var_extend.left), draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=[extend.both](#var_extend.both), draws a straight line that goes through these points. Default value is [extend.none](#var_extend.none).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"color",desc:"Line color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"style",desc:"Line style. Possible values: [line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed), [line.style_arrow_left](#var_line.style_arrow_left), [line.style_arrow_right](#var_line.style_arrow_right), [line.style_arrow_both](#var_line.style_arrow_both).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"width",desc:"Line width in pixels.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("line.new")',"var line1 = line.new(0, low, bar_index, high, extend=extend.right)","var line2 = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, style=line.style_dashed)","line.set_x2(line1, 0)","line.set_xloc(line1, time, time + 60 * 60 * 24, xloc.bar_time)","line.set_color(line2, color.green)","line.set_width(line2, 5)"],returns:["Line ID object which may be passed to line.setXXX and line.getXXX functions."],seeAlso:["[line.delete](#fun_line.delete)","[line.set_x1](#fun_line.set_x1)","[line.set_y1](#fun_line.set_y1)","[line.set_xy1](#fun_line.set_xy1)","[line.set_x2](#fun_line.set_x2)","[line.set_y2](#fun_line.set_y2)","[line.set_xy2](#fun_line.set_xy2)","[line.set_xloc](#fun_line.set_xloc)","[line.set_color](#fun_line.set_color)","[line.set_extend](#fun_line.set_extend)","[line.set_style](#fun_line.set_style)","[line.set_width](#fun_line.set_width)"],syntax:["line.new(x1, y1, x2, y2, xloc, extend, color, style, width) → series line"],returnedTypes:["series line"]},{name:"line.set_x1",desc:["Sets bar index or bar time (depending on the xloc) of the first point."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_x1(id, x) → void"],returnedTypes:["void"]},{name:"line.set_y1",desc:["Sets price of the first point"],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_y1(id, y) → void"],returnedTypes:["void"]},{name:"line.set_xy1",desc:["Sets bar index/time and price of the first point."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_xy1(id, x, y) → void"],returnedTypes:["void"]},{name:"line.set_x2",desc:["Sets bar index or bar time (depending on the xloc) of the second point."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_x2(id, x) → void"],returnedTypes:["void"]},{name:"line.set_y2",desc:["Sets price of the second point."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_y2(id, y) → void"],returnedTypes:["void"]},{name:"line.set_xy2",desc:["Sets bar index/time and price of the second point"],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x",desc:"Bar index or bar time.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_xy2(id, x, y) → void"],returnedTypes:["void"]},{name:"line.set_xloc",desc:["Sets x-location and new bar index/time values."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x1",desc:"Bar index or bar time of the first point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"x2",desc:"Bar index or bar time of the second point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"xloc",desc:"New x-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[xloc.bar_index](#var_xloc.bar_index)","[xloc.bar_time](#var_xloc.bar_time)","[line.new](#fun_line.new)"],syntax:["line.set_xloc(id, x1, x2, xloc) → void"],returnedTypes:["void"]},{name:"line.set_extend",desc:["Sets extending type of this line object. If extend=[extend.none](#var_extend.none), draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to [extend.right](#var_extend.right) or [extend.left](#var_extend.left), draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=[extend.both](#var_extend.both), draws a straight line that goes through these points."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"extend",desc:"New extending type.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[extend.none](#var_extend.none)","[extend.right](#var_extend.right)","[extend.left](#var_extend.left)","[extend.both](#var_extend.both)","[line.new](#fun_line.new)"],syntax:["line.set_extend(id, extend) → void"],returnedTypes:["void"]},{name:"line.set_color",desc:["Sets the line color"],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"color",desc:"New line color",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_color(id, color) → void"],returnedTypes:["void"]},{name:"line.set_style",desc:["Sets the line style"],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"style",desc:"New line style.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)","[line.new](#fun_line.new)"],syntax:["line.set_style(id, style) → void"],returnedTypes:["void"]},{name:"line.set_width",desc:["Sets the line width."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"width",desc:"New line width in pixels.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_width(id, width) → void"],returnedTypes:["void"]},{name:"line.delete",desc:["Deletes the specified line object. If it has already been deleted, does nothing."],args:[{name:"id",desc:"Line object to delete.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.delete(id) → void"],returnedTypes:["void"]},{name:"line.get_x1",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of the first point of the line."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],examples:["//@version=5",'indicator("line.get_x1")',"my_line = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time)","a = line.get_x1(my_line)","plot(time - line.get_x1(my_line)) //draws zero plot"],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_x1(id) → series int"],returnedTypes:["series int"]},{name:"line.get_y1",desc:["Returns price of the first point of the line."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],returns:["Price value."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_y1(id) → series float"],returnedTypes:["series float"]},{name:"line.get_x2",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of the second point of the line."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_x2(id) → series int"],returnedTypes:["series int"]},{name:"line.get_y2",desc:["Returns price of the second point of the line."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],returns:["Price value."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_y2(id) → series float"],returnedTypes:["series float"]},{name:"line.get_price",desc:["Returns the price level of a line at a given bar index."],args:[{name:"id",desc:"Line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"x",desc:"Bar index for which price is required.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("GetPrice", overlay=true)',"var line l = na","if bar_index == 10"," l := line.new(0, high[5], bar_index, high)","plot(line.get_price(l, bar_index), color=color.green)"],returns:["Price value of line 'id' at bar index 'x'."],remarks:["The line is considered to have been created using 'extend=extend.both'.","This function can only be called for lines created using 'xloc.bar_index'. If you try to call it for a line created with 'xloc.bar_time', it will generate an error."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_price(id, x) → series float"],returnedTypes:["series float"]},{name:"label.copy",desc:["Clones the label object."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],examples:["//@version=5","indicator('Last 100 bars highest/lowest', overlay = true)","LOOKBACK = 100","highest = ta.highest(LOOKBACK)","highestBars = ta.highestbars(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","lowestBars = ta.lowestbars(LOOKBACK)","if barstate.islastconfirmedhistory"," var labelHigh = label.new(bar_index + highestBars, highest, str.tostring(highest), color = color.green)"," var labelLow = label.copy(labelHigh)"," label.set_xy(labelLow, bar_index + lowestBars, lowest)"," label.set_text(labelLow, str.tostring(lowest))"," label.set_color(labelLow, color.red)"," label.set_style(labelLow, label.style_label_up)"],returns:["New label ID object which may be passed to label.setXXX and label.getXXX functions."],seeAlso:["[label.new](#fun_label.new)","[label.delete](#fun_label.delete)"],syntax:["label.copy(id) → series label"],returnedTypes:["series label"]},{name:"linefill.new",desc:["Creates a new linefill object and displays it on the chart, filling the space between `line1` and `line2` with the color specified in `color`."],args:[{name:"line1",desc:"First line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"line2",desc:"Second line object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"color",desc:"The color used to fill the space between the lines.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],returns:["The ID of a linefill object that can be passed to other linefill.*() functions."],remarks:["If any line of the two is deleted, the linefill object is also deleted. If the lines are moved (e.g. via [line.set_xy](#fun_line.set_xy) functions), the linefill object is also moved.","If both lines are extended in the same direction relative to the lines themselves (e.g. both have [extend.right](#var_extend.right) as the value of their `extend=` parameter), the space between line extensions will also be filled."],syntax:["linefill.new(line1, line2, color) → series linefill"],returnedTypes:["series linefill"]},{name:"linefill.delete",desc:["Deletes the specified linefill object. If it has already been deleted, does nothing."],args:[{name:"id",desc:"A linefill object.",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"}],syntax:["linefill.delete(id) → void"],returnedTypes:["void"]},{name:"linefill.set_color",desc:["The function sets the color of the linefill object passed to it."],args:[{name:"id",desc:"A linefill object.",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"},{name:"color",desc:"The color of the linefill object.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],syntax:["linefill.set_color(id, color) → void"],returnedTypes:["void"]},{name:"linefill.get_line1",desc:["Returns the ID of the first line used in the `id` linefill."],args:[{name:"id",desc:"A linefill object.",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"}],syntax:["linefill.get_line1(id) → series line"],returnedTypes:["series line"]},{name:"linefill.get_line2",desc:["Returns the ID of the second line used in the `id` linefill."],args:[{name:"id",desc:"A linefill object.",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"}],syntax:["linefill.get_line2(id) → series line"],returnedTypes:["series line"]},{name:"array.new_linefill",desc:["The function creates a new array object of linefill type elements."],args:[{name:"size",desc:"Initial size of an array.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements.",allowedTypeIDs:["series linefill"],displayType:"series linefill"}],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],syntax:["array.new_linefill(size, initial_value) → linefill[]"],returnedTypes:["linefill[]"]},{name:"label.new",desc:["Creates new label object."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object that specifies the label's location.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"},{name:"text",desc:"Label text. Default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"xloc",desc:"See description of **x** argument. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"yloc",desc:"Possible values are [yloc.price](#var_yloc.price), [yloc.abovebar](#var_yloc.abovebar), [yloc.belowbar](#var_yloc.belowbar). If yloc=[yloc.price](#var_yloc.price), **y** argument specifies the price of the label position. If yloc=[yloc.abovebar](#var_yloc.abovebar), label is located above bar. If yloc=[yloc.belowbar](#var_yloc.belowbar), label is located below bar. Default is [yloc.price](#var_yloc.price).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"color",desc:"Color of the label border and arrow",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"style",desc:"Label style. Possible values: [label.style_none](#var_label.style_none), [label.style_xcross](#var_label.style_xcross), [label.style_cross](#var_label.style_cross), [label.style_triangleup](#var_label.style_triangleup), [label.style_triangledown](#var_label.style_triangledown), [label.style_flag](#var_label.style_flag), [label.style_circle](#var_label.style_circle), [label.style_arrowup](#var_label.style_arrowup), [label.style_arrowdown](#var_label.style_arrowdown), [label.style_label_up](#var_label.style_label_up), [label.style_label_down](#var_label.style_label_down), [label.style_label_left](#var_label.style_label_left), [label.style_label_right](#var_label.style_label_right), [label.style_label_lower_left](#var_label.style_label_lower_left), [label.style_label_lower_right](#var_label.style_label_lower_right), [label.style_label_upper_left](#var_label.style_label_upper_left), [label.style_label_upper_right](#var_label.style_label_upper_right), [label.style_label_center](#var_label.style_label_center), [label.style_square](#var_label.style_square), [label.style_diamond](#var_label.style_diamond), [label.style_text_outline](#var_label.style_text_outline). Default is [label.style_label_down](#var_label.style_label_down).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"textcolor",desc:"Text color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"size",desc:"Label size. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default value is [size.normal](#var_size.normal).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"textalign",desc:"Label text alignment. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right). Default value is [text.align_center](#var_text.align_center).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"tooltip",desc:"Hover to see tooltip label.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("label.new")','var label1 = label.new(bar_index, low, text="Hello, world!", style=label.style_circle)',"label.set_x(label1, 0)","label.set_xloc(label1, time, xloc.bar_time)","label.set_color(label1, color.red)","label.set_size(label1, size.large)"],returns:["Label ID object which may be passed to label.setXXX and label.getXXX functions."],seeAlso:["[label.delete](#fun_label.delete)","[label.set_x](#fun_label.set_x)","[label.set_y](#fun_label.set_y)","[label.set_xy](#fun_label.set_xy)","[label.set_xloc](#fun_label.set_xloc)","[label.set_yloc](#fun_label.set_yloc)","[label.set_color](#fun_label.set_color)","[label.set_textcolor](#fun_label.set_textcolor)","[label.set_style](#fun_label.set_style)","[label.set_size](#fun_label.set_size)","[label.set_textalign](#fun_label.set_textalign)","[label.set_tooltip](#fun_label.set_tooltip)"],syntax:["label.new(point, text, xloc, yloc, color, style, textcolor, size, textalign, tooltip, text_font_family) → series label"],returnedTypes:["series label"]},{name:"label.new",desc:["Creates new label object."],args:[{name:"x",desc:"Bar index (if xloc = [xloc.bar_index](#var_xloc.bar_index)) or bar UNIX time (if xloc = [xloc.bar_time](#var_xloc.bar_time)) of the label position. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"Price of the label position. It is taken into account only if yloc=[yloc.price](#var_yloc.price).",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"text",desc:"Label text. Default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"xloc",desc:"See description of **x** argument. Possible values: [xloc.bar_index](#var_xloc.bar_index) and [xloc.bar_time](#var_xloc.bar_time). Default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"yloc",desc:"Possible values are [yloc.price](#var_yloc.price), [yloc.abovebar](#var_yloc.abovebar), [yloc.belowbar](#var_yloc.belowbar). If yloc=[yloc.price](#var_yloc.price), **y** argument specifies the price of the label position. If yloc=[yloc.abovebar](#var_yloc.abovebar), label is located above bar. If yloc=[yloc.belowbar](#var_yloc.belowbar), label is located below bar. Default is [yloc.price](#var_yloc.price).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"color",desc:"Color of the label border and arrow",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"style",desc:"Label style. Possible values: [label.style_none](#var_label.style_none), [label.style_xcross](#var_label.style_xcross), [label.style_cross](#var_label.style_cross), [label.style_triangleup](#var_label.style_triangleup), [label.style_triangledown](#var_label.style_triangledown), [label.style_flag](#var_label.style_flag), [label.style_circle](#var_label.style_circle), [label.style_arrowup](#var_label.style_arrowup), [label.style_arrowdown](#var_label.style_arrowdown), [label.style_label_up](#var_label.style_label_up), [label.style_label_down](#var_label.style_label_down), [label.style_label_left](#var_label.style_label_left), [label.style_label_right](#var_label.style_label_right), [label.style_label_lower_left](#var_label.style_label_lower_left), [label.style_label_lower_right](#var_label.style_label_lower_right), [label.style_label_upper_left](#var_label.style_label_upper_left), [label.style_label_upper_right](#var_label.style_label_upper_right), [label.style_label_center](#var_label.style_label_center), [label.style_square](#var_label.style_square), [label.style_diamond](#var_label.style_diamond), [label.style_text_outline](#var_label.style_text_outline). Default is [label.style_label_down](#var_label.style_label_down).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"textcolor",desc:"Text color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"size",desc:"Label size. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default value is [size.normal](#var_size.normal).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"textalign",desc:"Label text alignment. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right). Default value is [text.align_center](#var_text.align_center).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"tooltip",desc:"Hover to see tooltip label.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("label.new")','var label1 = label.new(bar_index, low, text="Hello, world!", style=label.style_circle)',"label.set_x(label1, 0)","label.set_xloc(label1, time, xloc.bar_time)","label.set_color(label1, color.red)","label.set_size(label1, size.large)"],returns:["Label ID object which may be passed to label.setXXX and label.getXXX functions."],seeAlso:["[label.delete](#fun_label.delete)","[label.set_x](#fun_label.set_x)","[label.set_y](#fun_label.set_y)","[label.set_xy](#fun_label.set_xy)","[label.set_xloc](#fun_label.set_xloc)","[label.set_yloc](#fun_label.set_yloc)","[label.set_color](#fun_label.set_color)","[label.set_textcolor](#fun_label.set_textcolor)","[label.set_style](#fun_label.set_style)","[label.set_size](#fun_label.set_size)","[label.set_textalign](#fun_label.set_textalign)","[label.set_tooltip](#fun_label.set_tooltip)"],syntax:["label.new(x, y, text, xloc, yloc, color, style, textcolor, size, textalign, tooltip, text_font_family) → series label"],returnedTypes:["series label"]},{name:"label.set_x",desc:["Sets bar index or bar time (depending on the xloc) of the label position."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"x",desc:"New bar index or bar time of the label position. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_x(id, x) → void"],returnedTypes:["void"]},{name:"label.set_y",desc:["Sets price of the label position"],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"y",desc:"New price of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_y(id, y) → void"],returnedTypes:["void"]},{name:"label.set_xy",desc:["Sets bar index/time and price of the label position."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"x",desc:"New bar index or bar time of the label position. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"New price of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_xy(id, x, y) → void"],returnedTypes:["void"]},{name:"label.set_xloc",desc:["Sets x-location and new bar index/time value."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"x",desc:"New bar index or bar time of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"xloc",desc:"New x-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[xloc.bar_index](#var_xloc.bar_index)","[xloc.bar_time](#var_xloc.bar_time)","[label.new](#fun_label.new)"],syntax:["label.set_xloc(id, x, xloc) → void"],returnedTypes:["void"]},{name:"label.set_yloc",desc:["Sets new y-location calculation algorithm."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"yloc",desc:"New y-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[yloc.price](#var_yloc.price)","[yloc.abovebar](#var_yloc.abovebar)","[yloc.belowbar](#var_yloc.belowbar)","[label.new](#fun_label.new)"],syntax:["label.set_yloc(id, yloc) → void"],returnedTypes:["void"]},{name:"label.set_text",desc:["Sets label text"],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"text",desc:"New label text.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_text(id, text) → void"],returnedTypes:["void"]},{name:"label.set_text_font_family",desc:["The function sets the font family of the text inside the label."],args:[{name:"id",desc:"A label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the label font")',"if barstate.islastconfirmedhistory",' l = label.new(bar_index, 0, "monospace", yloc=yloc.abovebar)'," label.set_text_font_family(l, font.family_monospace)"],seeAlso:["[label.new](#fun_label.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["label.set_text_font_family(id, text_font_family) → void"],returnedTypes:["void"]},{name:"label.set_color",desc:["Sets label border and arrow color."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"color",desc:"New label border and arrow color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_color(id, color) → void"],returnedTypes:["void"]},{name:"label.set_style",desc:["Sets label style."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"style",desc:"New label style. Possible values: [label.style_none](#var_label.style_none), [label.style_xcross](#var_label.style_xcross), [label.style_cross](#var_label.style_cross), [label.style_triangleup](#var_label.style_triangleup), [label.style_triangledown](#var_label.style_triangledown), [label.style_flag](#var_label.style_flag), [label.style_circle](#var_label.style_circle), [label.style_arrowup](#var_label.style_arrowup), [label.style_arrowdown](#var_label.style_arrowdown), [label.style_label_up](#var_label.style_label_up), [label.style_label_down](#var_label.style_label_down), [label.style_label_left](#var_label.style_label_left), [label.style_label_right](#var_label.style_label_right), [label.style_label_lower_left](#var_label.style_label_lower_left), [label.style_label_lower_right](#var_label.style_label_lower_right), [label.style_label_upper_left](#var_label.style_label_upper_left), [label.style_label_upper_right](#var_label.style_label_upper_right), [label.style_label_center](#var_label.style_label_center), [label.style_square](#var_label.style_square), [label.style_diamond](#var_label.style_diamond), [label.style_text_outline](#var_label.style_text_outline).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_style(id, style) → void"],returnedTypes:["void"]},{name:"label.set_textcolor",desc:["Sets color of the label text."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"textcolor",desc:"New text color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_textcolor(id, textcolor) → void"],returnedTypes:["void"]},{name:"label.set_size",desc:["Sets arrow and text size of the specified label object."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"size",desc:"Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default value is [size.auto](#var_size.auto).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.large](#var_size.large)","[size.huge](#var_size.huge)","[label.new](#fun_label.new)"],syntax:["label.set_size(id, size) → void"],returnedTypes:["void"]},{name:"label.set_textalign",desc:["Sets the alignment for the label text."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"textalign",desc:"Label text alignment. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[text.align_left](#var_text.align_left)","[text.align_center](#var_text.align_center)","[text.align_right](#var_text.align_right)","[label.new](#fun_label.new)"],syntax:["label.set_textalign(id, textalign) → void"],returnedTypes:["void"]},{name:"label.set_tooltip",desc:["Sets the tooltip text."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"tooltip",desc:"Tooltip text.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_tooltip(id, tooltip) → void"],returnedTypes:["void"]},{name:"label.delete",desc:["Deletes the specified label object. If it has already been deleted, does nothing."],args:[{name:"id",desc:"Label object to delete.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.delete(id) → void"],returnedTypes:["void"]},{name:"label.get_x",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of this label's position."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],examples:["//@version=5",'indicator("label.get_x")','my_label = label.new(time, open, text="Open bar text", xloc=xloc.bar_time)',"a = label.get_x(my_label)","plot(time - label.get_x(my_label)) //draws zero plot"],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_x(id) → series int"],returnedTypes:["series int"]},{name:"label.get_y",desc:["Returns price of this label's position."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],returns:["Floating point value representing price."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_y(id) → series float"],returnedTypes:["series float"]},{name:"label.get_text",desc:["Returns the text of this label object."],args:[{name:"id",desc:"Label object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],examples:["//@version=5",'indicator("label.get_text")','my_label = label.new(time, open, text="Open bar text", xloc=xloc.bar_time)',"a = label.get_text(my_label)",'label.new(time, close, text = a + " new", xloc=xloc.bar_time)'],returns:["String object containing the text of this label."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_text(id) → series string"],returnedTypes:["series string"]},{name:"max_bars_back",desc:["Function sets the maximum number of bars that is available for historical reference of a given built-in or user variable. When operator '[]' is applied to a variable - it is a reference to a historical value of that variable.","","If an argument of an operator '[]' is a compile time constant value (e.g. 'v[10]', 'close[500]') then there is no need to use 'max_bars_back' function for that variable. Pine Script® compiler will use that constant value as history buffer size.","","If an argument of an operator '[]' is a value, calculated at runtime (e.g. 'v[i]' where 'i' - is a series variable) then Pine Script® attempts to autodetect the history buffer size at runtime. Sometimes it fails and the script crashes at runtime because it eventually refers to historical values that are out of the buffer. In that case you should use 'max_bars_back' to fix that problem manually."],args:[{name:"var",desc:"Series variable identifier for which history buffer should be resized. Possible values are: 'open', 'high', 'low', 'close', 'volume', 'time', or any user defined variable id.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool","series int","simple int","input int","const int","series float","simple float","input float","const float","series color","simple color","input color","const color","series label","simple label","input label","const label","series line","simple line","input line","const line"],displayType:"series bool"},{name:"num",desc:"History buffer size which is the number of bars that could be referenced for variable 'var'.",required:!0,allowedTypeIDs:["const int"],displayType:"const int"}],examples:["//@version=5",'indicator("max_bars_back")',"close_() => close","depth() => 400","d = depth()","v = close_()","max_bars_back(v, 500)","out = if bar_index > 0"," v[d]","else"," v","plot(out)"],returns:["void"],remarks:["At the moment 'max_bars_back' cannot be applied to built-ins like 'hl2', 'hlc3', 'ohlc4'. Please use multiple 'max_bars_back' calls as workaround here (e.g. instead of a single ‘max_bars_back(hl2, 100)’ call you should call the function twice: ‘max_bars_back(high, 100), max_bars_back(low, 100)’).","","If the [indicator](#fun_indicator) or [strategy](#fun_strategy) 'max_bars_back' parameter is used, all variables in the indicator are affected. This may result in excessive memory usage and cause runtime problems. When possible (i.e. when the cause is a variable rather than a function), please use the [max_bars_back](#fun_max_bars_back) function instead."],seeAlso:["Param 'max_bars_back' of [indicator](#fun_indicator) and [strategy](#fun_strategy) functions."],syntax:["max_bars_back(var, num) → void"],returnedTypes:["void"]},{name:"array.new<type>",desc:["The function creates a new array object of <type> elements."],syntax:["array.new<type>(size, initial_value) → array<type>"],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:[],displayType:"<array_type>"}],examples:["//@version=5",'indicator("array.new<string> example")','a = array.new<string>(1, "Hello, World!")',"label.new(bar_index, close, array.get(a, 0))"],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("array.new<color> example")',"a = array.new<color>()","array.push(a, color.red)","array.push(a, color.green)","plot(close, color = array.get(a, close > open ? 1 : 0))"]},{desc:[],examples:["//@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")']},{desc:[],examples:["//@version=5",'indicator("array.new<line> example")',"// draw last 15 lines","var a = array.new<line>()","array.push(a, line.new(bar_index - 1, close[1], bar_index, close))","if array.size(a) > 15"," ln = array.shift(a)"," line.delete(ln)"]}],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0.","If you want to initialize an array and specify all its elements at the same time, then use the function array.from."],seeAlso:["[array.from](#fun_array.from)","[array.push](#fun_array.push)","[array.get](#fun_array.get)","[array.size](#fun_array.size)","[array.remove](#fun_array.remove)","[array.shift](#fun_array.shift)","[array.sum](#fun_array.sum)"],template:!0},{name:"array.new_float",desc:["The function creates a new array object of float type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("array.new_float example")',"length = 5","a = array.new_float(length, close)","plot(array.sum(a) / length)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_color](#fun_array.new_color)","[array.new_bool](#fun_array.new_bool)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.new_float(size, initial_value) → float[]"],returnedTypes:["float[]"]},{name:"array.new_int",desc:["The function creates a new array object of int type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.new_int example")',"length = 5","a = array.new_int(length, int(close))","plot(array.sum(a) / length)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.new_int(size, initial_value) → int[]"],returnedTypes:["int[]"]},{name:"array.new_color",desc:["The function creates a new array object of color type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("array.new_color example")',"length = 5","a = array.new_color(length, color.red)","plot(close, color = array.get(a, 0))"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.new_color(size, initial_value) → color[]"],returnedTypes:["color[]"]},{name:"array.new_bool",desc:["The function creates a new array object of bool type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.new_bool example")',"length = 5","a = array.new_bool(length, close > open)","plot(array.get(a, 0) ? close : open)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.new_bool(size, initial_value) → bool[]"],returnedTypes:["bool[]"]},{name:"array.new_string",desc:["The function creates a new array object of string type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("array.new_string example")',"length = 5",'a = array.new_string(length, "text")',"label.new(bar_index, close, array.get(a, 0))"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.new_string(size, initial_value) → string[]"],returnedTypes:["string[]"]},{name:"array.new_line",desc:["The function creates a new array object of line type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series line"],displayType:"series line"}],examples:["//@version=5",'indicator("array.new_line example")',"// draw last 15 lines","var a = array.new_line()","array.push(a, line.new(bar_index - 1, close[1], bar_index, close))","if array.size(a) > 15"," ln = array.shift(a)"," line.delete(ln)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.new_line(size, initial_value) → line[]"],returnedTypes:["line[]"]},{name:"array.new_box",desc:["The function creates a new array object of box type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series box"],displayType:"series box"}],examples:["//@version=5",'indicator("array.new_box example")',"box[] boxes = array.new_box()","array.push(boxes, box.new(time, close, time+2, low, xloc=xloc.bar_time))","plot(1)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.new_box(size, initial_value) → box[]"],returnedTypes:["box[]"]},{name:"array.new_table",desc:["The function creates a new array object of table type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series table"],displayType:"series table"}],examples:["//@version=5",'indicator("table array")',"table[] tables = array.new_table()","array.push(tables, table.new(position = position.top_left, rows = 1, columns = 2, bgcolor = color.yellow, border_width=1))","plot(1)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.new_table(size, initial_value) → table[]"],returnedTypes:["table[]"]},{name:"array.new_label",desc:["The function creates a new array object of label type elements."],args:[{name:"size",desc:"Initial size of an array. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all array elements. Optional. The default is 'na'.",allowedTypeIDs:["series label"],displayType:"series label"}],examples:["//@version=5",'indicator("array.new_label example")',"var a = array.new_label()",'l = label.new(bar_index, close, "some text")',"array.push(a, l)","if close > close[1] and close[1] > close[2]"," // remove all labels"," size = array.size(a) - 1"," for i = 0 to size"," lb = array.get(a, i)"," label.delete(lb)"],returns:["The ID of an array object which may be used in other array.*() functions."],remarks:["An array index starts from 0."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.new_label(size, initial_value) → label[]"],returnedTypes:["label[]"]},{name:"array.copy",desc:["The function creates a copy of an existing array."],syntax:["array.copy(id) → array<type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.copy example")',"length = 5","a = array.new_float(length, close)","b = array.copy(a)","a := array.new_float(length, open)","plot(array.sum(a) / length)","plot(array.sum(b) / length)"],returns:["A copy of an array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"]},{name:"array.slice",desc:["The function creates a slice from an existing array. If an object from the slice changes, the changes are applied to both the new and the original arrays."],syntax:["array.slice(id, index_from, index_to) → array<type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"index_from",desc:"Zero-based index at which to begin extraction.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"index_to",desc:"Zero-based index before which to end extraction. The function extracts up to but not including the element with this index.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.slice example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","// take elements from 0 to 4","// *note that changes in slice also modify original array ","slice = array.slice(a, 0, 5)","plot(array.sum(a) / 10)","plot(array.sum(slice) / 5)"],returns:["A shallow copy of an array's slice."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"]},{name:"array.size",desc:["The function returns the number of elements in an array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.size example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","// note that changes in slice also modify original array","slice = array.slice(a, 0, 5)","array.push(slice, open)","// size was changed in slice and in original array","plot(array.size(a))","plot(array.size(slice))"],returns:["The number of elements in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sum](#fun_array.sum)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.size(id) → series int"],returnedTypes:["series int"]},{name:"array.first",desc:["Returns the array's first element. Throws a runtime error if the array is empty."],syntax:["array.first(id) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.first example")',"arr = array.new_int(3, 10)","plot(array.first(arr))"],seeAlso:["[array.last](#fun_array.last)","[array.get](#fun_array.get)"]},{name:"array.last",desc:["Returns the array's last element. Throws a runtime error if the array is empty."],syntax:["array.last(id) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.last example")',"arr = array.new_int(3, 10)","plot(array.last(arr))"],seeAlso:["[array.first](#fun_array.first)","[array.get](#fun_array.get)"]},{name:"array.every",desc:["Returns [true](#var_true) if all elements of the `id` array are [true](#var_true), [false](#var_false) otherwise."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["bool[]"],displayType:"bool[]"}],remarks:["This function also works with arrays of [int](#op_int) and [float](#op_float) types, in which case zero values are considered [false](#var_false), and all others [true](#var_true)."],seeAlso:["[array.some](#fun_array.some)","[array.get](#fun_array.get)"],syntax:["array.every(id) → series bool"],returnedTypes:["series bool"]},{name:"array.some",desc:["Returns [true](#var_true) if at least one element of the `id` array is [true](#var_true), [false](#var_false) otherwise."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["bool[]"],displayType:"bool[]"}],remarks:["This function also works with arrays of [int](#op_int) and [float](#op_float) types, in which case zero values are considered [false](#var_false), and all others [true](#var_true)."],seeAlso:["[array.every](#fun_array.every)","[array.get](#fun_array.get)"],syntax:["array.some(id) → series bool"],returnedTypes:["series bool"]},{name:"array.get",desc:["The function returns the value of the element at the specified index."],syntax:["array.get(id, index) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"index",desc:"The index of the element whose value is to be returned.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.get example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i] - open[i])","plot(array.get(a, 9))"],returns:["The array element's value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"]},{name:"array.min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id) → series float"],returnedTypes:["series float"]},{name:"array.min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id) → series int"],returnedTypes:["series int"]},{name:"array.min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"nth",desc:"The nth smallest value to return, where zero is the smallest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id, nth) → series float"],returnedTypes:["series float"]},{name:"array.min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"nth",desc:"The nth smallest value to return, where zero is the smallest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id, nth) → series int"],returnedTypes:["series int"]},{name:"array.max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id) → series float"],returnedTypes:["series float"]},{name:"array.max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id) → series int"],returnedTypes:["series int"]},{name:"array.max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"nth",desc:"The nth greatest value to return, where zero is the greatest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id, nth) → series float"],returnedTypes:["series float"]},{name:"array.max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"nth",desc:"The nth greatest value to return, where zero is the greatest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id, nth) → series int"],returnedTypes:["series int"]},{name:"array.range",desc:["The function returns the difference between the min and max values from a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.range example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.range(a))"],returns:["The difference between the min and max values in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.range(id) → series float"],returnedTypes:["series float"]},{name:"array.range",desc:["The function returns the difference between the min and max values from a given array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.range example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.range(a))"],returns:["The difference between the min and max values in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.range(id) → series int"],returnedTypes:["series int"]},{name:"array.sum",desc:["The function returns the sum of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.sum example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.sum(a))"],returns:["The sum of the array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)"],syntax:["array.sum(id) → series float"],returnedTypes:["series float"]},{name:"array.sum",desc:["The function returns the sum of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.sum example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.sum(a))"],returns:["The sum of the array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)"],syntax:["array.sum(id) → series int"],returnedTypes:["series int"]},{name:"array.set",desc:["The function sets the value of the element at the specified index."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"index",desc:"The index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The new value to be set.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.set example")',"a = array.new_float(10)","for i = 0 to 9"," array.set(a, i, close[i])","plot(array.sum(a) / 10)"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.set(id, index, value) → void"],returnedTypes:["void"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → int[]"],returnedTypes:["int[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → float[]"],returnedTypes:["float[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → bool[]"],returnedTypes:["bool[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → string[]"],returnedTypes:["string[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → label[]"],returnedTypes:["label[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → line[]"],returnedTypes:["line[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → color[]"],returnedTypes:["color[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → box[]"],returnedTypes:["box[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → table[]"],returnedTypes:["table[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:["series linefill"],displayType:"series linefill"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → linefill[]"],returnedTypes:["linefill[]"]},{name:"array.from",desc:["The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type."],args:[{name:"arg0, arg1, ...",desc:"Array arguments.",required:!0,allowedTypeIDs:[],displayType:"<arg..._type>"}],examples:["//@version=5",'indicator("array.from_example", overlay = false)','arr = array.from("Hello", "World!") // arr (string[]) will contain 2 elements: {Hello}, {World!}.',"plot(close)"],returns:["The array element's value."],syntax:["array.from(arg0, arg1, ...) → type[]"],returnedTypes:["array<>"]},{name:"array.fill",desc:["The function sets elements of an array to a single value. If no index is specified, all elements are set. If only a start index (default 0) is supplied, the elements starting at that index are set. If both index parameters are used, the elements from the starting index up to but not including the end index (default na) are set."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"Value to fill the array with.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"},{name:"index_from",desc:"Start index, default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"index_to",desc:"End index, default is na. Must be one greater than the index of the last element to set.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.fill example")',"a = array.new_float(10)","array.fill(a, close)","plot(array.sum(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.slice](#fun_array.slice)"],syntax:["array.fill(id, value, index_from, index_to) → void"],returnedTypes:["void"]},{name:"array.insert",desc:["The function changes the contents of an array by adding new elements in place."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"index",desc:"The index at which to insert the value.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The value to add to the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.insert example")',"a = array.new_float(5, close)","array.insert(a, 0, open)","plot(array.get(a, 5))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.insert(id, index, value) → void"],returnedTypes:["void"]},{name:"array.join",desc:["The function creates and returns a new string by concatenating all the elements of an array, separated by the specified separator string."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]","int[]","string[]"],displayType:"float[]"},{name:"separator",desc:"The string used to separate each array element.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("array.join example")',"a = array.new_float(5, 5)",'label.new(bar_index, close, array.join(a, ","))'],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.join(id, separator) → series string"],returnedTypes:["series string"]},{name:"array.push",desc:["The function appends a value to an array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"The value of the element added to the end of the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.push example")',"a = array.new_float(5, 0)","array.push(a, open)","plot(array.get(a, 5))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.push(id, value) → void"],returnedTypes:["void"]},{name:"array.remove",desc:["The function changes the contents of an array by removing the element with the specified index."],syntax:["array.remove(id, index) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"index",desc:"The index of the element to remove.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.remove example")',"a = array.new_float(5,high)","removedEl = array.remove(a, 0)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.insert](#fun_array.insert)","[array.pop](#fun_array.pop)","[array.shift](#fun_array.shift)"]},{name:"array.pop",desc:["The function removes the last element from an array and returns its value."],syntax:["array.pop(id) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.pop example")',"a = array.new_float(5,high)","removedEl = array.pop(a)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)","[array.shift](#fun_array.shift)"]},{name:"array.clear",desc:["The function removes all elements from an array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.clear example")',"a = array.new_float(5,high)","array.clear(a)","array.push(a, close)","plot(array.get(a,0))","plot(array.size(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)"],syntax:["array.clear(id) → void"],returnedTypes:["void"]},{name:"array.sort",desc:["The function sorts the elements of an array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]","int[]","string[]"],displayType:"float[]"},{name:"order",desc:"The sort order: order.ascending (default) or order.descending.",allowedTypeIDs:["simple sort_order","input sort_order","const sort_order"],displayType:"simple sort_order"}],examples:["//@version=5",'indicator("array.sort example")',"a = array.new_float(0,0)","for i = 0 to 5"," array.push(a, high[i])","array.sort(a, order.descending)","if barstate.islast"," label.new(bar_index, close, str.tostring(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.sort(id, order) → void"],returnedTypes:["void"]},{name:"array.sort_indices",desc:["Returns an array of indices which, when used to index the original array, will access its elements in their sorted order. It does not modify the original array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]","float[]","string[]"],displayType:"float[]"},{name:"order",desc:"The sort order: order.ascending or order.descending. Optional. The default is order.ascending.",allowedTypeIDs:["series sort_order","simple sort_order","input sort_order","const sort_order"],displayType:"series sort_order"}],examples:["//@version=5",'indicator("array.sort_indices")',"a = array.from(5, -2, 0, 9, 1)","sortedIndices = array.sort_indices(a) // [1, 2, 4, 0, 3]","indexOfSmallestValue = array.get(sortedIndices, 0) // 1","smallestValue = array.get(a, indexOfSmallestValue) // -2","plot(smallestValue)"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.sort_indices(id, order) → int[]"],returnedTypes:["int[]"]},{name:"array.percentrank",desc:["Returns the percentile rank of the element at the specified `index`."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"index",desc:"The index of the element for which the percentile rank should be calculated.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],remarks:["Percentile rank is the percentage of how many elements in the array are less than or equal to the reference value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentrank(id, index) → series float"],returnedTypes:["series float"]},{name:"array.percentrank",desc:["Returns the percentile rank of the element at the specified `index`."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"index",desc:"The index of the element for which the percentile rank should be calculated.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],remarks:["Percentile rank is the percentage of how many elements in the array are less than or equal to the reference value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentrank(id, index) → series int"],returnedTypes:["series int"]},{name:"array.percentile_nearest_rank",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using the nearest-rank method."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_nearest_rank(id, percentage) → series float"],returnedTypes:["series float"]},{name:"array.percentile_nearest_rank",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using the nearest-rank method."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_nearest_rank(id, percentage) → series int"],returnedTypes:["series int"]},{name:"array.percentile_linear_interpolation",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using linear interpolation."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring. Linear interpolation estimates the value between two ranks."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_linear_interpolation(id, percentage) → series float"],returnedTypes:["series float"]},{name:"array.percentile_linear_interpolation",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using linear interpolation."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring. Linear interpolation estimates the value between two ranks."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_linear_interpolation(id, percentage) → series int"],returnedTypes:["series int"]},{name:"array.abs",desc:["Returns an array containing the absolute value of each element in the original array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.abs(id) → float[]"],returnedTypes:["float[]"]},{name:"array.abs",desc:["Returns an array containing the absolute value of each element in the original array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.abs(id) → int[]"],returnedTypes:["int[]"]},{name:"array.binary_search",desc:["The function returns the index of the value, or -1 if the value is not found. The array to search must be sorted in ascending order."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("array.binary_search")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search(a, 0) // 1","plot(position)"],remarks:["A binary search works on arrays pre-sorted in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search(id, val) → series int"],returnedTypes:["series int"]},{name:"array.binary_search_leftmost",desc:["The function returns the index of the value if it is found. When the value is not found, the function returns the index of the next smallest element to the left of where the value would lie if it was in the array. The array to search must be sorted in ascending order."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("array.binary_search_leftmost")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search_leftmost(a, 3) // 2","plot(position)"]},{desc:[],examples:["//@version=5",'indicator("array.binary_search_leftmost, repetitive elements")',"a = array.from(4, 5, 5, 5)","// Returns the index of the first instance.","position = array.binary_search_leftmost(a, 5) ","plot(position) // Plots 1"]}],remarks:["A binary search works on arrays pre-sorted in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search_leftmost(id, val) → series int"],returnedTypes:["series int"]},{name:"array.binary_search_rightmost",desc:["The function returns the index of the value if it is found. When the value is not found, the function returns the index of the element to the right of where the value would lie if it was in the array. The array must be sorted in ascending order."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("array.binary_search_rightmost")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search_rightmost(a, 3) // 3","plot(position)"]},{desc:[],examples:["//@version=5",'indicator("array.binary_search_rightmost, repetitive elements")',"a = array.from(4, 5, 5, 5)","// Returns the index of the last instance.","position = array.binary_search_rightmost(a, 5) ","plot(position) // Plots 3"]}],remarks:["A binary search works on sorted arrays in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search_rightmost(id, val) → series int"],returnedTypes:["series int"]},{name:"array.concat",desc:["The function is used to merge two arrays. It pushes all elements from the second array to the first array, and returns the first array."],syntax:["array.concat(id1, id2) → array<type>"],args:[{name:"id1",desc:"The first array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"id2",desc:"The second array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.concat example")',"a = array.new_float(0,0)","b = array.new_float(0,0)","for i = 0 to 4"," array.push(a, high[i])"," array.push(b, low[i])","c = array.concat(a,b)","plot(array.size(a))","plot(array.size(b))","plot(array.size(c))"],returns:["The first array with merged elements from the second array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice),"]},{name:"array.avg",desc:["The function returns the mean of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.avg example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.avg(a))"],returns:["Mean of array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.stdev](#fun_array.stdev)"],syntax:["array.avg(id) → series float"],returnedTypes:["series float"]},{name:"array.avg",desc:["The function returns the mean of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.avg example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.avg(a))"],returns:["Mean of array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.stdev](#fun_array.stdev)"],syntax:["array.avg(id) → series int"],returnedTypes:["series int"]},{name:"array.stdev",desc:["The function returns the standard deviation of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.stdev example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.stdev(a))"],returns:["The standard deviation of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)"],syntax:["array.stdev(id, biased) → series float"],returnedTypes:["series float"]},{name:"array.stdev",desc:["The function returns the standard deviation of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.stdev example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.stdev(a))"],returns:["The standard deviation of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)"],syntax:["array.stdev(id, biased) → series int"],returnedTypes:["series int"]},{name:"array.variance",desc:["The function returns the variance of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.variance example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.variance(a))"],returns:["The variance of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.stdev](#fun_array.stdev)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)","[array.covariance](#fun_array.covariance)"],syntax:["array.variance(id, biased) → series float"],returnedTypes:["series float"]},{name:"array.variance",desc:["The function returns the variance of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.variance example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.variance(a))"],returns:["The variance of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.stdev](#fun_array.stdev)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)","[array.covariance](#fun_array.covariance)"],syntax:["array.variance(id, biased) → series int"],returnedTypes:["series int"]},{name:"array.covariance",desc:["The function returns the covariance of two arrays."],args:[{name:"id1",desc:"An array object.",required:!0,allowedTypeIDs:["int[]","float[]"],displayType:"float[]"},{name:"id2",desc:"An array object.",required:!0,allowedTypeIDs:["int[]","float[]"],displayType:"float[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.covariance example")',"a = array.new_float(0)","b = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])"," array.push(b, open[i])","plot(array.covariance(a, b))"],returns:["The covariance of two arrays."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.stdev](#fun_array.stdev)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)"],syntax:["array.covariance(id1, id2, biased) → series float"],returnedTypes:["series float"]},{name:"array.mode",desc:["The function returns the mode of an array's elements. If there are several values with the same frequency, it returns the smallest value."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.mode example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.mode(a))"],returns:["The most frequently occurring value from the `id` array. If none exists, returns the smallest value instead."],seeAlso:["[array.new_float](#fun_array.new_float)","[ta.mode](#fun_ta.mode)","[matrix.mode](#fun_matrix.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.mode(id) → series float"],returnedTypes:["series float"]},{name:"array.mode",desc:["The function returns the mode of an array's elements. If there are several values with the same frequency, it returns the smallest value."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.mode example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.mode(a))"],returns:["The most frequently occurring value from the `id` array. If none exists, returns the smallest value instead."],seeAlso:["[array.new_float](#fun_array.new_float)","[ta.mode](#fun_ta.mode)","[matrix.mode](#fun_matrix.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.mode(id) → series int"],returnedTypes:["series int"]},{name:"array.median",desc:["The function returns the median of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.median example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.median(a))"],returns:["The median of the array's elements."],seeAlso:["[array.median](#fun_array.median)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.median(id) → series float"],returnedTypes:["series float"]},{name:"array.median",desc:["The function returns the median of an array's elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.median example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.median(a))"],returns:["The median of the array's elements."],seeAlso:["[array.median](#fun_array.median)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.median(id) → series int"],returnedTypes:["series int"]},{name:"array.standardize",desc:["The function returns the array of standardized elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],examples:["//@version=5",'indicator("array.standardize example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","b = array.standardize(a)","plot(array.min(b))","plot(array.max(b))"],returns:["The array of standardized elements."],seeAlso:["[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.mode](#fun_array.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.stdev](#fun_array.stdev)"],syntax:["array.standardize(id) → float[]"],returnedTypes:["float[]"]},{name:"array.standardize",desc:["The function returns the array of standardized elements."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],examples:["//@version=5",'indicator("array.standardize example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","b = array.standardize(a)","plot(array.min(b))","plot(array.max(b))"],returns:["The array of standardized elements."],seeAlso:["[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.mode](#fun_array.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.stdev](#fun_array.stdev)"],syntax:["array.standardize(id) → int[]"],returnedTypes:["int[]"]},{name:"array.indexof",desc:["The function returns the index of the first occurrence of the value, or -1 if the value is not found."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.indexof example")',"a = array.new_float(5,high)","index = array.indexof(a, high)","plot(index)"],returns:["The index of an element."],seeAlso:["[array.lastindexof](#fun_array.lastindexof)","[array.get](#fun_array.get)","[array.lastindexof](#fun_array.lastindexof)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.indexof(id, value) → series int"],returnedTypes:["series int"]},{name:"array.lastindexof",desc:["The function returns the index of the last occurrence of the value, or -1 if the value is not found."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.lastindexof example")',"a = array.new_float(5,high)","index = array.lastindexof(a, high)","plot(index)"],returns:["The index of an element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.lastindexof(id, value) → series int"],returnedTypes:["series int"]},{name:"array.includes",desc:["The function returns true if the value was found in an array, false otherwise."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.includes example")',"a = array.new_float(5,high)","p = close","if array.includes(a, high)"," p := open","plot(p)"],returns:["True if the value was found in the array, false otherwise."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.indexof](#fun_array.indexof)","[array.shift](#fun_array.shift)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.includes(id, value) → series bool"],returnedTypes:["series bool"]},{name:"array.shift",desc:["The function removes an array's first element and returns its value."],syntax:["array.shift(id) → series <type>"],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.shift example")',"a = array.new_float(5,high)","removedEl = array.shift(a)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.unshift](#fun_array.unshift)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.includes](#fun_array.includes)"]},{name:"array.unshift",desc:["The function inserts the value at the beginning of the array."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"},{name:"value",desc:"The value to add to the start of the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.unshift example")',"a = array.new_float(5, 0)","array.unshift(a, open)","plot(array.get(a, 0))"],seeAlso:["[array.shift](#fun_array.shift)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.indexof](#fun_array.indexof)"],syntax:["array.unshift(id, value) → void"],returnedTypes:["void"]},{name:"array.reverse",desc:["The function reverses an array. The first array element becomes the last, and the last array element becomes the first."],args:[{name:"id",desc:"An array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.reverse example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.get(a, 0))","array.reverse(a)","plot(array.get(a, 0))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sort](#fun_array.sort)","[array.push](#fun_array.push)","[array.set](#fun_array.set)","[array.avg](#fun_array.avg)"],syntax:["array.reverse(id) → void"],returnedTypes:["void"]},{name:"alert",desc:['Creates an alert event when called during the real-time bar, which will trigger a script alert based on "alert function events" if one was previously created for the indicator or strategy through the "Create Alert" dialog box.'],args:[{name:"message",desc:"Message sent when the alert triggers. Required argument.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"freq",desc:"The triggering frequency. Possible values are: [alert.freq_all](#var_alert.freq_all) (all function calls trigger the alert), [alert.freq_once_per_bar](#var_alert.freq_once_per_bar) (the first function call during the bar triggers the alert), [alert.freq_once_per_bar_close](#var_alert.freq_once_per_bar_close) (the function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes). The default is [alert.freq_once_per_bar](#var_alert.freq_once_per_bar).",allowedTypeIDs:["input string","const string"],displayType:"input string"}],examples:["//@version=5",'indicator("`alert()` example", "", true)',"ma = ta.sma(close, 14)","xUp = ta.crossover(close, ma)","if xUp"," // Trigger the alert the first time a cross occurs during the real-time bar.",' alert("Price (" + str.tostring(close) + ") crossed over MA (" + str.tostring(ma) + ").", alert.freq_once_per_bar)',"plot(ma)",'plotchar(xUp, "xUp", "▲", location.top, size = size.tiny)'],remarks:["The [Help Center](https://www.tradingview.com/chart/?solution=43000597494) explains how to create such alerts.","Contrary to [alertcondition](#fun_alertcondition), [alert](#fun_alert) calls do NOT count as an additional plot.","Function calls can be located in both global and local scopes.","Function calls do not display anything on the chart.","The 'freq' argument only affects the triggering frequency of the function call where it is used."],seeAlso:["[alertcondition](#fun_alertcondition)"],syntax:["alert(message, freq) → void"],returnedTypes:["void"]},{name:"request.earnings",desc:["Requests earnings data for the specified symbol."],args:[{name:"ticker",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL". Using [syminfo.ticker](#var_syminfo.ticker) will cause an error. Use [syminfo.tickerid](#var_syminfo.tickerid) instead.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"field",desc:"Input string. Possible values include: [earnings.actual](#var_earnings.actual), [earnings.estimate](#var_earnings.estimate), [earnings.standardized](#var_earnings.standardized). Default value is [earnings.actual](#var_earnings.actual).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:"Merge strategy for the requested data (requested data automatically merges with the main series OHLC data). Possible values: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). [barmerge.gaps_on](#var_barmerge.gaps_on) - requested data is merged with possible gaps ([na](#var_na) values). [barmerge.gaps_off](#var_barmerge.gaps_off) - requested data is merged continuously without gaps, all the gaps are filled with the previous nearest existing values. Default value is [barmerge.gaps_off](#var_barmerge.gaps_off).",allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"lookahead",desc:"Merge strategy for the requested data position. Possible values: [barmerge.lookahead_on](#var_barmerge.lookahead_on), [barmerge.lookahead_off](#var_barmerge.lookahead_off). Default value is [barmerge.lookahead_off](#var_barmerge.lookahead_off) starting from version 3. Note that behavour is the same on real-time, and differs only on history.",allowedTypeIDs:["simple barmerge_lookahead","input barmerge_lookahead","const barmerge_lookahead"],displayType:"simple barmerge_lookahead"},{name:"ignore_invalid_symbol",desc:"An optional parameter. Determines the behavior of the function if the specified symbol is not found: if false, the script will halt and return a runtime error; if true, the function will return na and execution will continue. The default value is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"currency",desc:`Currency into which the symbol's currency-related earnings values (e.g. [earnings.actual](#var_earnings.actual)) are to be converted. The conversion rates used are based on the FX_IDC pairs' daily rates of the previous day (relative to the bar where the calculation is done). Optional. The default is [syminfo.currency](#var_syminfo.currency). Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD") or one of the constants in the currency.* namespace, e.g. [currency.USD](#var_currency.USD).`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("request.earnings")','s1 = request.earnings("NASDAQ:BELFA")',"plot(s1)",'s2 = request.earnings("NASDAQ:BELFA", earnings.actual, gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on)',"plot(s2)"],returns:["Requested series, or n/a if there is no earnings data for the specified symbol."],seeAlso:["[request.dividends](#fun_request.dividends)","[request.splits](#fun_request.splits)","[request.security](#fun_request.security)","[syminfo.tickerid](#var_syminfo.tickerid)"],syntax:["request.earnings(ticker, field, gaps, lookahead, ignore_invalid_symbol, currency) → series float"],returnedTypes:["series float"]},{name:"request.dividends",desc:["Requests dividends data for the specified symbol."],args:[{name:"ticker",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL". Using [syminfo.ticker](#var_syminfo.ticker) will cause an error. Use [syminfo.tickerid](#var_syminfo.tickerid) instead.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"field",desc:"Input string. Possible values include: [dividends.net](#var_dividends.net), [dividends.gross](#var_dividends.gross). Default value is [dividends.gross](#var_dividends.gross).",allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:"Merge strategy for the requested data (requested data automatically merges with the main series OHLC data). Possible values: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). [barmerge.gaps_on](#var_barmerge.gaps_on) - requested data is merged with possible gaps ([na](#var_na) values). [barmerge.gaps_off](#var_barmerge.gaps_off) - requested data is merged continuously without gaps, all the gaps are filled with the previous nearest existing values. Default value is [barmerge.gaps_off](#var_barmerge.gaps_off).",allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"lookahead",desc:"Merge strategy for the requested data position. Possible values: [barmerge.lookahead_on](#var_barmerge.lookahead_on), [barmerge.lookahead_off](#var_barmerge.lookahead_off). Default value is [barmerge.lookahead_off](#var_barmerge.lookahead_off) starting from version 3. Note that behavour is the same on real-time, and differs only on history.",allowedTypeIDs:["simple barmerge_lookahead","input barmerge_lookahead","const barmerge_lookahead"],displayType:"simple barmerge_lookahead"},{name:"ignore_invalid_symbol",desc:"An optional parameter. Determines the behavior of the function if the specified symbol is not found: if false, the script will halt and return a runtime error; if true, the function will return na and execution will continue. The default value is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"},{name:"currency",desc:`Currency into which the symbol's currency-related dividends values (e.g. [dividends.gross](#var_dividends.gross)) are to be converted. The conversion rates used are based on the FX_IDC pairs' daily rates of the previous day (relative to the bar where the calculation is done). Optional. The default is [syminfo.currency](#var_syminfo.currency). Possible values: a three-letter string with the [currency code in the ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) (e.g. "USD") or one of the constants in the currency.* namespace, e.g. [currency.USD](#var_currency.USD).`,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"}],examples:["//@version=5",'indicator("request.dividends")','s1 = request.dividends("NASDAQ:BELFA")',"plot(s1)",'s2 = request.dividends("NASDAQ:BELFA", dividends.net, gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on)',"plot(s2)"],returns:["Requested series, or n/a if there is no dividends data for the specified symbol."],seeAlso:["[request.earnings](#fun_request.earnings)","[request.splits](#fun_request.splits)","[request.security](#fun_request.security)","[syminfo.tickerid](#var_syminfo.tickerid)"],syntax:["request.dividends(ticker, field, gaps, lookahead, ignore_invalid_symbol, currency) → series float"],returnedTypes:["series float"]},{name:"request.splits",desc:["Requests splits data for the specified symbol."],args:[{name:"ticker",desc:'Symbol. Note that the symbol should be passed with a prefix. For example: "NASDAQ:AAPL" instead of "AAPL". Using [syminfo.ticker](#var_syminfo.ticker) will cause an error. Use [syminfo.tickerid](#var_syminfo.tickerid) instead.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"field",desc:"Input string. Possible values include: [splits.denominator](#var_splits.denominator), [splits.numerator](#var_splits.numerator).",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:"Merge strategy for the requested data (requested data automatically merges with the main series OHLC data). Possible values: [barmerge.gaps_on](#var_barmerge.gaps_on), [barmerge.gaps_off](#var_barmerge.gaps_off). [barmerge.gaps_on](#var_barmerge.gaps_on) - requested data is merged with possible gaps ([na](#var_na) values). [barmerge.gaps_off](#var_barmerge.gaps_off) - requested data is merged continuously without gaps, all the gaps are filled with the previous nearest existing values. Default value is [barmerge.gaps_off](#var_barmerge.gaps_off).",allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"lookahead",desc:"Merge strategy for the requested data position. Possible values: [barmerge.lookahead_on](#var_barmerge.lookahead_on), [barmerge.lookahead_off](#var_barmerge.lookahead_off). Default value is [barmerge.lookahead_off](#var_barmerge.lookahead_off) starting from version 3. Note that behavour is the same on real-time, and differs only on history.",allowedTypeIDs:["simple barmerge_lookahead","input barmerge_lookahead","const barmerge_lookahead"],displayType:"simple barmerge_lookahead"},{name:"ignore_invalid_symbol",desc:"An optional parameter. Determines the behavior of the function if the specified symbol is not found: if false, the script will halt and return a runtime error; if true, the function will return na and execution will continue. The default value is false.",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"}],examples:["//@version=5",'indicator("request.splits")','s1 = request.splits("NASDAQ:BELFA", splits.denominator)',"plot(s1)",'s2 = request.splits("NASDAQ:BELFA", splits.denominator, gaps=barmerge.gaps_on, lookahead=barmerge.lookahead_on)',"plot(s2)"],returns:["Requested series, or n/a if there is no splits data for the specified symbol."],seeAlso:["[request.earnings](#fun_request.earnings)","[request.dividends](#fun_request.dividends)","[request.security](#fun_request.security)","[syminfo.tickerid](#var_syminfo.tickerid)"],syntax:["request.splits(ticker, field, gaps, lookahead, ignore_invalid_symbol) → series float"],returnedTypes:["series float"]},{name:"request.economic",desc:["Requests economic data for a symbol. Economic data includes information such as the state of a country's economy (GDP, inflation rate, etc.) or of a particular industry (steel production, ICU beds, etc.)."],args:[{name:"country_code",desc:'The code of the country (e.g. "US") or the region (e.g. "EU") for which the economic data is requested. The [Help Center article](https://www.tradingview.com/chart/?solution=43000665359) lists the countries and their codes. The countries for which information is available vary with metrics. The [Help Center article for each metric](https://www.tradingview.com/support/folders/43000581956-list-of-available-economic-indicators/) lists the countries for which the metric is available.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"field",desc:'The code of the requested economic metric (e.g., "GDP"). The [Help Center article](https://www.tradingview.com/chart/?solution=43000665359) lists the metrics and their codes.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"gaps",desc:`Specifies how the returned values are merged on chart bars. Possible values: [barmerge.gaps_off](#var_barmerge.gaps_off), [barmerge.gaps_on](#var_barmerge.gaps_on). With [barmerge.gaps_on](#var_barmerge.gaps_on), a value only appears on the current chart bar when it first becomes available from the function's context, otherwise [na](#var_na) is returned (thus a "gap" occurs). With [barmerge.gaps_off](#var_barmerge.gaps_off), what would otherwise be gaps are filled with the latest known value returned, avoiding [na](#var_na) values. Optional. The default is [barmerge.gaps_off](#var_barmerge.gaps_off).`,allowedTypeIDs:["simple barmerge_gaps","input barmerge_gaps","const barmerge_gaps"],displayType:"simple barmerge_gaps"},{name:"ignore_invalid_symbol",desc:"Determines the behavior of the function if the specified symbol is not found: if [false](#var_false), the script will halt and return a runtime error; if [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"}],examples:["//@version=5",'indicator("US GDP")','e = request.economic("US", "GDP")',"plot(e)"],returns:["Requested series."],remarks:['Economic data can also be accessed from charts, just like a regular symbol. Use "ECONOMIC" as the exchange name and `{country_code}{field}` as the ticker. The name of US GDP data is thus "ECONOMIC:USGDP".'],seeAlso:["[request.financial](#fun_request.financial)","[request.quandl](#fun_request.quandl)"],syntax:["request.economic(country_code, field, gaps, ignore_invalid_symbol) → series float"],returnedTypes:["series float"]},{name:"request.seed",desc:["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 [here](https://github.com/tradingview-eod/pine-seeds-docs)."],args:[{name:"source",desc:"Name of the GitHub repository.",required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"symbol",desc:'Name of the file in the GitHub repository containing the data. The ".csv" file extension must not be included.',required:!0,allowedTypeIDs:["simple string","input string","const string"],displayType:"simple string"},{name:"expression",desc:"An expression to be calculated and returned from the requested symbol's context. It can be a built-in variable like [close](#var_close), an expression such as `ta.sma(close, 100)`, a non-mutable variable previously calculated in the script, a function call that does not use Pine Script® drawings, an array, a matrix, or a tuple. Mutable variables are not allowed, unless they are enclosed in the body of a function used in the expression.",required:!0,allowedTypeIDs:[],displayType:"<arg_expr_type>"},{name:"ignore_invalid_symbol",desc:"Determines the behavior of the function if the specified symbol is not found: if [false](#var_false), the script will halt and throw a runtime error; if [true](#var_true), the function will return [na](#var_na) and execution will continue. Optional. The default is [false](#var_false).",allowedTypeIDs:["input bool","const bool"],displayType:"input bool"}],returns:["Requested series or tuple of series, which may include array/matrix IDs."],examples:["//@version=5",'indicator("BTC Development Activity")',"",'[devAct, devActSMA] = request.seed("seed_crypto_santiment", "BTC_DEV_ACTIVITY", [close, ta.sma(close, 10)])',"",'plot(devAct, "BTC Development Activity")','plot(devActSMA, "BTC Development Activity SMA10", color = color.yellow)'],syntax:["request.seed(source, symbol, expression, ignore_invalid_symbol) → series <type>"]},{name:"table.new",desc:["The function creates a new table."],args:[{name:"position",desc:"Position of the table. Possible values are: [position.top_left](#var_position.top_left), [position.top_center](#var_position.top_center), [position.top_right](#var_position.top_right), [position.middle_left](#var_position.middle_left), [position.middle_center](#var_position.middle_center), [position.middle_right](#var_position.middle_right), [position.bottom_left](#var_position.bottom_left), [position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"columns",desc:"The number of columns in the table.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"rows",desc:"The number of rows in the table.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bgcolor",desc:"The background color of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"frame_color",desc:"The color of the outer frame of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"frame_width",desc:"The width of the outer frame of the table. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"border_color",desc:"The color of the borders of the cells (excluding the outer frame). Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"border_width",desc:"The width of the borders of the cells (excluding the outer frame). Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("table.new example")',"var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)","if barstate.islast",' table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + str.tostring(open))',' table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + str.tostring(close), bgcolor=color.teal)'],returns:["The ID of a table object that can be passed to other table.*() functions."],remarks:["This function creates the table object itself, but the table will not be displayed until its cells are populated. To define a cell and change its contents or attributes, use [table.cell](#fun_table.cell) and other table.cell_*() functions.","One [table.new](#fun_table.new) call can only display one table (the last one drawn), but the function itself will be recalculated on each bar it is used on. For performance reasons, it is wise to use [table.new](#fun_table.new) in conjunction with either the [var](#op_var) keyword (so the table object is only created on the first bar) or in an [if](#op_if) [barstate.islast](#var_barstate.islast) block (so the table object is only created on the last bar)."],seeAlso:["[table.cell](#fun_table.cell)","[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.new(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width) → series table"],returnedTypes:["series table"]},{name:"table.delete",desc:["The function deletes a table."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"}],examples:["//@version=5",'indicator("table.delete example")',"var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)","if barstate.islast",' table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + str.tostring(open))',' table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + str.tostring(close), bgcolor=color.teal)',"if barstate.isrealtime"," table.delete(testTable)"],seeAlso:["[table.new](#fun_table.new)","[table.clear](#fun_table.clear)"],syntax:["table.delete(table_id) → void"],returnedTypes:["void"]},{name:"table.set_position",desc:["The function sets the position of a table."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"position",desc:"Position of the table. Possible values are: [position.top_left](#var_position.top_left), [position.top_center](#var_position.top_center), [position.top_right](#var_position.top_right), [position.middle_left](#var_position.middle_left), [position.middle_center](#var_position.middle_center), [position.middle_right](#var_position.middle_right), [position.bottom_left](#var_position.bottom_left), [position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)"],syntax:["table.set_position(table_id, position) → void"],returnedTypes:["void"]},{name:"table.set_bgcolor",desc:["The function sets the background color of a table."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"bgcolor",desc:"The background color of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_bgcolor(table_id, bgcolor) → void"],returnedTypes:["void"]},{name:"table.set_frame_color",desc:["The function sets the color of the outer frame of a table."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"frame_color",desc:"The color of the frame of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_frame_color(table_id, frame_color) → void"],returnedTypes:["void"]},{name:"table.set_border_color",desc:["The function sets the color of the borders (excluding the outer frame) of the table's cells."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"border_color",desc:"The color of the borders. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_border_color(table_id, border_color) → void"],returnedTypes:["void"]},{name:"table.set_frame_width",desc:["The function set the width of the outer frame of a table."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"frame_width",desc:"The width of the outer frame of the table. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_frame_width(table_id, frame_width) → void"],returnedTypes:["void"]},{name:"table.set_border_width",desc:["The function sets the width of the borders (excluding the outer frame) of the table's cells."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"border_width",desc:"The width of the borders. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_border_width(table_id, border_width) → void"],returnedTypes:["void"]},{name:"table.cell",desc:["The function defines a cell in the table and sets its attributes."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"The text to be displayed inside the cell. Optional. The default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"width",desc:"The width of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the width based on the text inside the cell. Value 0 has the same effect.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"height",desc:"The height of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the height based on the text inside of the cell. Value 0 has the same effect.",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"},{name:"text_color",desc:"The color of the text. Optional. The default is [color.black](#var_color.black).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text_halign",desc:"The horizontal alignment of the cell's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_valign",desc:"The vertical alignment of the cell's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_size",desc:"The size of the text. An optional parameter, the default value is [size.normal](#var_size.normal). Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"bgcolor",desc:"The background color of the text. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"tooltip",desc:"The tooltip to be displayed inside the cell. Optional.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],remarks:["This function does not create the table itself, but defines the table’s cells. To use it, you first need to create a table object with [table.new](#fun_table.new).","Each [table.cell](#fun_table.cell) call overwrites all previously defined properties of a cell. If you call [table.cell](#fun_table.cell) twice in a row, e.g., the first time with text='Test Text', and the second time with text_color=[color.red](#var_color.red) but without a new text argument, the default value of the 'text' being an empty string, it will overwrite 'Test Text', and your cell will display an empty string. If you want, instead, to modify any of the cell's properties, use the table.cell_set_*() functions.","A single script can only display one table in each of the possible locations. If [table.cell](#fun_table.cell) is used on several bars to change the same attribute of a cell (e.g. change the background color of the cell to red on the first bar, then to yellow on the second bar), only the last change will be reflected in the table, i.e., the cell’s background will be yellow. Avoid unnecessary setting of cell properties by enclosing function calls in an [if](#op_if) [barstate.islast](#var_barstate.islast) block whenever possible, to restrict their execution to the last bar of the series."],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell(table_id, column, row, text, width, height, text_color, text_halign, text_valign, text_size, bgcolor, tooltip, text_font_family) → void"],returnedTypes:["void"]},{name:"table.cell_set_text",desc:["The function sets the text in the specified cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"The text to be displayed inside the cell.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("TABLE example")',"var tLog = table.new(position = position.top_left, rows = 1, columns = 2, bgcolor = color.yellow, border_width=1)",'table.cell(tLog, row = 0, column = 0, text = "sometext", text_color = color.blue)','table.cell_set_text(tLog, row = 0, column = 0, text = "sometext")'],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text(table_id, column, row, text) → void"],returnedTypes:["void"]},{name:"table.cell_set_text_font_family",desc:["The function sets the font family of the text inside the cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the table cell font")',"var t = table.new(position.top_left, rows = 1, columns = 1)",'table.cell(t, 0, 0, "monospace", text_color = color.blue)',"table.cell_set_text_font_family(t, 0, 0, font.family_monospace)"],seeAlso:["[table.new](#fun_table.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["table.cell_set_text_font_family(table_id, column, row, text_font_family) → void"],returnedTypes:["void"]},{name:"table.cell_set_tooltip",desc:["The function sets the tooltip in the specified cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"tooltip",desc:"The tooltip to be displayed inside the cell.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("TABLE example")',"var tLog = table.new(position = position.top_left, rows = 1, columns = 2, bgcolor = color.yellow, border_width=1)",'table.cell(tLog, row = 0, column = 0, text = "sometext", text_color = color.blue)','table.cell_set_tooltip(tLog, row = 0, column = 0, tooltip = "sometext")'],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_text](#fun_table.cell_set_text)"],syntax:["table.cell_set_tooltip(table_id, column, row, tooltip) → void"],returnedTypes:["void"]},{name:"table.cell_set_width",desc:["The function sets the width of the cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"width",desc:"The width of the cell as a % of the chart window. Passing 0 auto-adjusts the width based on the text inside of the cell.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_width(table_id, column, row, width) → void"],returnedTypes:["void"]},{name:"table.cell_set_height",desc:["The function sets the height of cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"height",desc:"The height of the cell as a % of the chart window. Passing 0 auto-adjusts the height based on the text inside of the cell.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_height(table_id, column, row, height) → void"],returnedTypes:["void"]},{name:"table.cell_set_text_color",desc:["The function sets the color of the text inside the cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_color",desc:"The color of the text.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_color(table_id, column, row, text_color) → void"],returnedTypes:["void"]},{name:"table.cell_set_text_halign",desc:["The function sets the horizontal alignment of the cell's text."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_halign",desc:"The horizontal alignment of a cell's text. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_halign(table_id, column, row, text_halign) → void"],returnedTypes:["void"]},{name:"table.cell_set_text_valign",desc:["The function sets the vertical alignment of a cell's text."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_valign",desc:"The vertical alignment of the cell's text. Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_valign(table_id, column, row, text_valign) → void"],returnedTypes:["void"]},{name:"table.cell_set_text_size",desc:["The function sets the size of the cell's text."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_size",desc:"The size of the text. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_size(table_id, column, row, text_size) → void"],returnedTypes:["void"]},{name:"table.cell_set_bgcolor",desc:["The function sets the background color of the cell."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bgcolor",desc:"The background color of the cell.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_bgcolor(table_id, column, row, bgcolor) → void"],returnedTypes:["void"]},{name:"table.clear",desc:["The function removes a cell or a sequence of cells from the table. The cells are removed in a rectangle shape where the start_column and start_row specify the top-left corner, and end_column and end_row specify the bottom-right corner."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"start_column",desc:"The index of the column of the first cell to delete. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"start_row",desc:"The index of the row of the first cell to delete. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_column",desc:"The index of the column of the last cell to delete. Optional. The default is the argument used for start_column. Numbering starts at 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_row",desc:"The index of the row of the last cell to delete. Optional. The default is the argument used for start_row. Numbering starts at 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("A donut", overlay=true)',"if barstate.islast"," colNum = 8, rowNum = 8",' padding = "◯"'," donutTable = table.new(position.middle_right, colNum, rowNum)"," for c = 0 to colNum - 1"," for r = 0 to rowNum - 1"," table.cell(donutTable, c, r, text=padding, bgcolor=#face6e, text_color=color.new(color.black, 100))"," table.clear(donutTable, 2, 2, 5, 5)"],seeAlso:["[table.delete](#fun_table.delete)","[table.new](#fun_table.new)"],syntax:["table.clear(table_id, start_column, start_row, end_column, end_row) → void"],returnedTypes:["void"]},{name:"matrix.new<type>",desc:['The function 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>").'],syntax:["matrix.new<type>(rows, columns, initial_value) → matrix<type>"],args:[{name:"rows",desc:"Initial row count of the matrix. Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"columns",desc:"Initial column count of the matrix. Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"initial_value",desc:"Initial value of all matrix elements. Optional. The default is 'na'.",allowedTypeIDs:[],displayType:"<matrix_type>"}],detailedDesc:[{desc:["Create a matrix of elements with the same initial value"],examples:["//@version=5",'indicator("`matrix.new<type>()` Example 1")',"",'// Create a 2x3 (2 rows x 3 columns) "int" matrix with values zero.',"var m = matrix.new<int>(2, 3, 0)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"]},{desc:["Create a matrix from array values"],examples:["//@version=5",'indicator("`matrix.new<type>()` Example 2")',"","// Function to create a matrix whose rows are filled with array values.","matrixFromArray(int rows, int columns, array<float> data) =>"," m = matrix.new<float>(rows, columns)"," for i = 0 to rows <= 0 ? na : rows - 1"," for j = 0 to columns <= 0 ? na : columns - 1"," matrix.set(m, i, j, array.get(data, i * columns + j))"," m"," ","// Create a 3x3 matrix from an array of values.","var m1 = matrixFromArray(3, 3, array.from(1, 2, 3, 4, 5, 6, 7, 8, 9))","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m1))"]},{desc:["Create a matrix from an `input.text_area()` field"],examples:["//@version=5",'indicator("`matrix.new<type>()` Example 3")',"","// Function to create a matrix from a text string.","// Values in a row must be separated by a space. Each line is one row.","matrixFromInputArea(stringOfValues) =>",' var rowsArray = str.split(stringOfValues, "\\n")'," var rows = array.size(rowsArray)",' var cols = array.size(str.split(array.get(rowsArray, 0), " "))'," var matrix = matrix.new<float>(rows, cols, na) "," row = 0"," for rowString in rowsArray"," col = 0",' values = str.split(rowString, " ")'," for val in values"," matrix.set(matrix, row, col, str.tonumber(val))"," col += 1"," row += 1"," matrix","","",'stringInput = input.text_area("1 2 3\\n4 5 6\\n7 8 9")',"var m = matrixFromInputArea(stringInput) ","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"]},{desc:["Create matrix from random values"],examples:["//@version=5",'indicator("`matrix.new<type>()` Example 4")',"","// Function to create a matrix with random values (0.0 to 1.0).","matrixRandom(int rows, int columns)=>"," result = matrix.new<float>(rows, columns)"," for i = 0 to rows - 1"," for j = 0 to columns - 1"," matrix.set(result, i, j, math.random())"," result","","// Create a 2x3 matrix with random values.","var m = matrixRandom(2, 3)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"]}],returns:["The ID of the new matrix object."],seeAlso:["[matrix.set](#fun_matrix.set)","[matrix.fill](#fun_matrix.fill)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[array.new<type>](#fun_array.new<type>)"],template:!0},{name:"matrix.row",desc:["The function creates a one-dimensional array from the elements of a matrix row."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"Index of the required row.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.row()` Example", "", true)',"",'// Create a 2x3 "float" matrix from `hlc3` values.',"m = matrix.new<float>(2, 3, hlc3)","","// Return an array with the values of the first row of the matrix.","a = matrix.row(m, 0)","","// Plot the first value from the array `a`.","plot(array.get(a, 0))"],returns:["An array ID containing the `row` values of the `id` matrix."],remarks:["Indexing of rows starts at 0."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[array.get](#fun_array.get)","[matrix.col](#fun_matrix.col)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.row(id, row) → type[]"],returnedTypes:["array<>"]},{name:"matrix.col",desc:["The function creates a one-dimensional array from the elements of a matrix column."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"column",desc:"Index of the required column.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.col()` Example", "", true)',"",'// Create a 2x3 "float" matrix from `hlc3` values.',"m = matrix.new<float>(2, 3, hlc3)","","// Return an array with the values of the first column of matrix `m`.","a = matrix.col(m, 0)","","// Plot the first value from the array `a`.","plot(array.get(a, 0))"],returns:["An array ID containing the `column` values of the `id` matrix."],remarks:["Indexing of rows starts at 0."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[array.get](#fun_array.get)","[matrix.col](#fun_matrix.col)","[matrix.columns](#fun_matrix.columns)"],syntax:["matrix.col(id, column) → type[]"],returnedTypes:["array<>"]},{name:"matrix.reshape",desc:["The function rebuilds the `id` matrix to `rows` x `cols` dimensions."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"rows",desc:"The number of rows of the reshaped matrix.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"columns",desc:"The number of columns of the reshaped matrix.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.reshape()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix."," var m1 = matrix.new<float>(2, 3)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 0, 2, 3)"," matrix.set(m1, 1, 0, 4)"," matrix.set(m1, 1, 1, 5)"," matrix.set(m1, 1, 2, 6)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Reshape the copy to a 3x2."," matrix.reshape(m2, 3, 2)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Reshaped matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.add_row](#fun_matrix.add_row)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.reshape(id, rows, columns) → void"],returnedTypes:["void"]},{name:"matrix.get",desc:["The function returns the element with the specified index of the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"Index of the required row.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column",desc:"Index of the required column.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.get()` Example", "", true)',"",'// Create a 2x3 "float" matrix from the `hl2` values.',"m = matrix.new<float>(2, 3, hl2)","","// Return the value of the element at index [0, 0] of matrix `m`.","x = matrix.get(m, 0, 0)","","plot(x)"],returns:["The value of the element at the `row` and `column` index of the `id` matrix."],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.get(id, row, column) → <matrix_type>"],returnedTypes:[]},{name:"matrix.set",desc:["The function assigns `value` to the element at the `row` and `column` of the `id` matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"The row index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column",desc:"The column index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The new value to be set.",required:!0,allowedTypeIDs:[],displayType:"series <type of the matrix's elements>"}],examples:["//@version=5",'indicator("`matrix.set()` Example")',"",'// Create a 2x3 "int" matrix containing values `4`.',"m = matrix.new<int>(2, 3, 4)","","// Replace the value of element at row 1 and column 2 with value `3`.","matrix.set(m, 0, 1, 3)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.set(id, row, column, value) → void"],returnedTypes:["void"]},{name:"matrix.add_row",desc:["The function adds a row at the `row` index of the `id` matrix. The row can consist of `na` values, or an array can be used to provide values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"The index of the row after which the new row will be inserted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:["Adding a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a row with `na` values to the matrix.","matrix.add_row(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `2`."," var a = array.from(1, 2)"," "," // Add the `a` array as the first row of the empty matrix."," matrix.add_row(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Indexing of rows and columns starts at zero. Rather than add rows to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.add_row(id, row) → void"],returnedTypes:["void"]},{name:"matrix.add_row",desc:["The function adds a row at the `row` index of the `id` matrix. The row can consist of `na` values, or an array can be used to provide values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"The index of the row after which the new row will be inserted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"array_id",desc:"An array to be inserted. Optional.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],detailedDesc:[{desc:["Adding a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a row with `na` values to the matrix.","matrix.add_row(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `2`."," var a = array.from(1, 2)"," "," // Add the `a` array as the first row of the empty matrix."," matrix.add_row(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Indexing of rows and columns starts at zero. Rather than add rows to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.add_row(id, row, array_id) → void"],returnedTypes:["void"]},{name:"matrix.add_col",desc:["The function adds a column at the `column` index of the `id` matrix. The column can consist of `na` values, or an array can be used to provide values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"column",desc:"The index of the column after which the new column will be inserted. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:["Adding a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a column with `na` values to the matrix.","matrix.add_col(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `3`."," var a = array.from(1, 3)"," "," // Add the `a` array as the first column of the empty matrix."," matrix.add_col(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Rather than add columns to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values. Adding a column is also much slower than adding a row with the [matrix.add_row](#fun_matrix.add_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_row](#fun_matrix.add_row)"],syntax:["matrix.add_col(id, column) → void"],returnedTypes:["void"]},{name:"matrix.add_col",desc:["The function adds a column at the `column` index of the `id` matrix. The column can consist of `na` values, or an array can be used to provide values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"column",desc:"The index of the column after which the new column will be inserted. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"array_id",desc:"An array to be inserted. Optional.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],detailedDesc:[{desc:["Adding a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a column with `na` values to the matrix.","matrix.add_col(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `3`."," var a = array.from(1, 3)"," "," // Add the `a` array as the first column of the empty matrix."," matrix.add_col(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Rather than add columns to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values. Adding a column is also much slower than adding a row with the [matrix.add_row](#fun_matrix.add_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_row](#fun_matrix.add_row)"],syntax:["matrix.add_col(id, column, array_id) → void"],returnedTypes:["void"]},{name:"matrix.remove_row",desc:["The function removes the row at `row` index of the `id` matrix and returns an array containing the removed row's values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row",desc:"The index of the row to be deleted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("matrix_remove_row", overlay = true)',"",'// Create a 2x2 "int" matrix containing values `1`.',"var matrixOrig = matrix.new<int>(2, 2, 1)","","// Set values to the 'matrixOrig' matrix.","matrix.set(matrixOrig, 0, 1, 2)","matrix.set(matrixOrig, 1, 0, 3)","matrix.set(matrixOrig, 1, 1, 4)","","// Create a copy of the 'matrixOrig' matrix.","matrixCopy = matrix.copy(matrixOrig)","","// Remove the first row from the matrix `matrixCopy`.","arr = matrix.remove_row(matrixCopy, 0)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 3, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(matrixOrig))",' table.cell(t, 1, 0, "Removed Elements:")'," table.cell(t, 1, 1, str.tostring(arr))",' table.cell(t, 2, 0, "Result Matrix:")'," table.cell(t, 2, 1, str.tostring(matrixCopy))"],returns:["An array containing the elements of the row removed from the `id` matrix."],remarks:["Indexing of rows and columns starts at zero. It is far more efficient to declare matrices with explicit dimensions than to build them by adding or removing rows."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.copy](#fun_matrix.copy)","[matrix.remove_col](#fun_matrix.remove_col)"],syntax:["matrix.remove_row(id, row) → type[]"],returnedTypes:["array<>"]},{name:"matrix.remove_col",desc:["The function removes the column at `column` index of the `id` matrix and returns an array containing the removed column's values."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"column",desc:"The index of the column to be removed. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("matrix_remove_col", overlay = true)',"","// Create a 2x2 matrix with ones.","var matrixOrig = matrix.new<int>(2, 2, 1)","","// Set values to the 'matrixOrig' matrix.","matrix.set(matrixOrig, 0, 1, 2)","matrix.set(matrixOrig, 1, 0, 3)","matrix.set(matrixOrig, 1, 1, 4)","","","// Create a copy of the 'matrixOrig' matrix.","matrixCopy = matrix.copy(matrixOrig)","","// Remove the first column from the `matrixCopy` matrix.","arr = matrix.remove_col(matrixCopy, 0)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 3, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(matrixOrig))",' table.cell(t, 1, 0, "Removed Elements:")'," table.cell(t, 1, 1, str.tostring(arr))",' table.cell(t, 2, 0, "Result Matrix:")'," table.cell(t, 2, 1, str.tostring(matrixCopy))"],returns:["An array containing the elements of the column removed from the `id` matrix."],remarks:["Indexing of rows and columns starts at zero. It is far more efficient to declare matrices with explicit dimensions than to build them by adding or removing columns. Deleting a column is also much slower than deleting a row with the [matrix.remove_row](#fun_matrix.remove_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.copy](#fun_matrix.copy)","[matrix.remove_row](#fun_matrix.remove_row)"],syntax:["matrix.remove_col(id, column) → type[]"],returnedTypes:["array<>"]},{name:"matrix.fill",desc:["The function fills a rectangular area of the `id` matrix defined by the indices `from_column` to `to_column` (not including it) and `from_row` to `to_row`(not including it) with the `value`."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"value",desc:"The value to fill with.",required:!0,allowedTypeIDs:[],displayType:"series <type of the matrix's elements>"},{name:"from_row",desc:"Row index from which the fill will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_row",desc:"Row index where the fill will end (not inclusive). Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"from_column",desc:"Column index from which the fill will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_column",desc:"Column index where the fill will end (non inclusive). Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.fill()` Example")',"",'// Create a 4x5 "int" matrix containing values `0`.',"m = matrix.new<float>(4, 5, 0)","","// Fill the intersection of rows 1 to 2 and columns 2 to 3 of the matrix with `hl2` values.","matrix.fill(m, hl2, 0, 2, 1, 3)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.fill(id, value, from_row, to_row, from_column, to_column) → void"],returnedTypes:["void"]},{name:"matrix.submatrix",desc:["The function extracts a submatrix of the `id` matrix within the specified indices."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"from_row",desc:"Index of the row from which the extraction will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_row",desc:"Index of the row where the extraction will end (non inclusive). Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"from_column",desc:"Index of the column from which the extraction will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_column",desc:"Index of the column where the extraction will end (non inclusive). Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.submatrix()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix matrix with values `0`."," var m1 = matrix.new<int>(2, 3, 0)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 0, 2, 3)"," matrix.set(m1, 1, 0, 4)"," matrix.set(m1, 1, 1, 5)"," matrix.set(m1, 1, 2, 6)"," "," // Create a 2x2 submatrix of the `m1` matrix."," var m2 = matrix.submatrix(m1, 0, 2, 1, 3)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Submatrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix object containing the submatrix of the `id` matrix defined by the `from_row`, `to_row`, `from_column` and `to_column` indices."],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.row](#fun_matrix.row)","[matrix.col](#fun_matrix.col)","[matrix.reshape](#fun_matrix.reshape)"],syntax:["matrix.submatrix(id, from_row, to_row, from_column, to_column) → matrix<type>"],returnedTypes:["matrix<>"]},{name:"matrix.copy",desc:["The function creates a new matrix which is a copy of the original."],args:[{name:"id",desc:"A matrix object to copy.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.copy()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory",' // Create a 2x3 "float" matrix with `1` values.'," var m1 = matrix.new<float>(2, 3, 1)"," "," // Copy the matrix to a new one."," // Note that unlike what `matrix.copy()` does, "," // the simple assignment operation `m2 = m1`"," // would NOT create a new copy of the `m1` matrix."," // It would merely create a copy of its ID referencing the same matrix."," var m2 = matrix.copy(m1)"," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix object of the copied `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.copy(id) → matrix<type>"],returnedTypes:["matrix<>"]},{name:"matrix.columns",desc:["The function returns the number of columns in the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.columns()` Example")',"","// Create a 2x6 matrix with values `0`.","var m = matrix.new<int>(2, 6, 0)","","// Get the quantity of columns in matrix `m`.","var x = matrix.columns(m)","","// Display using a label.","if barstate.islastconfirmedhistory",' label.new(bar_index, high, "Columns: " + str.tostring(x) + "\\n" + str.tostring(m))'],returns:["The number of columns in the matrix `id`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.col](#fun_matrix.col)","[matrix.row](#fun_matrix.row)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.columns(id) → series int"],returnedTypes:["series int"]},{name:"matrix.rows",desc:["The function returns the number of rows in the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.rows()` Example")',"","// Create a 2x6 matrix with values `0`.","var m = matrix.new<int>(2, 6, 0)","","// Get the quantity of rows in the matrix.","var x = matrix.rows(m)","","// Display using a label.","if barstate.islastconfirmedhistory",' label.new(bar_index, high, "Rows: " + str.tostring(x) + "\\n" + str.tostring(m))'],returns:["The number of rows in the matrix `id`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.row](#fun_matrix.row)"],syntax:["matrix.rows(id) → series int"],returnedTypes:["series int"]},{name:"matrix.elements_count",desc:["The function returns the total number of all matrix elements."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.elements_count(id) → series int"],returnedTypes:["series int"]},{name:"matrix.concat",desc:["The function appends the `m2` matrix to the `m1` matrix."],args:[{name:"id1",desc:"Matrix object to concatenate into.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"id2",desc:"Matrix object whose elements will be appended to `id1`.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.concat()` Example")',"",'// Create a 2x4 "int" matrix containing values `0`.',"m1 = matrix.new<int>(2, 4, 0)",'// Create a 2x4 "int" matrix containing values `1`.',"m2 = matrix.new<int>(2, 4, 1)","","// Append matrix `m2` to `m1`.","matrix.concat(m1, m2)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))"],returns:["Returns the `id1` matrix concatenated with the `id2` matrix."],remarks:["The number of columns in both matrices must be identical."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.concat(id1, id2) → matrix<type>"],returnedTypes:["matrix<>"]},{name:"matrix.swap_rows",desc:["The function swaps the rows at the index `row1` and `row2` in the `id` matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"row1",desc:"Index of the first row to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row2",desc:"Index of the second row to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.swap_rows()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 3x2 matrix with ‘na’ values."," var m1 = matrix.new<int>(3, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," matrix.set(m1, 2, 0, 5)"," matrix.set(m1, 2, 1, 6)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Swap the first and second rows of the matrix copy."," matrix.swap_rows(m2, 0, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Swapped rows in copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.swap_columns](#fun_matrix.swap_columns)"],syntax:["matrix.swap_rows(id, row1, row2) → void"],returnedTypes:["void"]},{name:"matrix.swap_columns",desc:["The function swaps the columns at the index `column1` and `column2` in the `id` matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"},{name:"column1",desc:"Index of the first column to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column2",desc:"Index of the second column to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.swap_columns()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix with ‘na’ values."," var m1 = matrix.new<int>(2, 2, na) "," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Swap the first and second columns of the matrix copy."," matrix.swap_columns(m2, 0, 1)",""," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Swapped columns in copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.swap_columns(id, column1, column2) → void"],returnedTypes:["void"]},{name:"matrix.reverse",desc:["The function reverses the order of rows and columns in the matrix `id`. The first row and first column become the last, and the last become the first."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.reverse()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Copy the matrix to a new one."," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Copy matrix elements to a new matrix."," var m2 = matrix.copy(m1)"," "," // Reverse the `m2` copy of the original matrix. "," matrix.reverse(m2)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Reversed matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.reshape](#fun_matrix.reshape)"],syntax:["matrix.reverse(id) → void"],returnedTypes:["void"]},{name:"matrix.sort",desc:["The function rearranges the rows in the `id` matrix following the sorted order of the values in the `column`."],args:[{name:"id",desc:"A matrix object to be sorted.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"column",desc:"Index of the column whose sorted values determine the new order of rows. Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"order",desc:"The sort order. Possible values: [order.ascending](#var_order.ascending) (default), [order.descending](#var_order.descending).",allowedTypeIDs:["simple sort_order","input sort_order","const sort_order"],displayType:"simple sort_order"}],examples:["//@version=5",'indicator("`matrix.sort()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<float>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 3)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 1)"," matrix.set(m1, 1, 1, 2)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," // Sort the rows of `m2` using the default arguments (first column and ascending order)."," matrix.sort(m2)"," "," // Display using a table."," if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Sorted matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.sort(id, column, order) → void"],returnedTypes:["void"]},{name:"matrix.det",desc:["The function returns the [determinant](https://en.wikipedia.org/wiki/Determinant) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.det` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<float>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 3)","matrix.set(m, 0, 1, 7)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, -4)","","// Get the determinant of the matrix. ","var x = matrix.det(m)","","plot(x, 'Matrix determinant')"],returns:["The determinant value of the `id` matrix."],remarks:["Function calculation based on the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.det(id) → series float"],returnedTypes:["series float"]},{name:"matrix.det",desc:["The function returns the [determinant](https://en.wikipedia.org/wiki/Determinant) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.det` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<float>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 3)","matrix.set(m, 0, 1, 7)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, -4)","","// Get the determinant of the matrix. ","var x = matrix.det(m)","","plot(x, 'Matrix determinant')"],returns:["The determinant value of the `id` matrix."],remarks:["Function calculation based on the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.det(id) → series int"],returnedTypes:["series int"]},{name:"matrix.min",desc:["The function returns the smallest value from the matrix elements."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.min()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the minimum value from the matrix.","var x = matrix.min(m)","","plot(x, 'Matrix minimum value')"],returns:["The smallest value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.min(id) → series float"],returnedTypes:["series float"]},{name:"matrix.min",desc:["The function returns the smallest value from the matrix elements."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.min()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the minimum value from the matrix.","var x = matrix.min(m)","","plot(x, 'Matrix minimum value')"],returns:["The smallest value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.min(id) → series int"],returnedTypes:["series int"]},{name:"matrix.max",desc:["The function returns the largest value from the matrix elements."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.max()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the maximum value in the matrix.","var x = matrix.max(m)","","plot(x, 'Matrix maximum value')"],returns:["The maximum value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.max(id) → series float"],returnedTypes:["series float"]},{name:"matrix.max",desc:["The function returns the largest value from the matrix elements."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.max()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the maximum value in the matrix.","var x = matrix.max(m)","","plot(x, 'Matrix maximum value')"],returns:["The maximum value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.max(id) → series int"],returnedTypes:["series int"]},{name:"matrix.avg",desc:["The function calculates the average of all elements in the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.avg()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the average value of the matrix.","var x = matrix.avg(m)","","plot(x, 'Matrix average value')"],returns:["The average value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.avg(id) → series float"],returnedTypes:["series float"]},{name:"matrix.avg",desc:["The function calculates the average of all elements in the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.avg()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the average value of the matrix.","var x = matrix.avg(m)","","plot(x, 'Matrix average value')"],returns:["The average value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.avg(id) → series int"],returnedTypes:["series int"]},{name:"matrix.median",desc:['The function calculates the [median](https://en.wikipedia.org/wiki/Median) ("the middle" value) of matrix elements.'],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.median()` Example")',"","// Create a 2x2 matrix.","m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the median of the matrix.","x = matrix.median(m)","","plot(x, 'Median of the matrix')"],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the median."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mode](#fun_matrix.mode)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.median(id) → series float"],returnedTypes:["series float"]},{name:"matrix.median",desc:['The function calculates the [median](https://en.wikipedia.org/wiki/Median) ("the middle" value) of matrix elements.'],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.median()` Example")',"","// Create a 2x2 matrix.","m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the median of the matrix.","x = matrix.median(m)","","plot(x, 'Median of the matrix')"],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the median."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mode](#fun_matrix.mode)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.median(id) → series int"],returnedTypes:["series int"]},{name:"matrix.mode",desc:["The function calculates the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) 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."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.mode()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 0)","matrix.set(m, 0, 1, 0)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, 1)","","// Get the mode of the matrix.","var x = matrix.mode(m)","","plot(x, 'Mode of the matrix')"],returns:["The most frequently occurring value from the `id` matrix. If none exists, returns the smallest value instead."],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the mode."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.median](#fun_matrix.median)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.mode(id) → series float"],returnedTypes:["series float"]},{name:"matrix.mode",desc:["The function calculates the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) 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."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.mode()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 0)","matrix.set(m, 0, 1, 0)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, 1)","","// Get the mode of the matrix.","var x = matrix.mode(m)","","plot(x, 'Mode of the matrix')"],returns:["The most frequently occurring value from the `id` matrix. If none exists, returns the smallest value instead."],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the mode."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.median](#fun_matrix.median)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.mode(id) → series int"],returnedTypes:["series int"]},{name:"matrix.transpose",desc:["The function creates a new, [transposed](https://en.wikipedia.org/wiki/Transpose#Transpose_of_a_matrix) version of the `id`. This interchanges the row and column index of each element."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.transpose()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<float>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Create a transpose of the matrix."," var m2 = matrix.transpose(m1)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Transposed matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the transposed version of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.reshape](#fun_matrix.reshape)","[matrix.reverse](#fun_matrix.reverse)"],syntax:["matrix.transpose(id) → matrix<type>"],returnedTypes:["matrix<>"]},{name:"matrix.sum",desc:["The function returns a new matrix resulting from the [sum](https://en.wikipedia.org/wiki/Matrix_addition) of two matrices `id1` and `id2`, or of an `id1` matrix and an `id2` scalar (a numerical value)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"id2",desc:"Second matrix object, or scalar value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Sum of two matrices"],examples:["//@version=5",'indicator("`matrix.sum()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix that sums matrices `m1` and `m2`."," var m3 = matrix.sum(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Sum of a matrix and scalar"],examples:["//@version=5",'indicator("`matrix.sum()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the sum of the `m1` matrix with the "int" value `1`.'," var m2 = matrix.sum(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the sum of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.sum(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.sum",desc:["The function returns a new matrix resulting from the [sum](https://en.wikipedia.org/wiki/Matrix_addition) of two matrices `id1` and `id2`, or of an `id1` matrix and an `id2` scalar (a numerical value)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"id2",desc:"Second matrix object, or scalar value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Sum of two matrices"],examples:["//@version=5",'indicator("`matrix.sum()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix that sums matrices `m1` and `m2`."," var m3 = matrix.sum(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Sum of a matrix and scalar"],examples:["//@version=5",'indicator("`matrix.sum()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the sum of the `m1` matrix with the "int" value `1`.'," var m2 = matrix.sum(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the sum of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.sum(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.diff",desc:["The function returns a new matrix resulting from the subtraction between matrices `id1` and `id2`, or of matrix `id1` and an `id2` scalar (a numerical value)."],args:[{name:"id1",desc:"Matrix to subtract from.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"id2",desc:"Matrix object or a scalar value to be subtracted.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Difference between two matrices"],examples:["//@version=5",'indicator("`matrix.diff()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix containing the difference between matrices `m1` and `m2`."," var m3 = matrix.diff(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Difference between a matrix and a scalar value"],examples:["//@version=5",'indicator("`matrix.diff()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the difference between the `m1` matrix and the "int" value `1`.'," var m2 = matrix.diff(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the difference between `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.diff(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.diff",desc:["The function returns a new matrix resulting from the subtraction between matrices `id1` and `id2`, or of matrix `id1` and an `id2` scalar (a numerical value)."],args:[{name:"id1",desc:"Matrix to subtract from.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"id2",desc:"Matrix object or a scalar value to be subtracted.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Difference between two matrices"],examples:["//@version=5",'indicator("`matrix.diff()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix containing the difference between matrices `m1` and `m2`."," var m3 = matrix.diff(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Difference between a matrix and a scalar value"],examples:["//@version=5",'indicator("`matrix.diff()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the difference between the `m1` matrix and the "int" value `1`.'," var m2 = matrix.diff(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the difference between `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.diff(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → int[]"],returnedTypes:["int[]"]},{name:"matrix.mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → float[]"],returnedTypes:["float[]"]},{name:"matrix.pinv",desc:["The function returns the [pseudoinverse](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse) of a matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.pinv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Pseudoinverse of the matrix."," var m2 = matrix.pinv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Pseudoinverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the pseudoinverse of the `id` matrix."],remarks:["The function is calculated using a [Moore–Penrose](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Definition) inverse formula based on singular-value decomposition of a matrix. For non-singular square matrices this function returns the result of [matrix.inv](#fun_matrix.inv)."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.inv](#fun_matrix.inv)"],syntax:["matrix.pinv(id) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.pinv",desc:["The function returns the [pseudoinverse](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse) of a matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.pinv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Pseudoinverse of the matrix."," var m2 = matrix.pinv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Pseudoinverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the pseudoinverse of the `id` matrix."],remarks:["The function is calculated using a [Moore–Penrose](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Definition) inverse formula based on singular-value decomposition of a matrix. For non-singular square matrices this function returns the result of [matrix.inv](#fun_matrix.inv)."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.inv](#fun_matrix.inv)"],syntax:["matrix.pinv(id) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.inv",desc:["The function returns the [inverse](https://en.wikipedia.org/wiki/Invertible_matrix) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.inv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Inverse of the matrix."," var m2 = matrix.inv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Inverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix, which is the inverse of the `id` matrix."],remarks:["The function is calculated using the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.pinv](#fun_matrix.pinv)","[matrix.copy](#fun_matrix.copy)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.inv(id) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.inv",desc:["The function returns the [inverse](https://en.wikipedia.org/wiki/Invertible_matrix) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.inv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Inverse of the matrix."," var m2 = matrix.inv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Inverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix, which is the inverse of the `id` matrix."],remarks:["The function is calculated using the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.pinv](#fun_matrix.pinv)","[matrix.copy](#fun_matrix.copy)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.inv(id) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.rank",desc:["The function calculates the [rank](https://en.wikipedia.org/wiki/Rank_(linear_algebra)) of the matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.rank()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the rank of the matrix. "," r = matrix.rank(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Rank of the matrix:")'," table.cell(t, 1, 1, str.tostring(r)) "],returns:["The rank of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.rank(id) → series int"],returnedTypes:["series int"]},{name:"matrix.trace",desc:["The function calculates the [trace](https://en.wikipedia.org/wiki/Trace_(linear_algebra)) of a matrix (the sum of the main diagonal's elements)."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.trace()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the trace of the matrix."," tr = matrix.trace(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Trace of the matrix:")'," table.cell(t, 1, 1, str.tostring(tr))"],returns:["The trace of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.trace(id) → series float"],returnedTypes:["series float"]},{name:"matrix.trace",desc:["The function calculates the [trace](https://en.wikipedia.org/wiki/Trace_(linear_algebra)) of a matrix (the sum of the main diagonal's elements)."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.trace()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the trace of the matrix."," tr = matrix.trace(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Trace of the matrix:")'," table.cell(t, 1, 1, str.tostring(tr))"],returns:["The trace of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.trace(id) → series int"],returnedTypes:["series int"]},{name:"matrix.eigenvalues",desc:["The function returns an array containing the [eigenvalues](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.eigenvalues()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvalues of the matrix."," tr = matrix.eigenvalues(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Array of Eigenvalues:")'," table.cell(t, 1, 1, str.tostring(tr)) "],returns:["An array containing the eigenvalues of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.eigenvectors](#fun_matrix.eigenvectors)"],syntax:["matrix.eigenvalues(id) → float[]"],returnedTypes:["float[]"]},{name:"matrix.eigenvalues",desc:["The function returns an array containing the [eigenvalues](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of a square matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.eigenvalues()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvalues of the matrix."," tr = matrix.eigenvalues(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Array of Eigenvalues:")'," table.cell(t, 1, 1, str.tostring(tr)) "],returns:["An array containing the eigenvalues of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.eigenvectors](#fun_matrix.eigenvectors)"],syntax:["matrix.eigenvalues(id) → int[]"],returnedTypes:["int[]"]},{name:"matrix.eigenvectors",desc:["Returns a matrix of [eigenvectors](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors), in which each column is an eigenvector of the `id` matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.eigenvectors()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix "," var m1 = matrix.new<int>(2, 2, 1)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvectors of the matrix."," m2 = matrix.eigenvectors(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Eigenvectors:")'," table.cell(t, 1, 1, str.tostring(m2)) "],returns:["A new matrix containing the eigenvectors of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.eigenvalues](#fun_matrix.eigenvalues)"],syntax:["matrix.eigenvectors(id) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.eigenvectors",desc:["Returns a matrix of [eigenvectors](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors), in which each column is an eigenvector of the `id` matrix."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.eigenvectors()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix "," var m1 = matrix.new<int>(2, 2, 1)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvectors of the matrix."," m2 = matrix.eigenvectors(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Eigenvectors:")'," table.cell(t, 1, 1, str.tostring(m2)) "],returns:["A new matrix containing the eigenvectors of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.eigenvalues](#fun_matrix.eigenvalues)"],syntax:["matrix.eigenvectors(id) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.kron",desc:["The function returns the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) for the `id1` and `id2` matrices."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"id2",desc:"Second matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.kron()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create two matrices with default values `1` and `2`. "," var m1 = matrix.new<float>(2, 2, 1) "," var m2 = matrix.new<float>(2, 2, 2) "," "," // Calculate the Kronecker product of the matrices."," var m3 = matrix.kron(m1, m2) "," "," // Display matrix elements."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "⊗")',' table.cell(t, 2, 0, "Matrix 2:")'," table.cell(t, 2, 1, str.tostring(m2))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Kronecker product:")'," table.cell(t, 4, 1, str.tostring(m3))"],returns:["A new matrix containing the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) of `id1` and `id2`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mult](#fun_matrix.mult)","[str.tostring](#fun_str.tostring)","[table.new](#fun_table.new)"],syntax:["matrix.kron(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.kron",desc:["The function returns the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) for the `id1` and `id2` matrices."],args:[{name:"id1",desc:"First matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"id2",desc:"Second matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.kron()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create two matrices with default values `1` and `2`. "," var m1 = matrix.new<float>(2, 2, 1) "," var m2 = matrix.new<float>(2, 2, 2) "," "," // Calculate the Kronecker product of the matrices."," var m3 = matrix.kron(m1, m2) "," "," // Display matrix elements."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "⊗")',' table.cell(t, 2, 0, "Matrix 2:")'," table.cell(t, 2, 1, str.tostring(m2))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Kronecker product:")'," table.cell(t, 4, 1, str.tostring(m3))"],returns:["A new matrix containing the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) of `id1` and `id2`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mult](#fun_matrix.mult)","[str.tostring](#fun_str.tostring)","[table.new](#fun_table.new)"],syntax:["matrix.kron(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.pow",desc:["The function calculates the product of the matrix by itself `power` times."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"},{name:"power",desc:"The number of times the matrix will be multiplied by itself.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.pow()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, 2)"," // Calculate the power of three of the matrix."," var m2 = matrix.pow(m1, 3)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix³:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["The product of the `id` matrix by itself `power` times."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.mult](#fun_matrix.mult)"],syntax:["matrix.pow(id, power) → matrix<float>"],returnedTypes:["matrix<float>"]},{name:"matrix.pow",desc:["The function calculates the product of the matrix by itself `power` times."],args:[{name:"id",desc:"A matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"},{name:"power",desc:"The number of times the matrix will be multiplied by itself.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.pow()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, 2)"," // Calculate the power of three of the matrix."," var m2 = matrix.pow(m1, 3)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix³:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["The product of the `id` matrix by itself `power` times."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.mult](#fun_matrix.mult)"],syntax:["matrix.pow(id, power) → matrix<int>"],returnedTypes:["matrix<int>"]},{name:"matrix.is_zero",desc:["The function determines if all elements of the matrix are zero."],args:[{name:"id",desc:"Matrix object to check.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if all elements of the `id` matrix are zero, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_zero(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_identity",desc:["The function determines if a matrix is an [identity matrix](https://en.wikipedia.org/wiki/Identity_matrix) (elements with ones on the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal) and zeros elsewhere)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if `id` is an identity matrix, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_diagonal](#fun_matrix.is_diagonal)"],syntax:["matrix.is_identity(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_binary",desc:["The function determines if the matrix is [binary](https://en.wikipedia.org/wiki/Logical_matrix) (when all elements of the matrix are 0 or 1)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is binary, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_binary(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_symmetric",desc:["The function determines if a [square matrix](https://en.wikipedia.org/wiki/Square_matrix) is [symmetric](https://en.wikipedia.org/wiki/Symmetric_matrix) (elements are symmetric with respect to the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal))."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is symmetric, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_symmetric(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_antisymmetric",desc:["The function determines if a matrix is [antisymmetric](https://en.wikipedia.org/wiki/Skew-symmetric_matrix) (its [transpose](https://en.wikipedia.org/wiki/Transpose) equals its negative)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true, if the `id` matrix is antisymmetric, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_antisymmetric(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_diagonal",desc:["The function determines if the matrix is [diagonal](https://en.wikipedia.org/wiki/Diagonal_matrix) (all elements outside the main diagonal are zero)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is diagonal, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_identity](#fun_matrix.is_identity)","[matrix.is_antidiagonal](#fun_matrix.is_antidiagonal)"],syntax:["matrix.is_diagonal(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_antidiagonal",desc:["The function determines if the matrix is [anti-diagonal](https://en.wikipedia.org/wiki/Anti-diagonal_matrix) (all elements outside the secondary diagonal are zero)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is ​​anti-diagonal, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_identity](#fun_matrix.is_identity)","[matrix.is_diagonal](#fun_matrix.is_diagonal)"],syntax:["matrix.is_antidiagonal(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_triangular",desc:["The function determines if the matrix is [triangular](https://en.wikipedia.org/wiki/Triangular_matrix) (if all elements above or below the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal) are zero)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is triangular, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_triangular(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_stochastic",desc:["The function determines if the matrix is [stochastic](https://en.wikipedia.org/wiki/Stochastic_matrix)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],returns:["Returns true if the `id` matrix is stochastic, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_stochastic(id) → series bool"],returnedTypes:["series bool"]},{name:"matrix.is_square",desc:["The function determines if the matrix is [square](https://en.wikipedia.org/wiki/Square_matrix) (it has the same number of rows and columns)."],args:[{name:"id",desc:"Matrix object to test.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],returns:["Returns true if the `id` matrix is square, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.is_square(id) → series bool"],returnedTypes:["series bool"]},{name:"table.merge_cells",desc:["The function merges a sequence of cells in the table into one cell. The cells are merged in a rectangle shape where the start_column and start_row specify the top-left corner, and end_column and end_row specify the bottom-right corner."],args:[{name:"table_id",desc:"A table object.",required:!0,allowedTypeIDs:["series table"],displayType:"series table"},{name:"start_column",desc:"The index of the column of the first cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"start_row",desc:"The index of the row of the first cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_column",desc:"The index of the column of the last cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_row",desc:"The index of the row of the last cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("table.merge_cells example")',"SMA50 = ta.sma(close, 50)","SMA100 = ta.sma(close, 100)","SMA200 = ta.sma(close, 200)","if barstate.islast"," maTable = table.new(position.bottom_right, 3, 3, bgcolor = color.gray, border_width = 1, border_color = color.black)"," // Header",' table.cell(maTable, 0, 0, text = "SMA Table")'," table.merge_cells(maTable, 0, 0, 2, 0)"," // Cell Titles",' table.cell(maTable, 0, 1, text = "SMA 50")',' table.cell(maTable, 1, 1, text = "SMA 100")',' table.cell(maTable, 2, 1, text = "SMA 200")'," // Values"," table.cell(maTable, 0, 2, bgcolor = color.white, text = str.tostring(SMA50))"," table.cell(maTable, 1, 2, bgcolor = color.white, text = str.tostring(SMA100))"," table.cell(maTable, 2, 2, bgcolor = color.white, text = str.tostring(SMA200))"],remarks:["This function will merge cells, even if their properties are not yet defined with [table.cell](#fun_table.cell).","The resulting merged cell inherits all of its values from the cell located at `start_column`:`start_row`, except width and height. The width and height of the resulting merged cell are based on the width/height of other cells in the neighboring columns/rows and cannot be set manually.","To modify the merged cell with any of the `table.cell_set_*` functions, target the cell at the `start_column`:`start_row` coordinates.","An attempt to merge a cell that has already been merged will result in an error."],seeAlso:["[table.delete](#fun_table.delete)","[table.new](#fun_table.new)"],syntax:["table.merge_cells(table_id, start_column, start_row, end_column, end_row) → void"],returnedTypes:["void"]},{name:"strategy.closedtrades.entry_price",desc:["Returns the price of the closed trade's entry."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.closedtrades.entry_price Example 1")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Return the entry price for the latest entry.","entryPrice = strategy.closedtrades.entry_price(strategy.closedtrades - 1)","",'plot(entryPrice, "Long entry price")']},{desc:[],examples:["// Calculates the average profit percentage for all closed trades.","//@version=5",'strategy("strategy.closedtrades.entry_price Example 2")',"","// Strategy calls to create single short and long trades","if bar_index == last_bar_index - 15",' strategy.entry("Long Entry", strategy.long)',"else if bar_index == last_bar_index - 10",' strategy.close("Long Entry")',' strategy.entry("Short", strategy.short)',"else if bar_index == last_bar_index - 5",' strategy.close("Short")',"","// Calculate profit for both closed trades.","profitPct = 0.0","for tradeNo = 0 to strategy.closedtrades - 1"," entryP = strategy.closedtrades.entry_price(tradeNo)"," exitP = strategy.closedtrades.exit_price(tradeNo)"," profitPct += (exitP - entryP) / entryP * strategy.closedtrades.size(tradeNo) * 100"," ","// Calculate average profit percent for both closed trades.","avgProfitPct = nz(profitPct / strategy.closedtrades)","","plot(avgProfitPct)"]}],seeAlso:["[strategy.closedtrades.entry_price](#fun_strategy.closedtrades.entry_price)","[strategy.closedtrades.exit_price](#fun_strategy.closedtrades.exit_price)","[strategy.closedtrades.size](#fun_strategy.closedtrades.size)","[strategy.closedtrades](#var_strategy.closedtrades),"],syntax:["strategy.closedtrades.entry_price(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.entry_bar_index",desc:["Returns the bar_index of the closed trade's entry."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("strategy.closedtrades.entry_bar_index Example")',"// Enter long trades on three rising bars; exit on two falling bars.","if ta.rising(close, 3)",' strategy.entry("Long", strategy.long)',"if ta.falling(close, 2)",' strategy.close("Long")',"// Function that calculates the average amount of bars in a trade.","avgBarsPerTrade() =>"," sumBarsPerTrade = 0"," for tradeNo = 0 to strategy.closedtrades - 1"," // Loop through all closed trades, starting with the oldest."," sumBarsPerTrade += strategy.closedtrades.exit_bar_index(tradeNo) - strategy.closedtrades.entry_bar_index(tradeNo) + 1"," result = nz(sumBarsPerTrade / strategy.closedtrades)","plot(avgBarsPerTrade())"],seeAlso:["[strategy.closedtrades.exit_bar_index](#fun_strategy.closedtrades.exit_bar_index)","[strategy.opentrades.entry_bar_index](#fun_strategy.opentrades.entry_bar_index)"],syntax:["strategy.closedtrades.entry_bar_index(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.closedtrades.entry_time",desc:["Returns the UNIX time of the closed trade's entry, expressed in milliseconds.."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("strategy.closedtrades.entry_time Example", overlay = true)',"","// Enter long trades on three rising bars; exit on two falling bars.","if ta.rising(close, 3)",' strategy.entry("Long", strategy.long)',"if ta.falling(close, 2)",' strategy.close("Long")',"","// Calculate the average trade duration ","avgTradeDuration() =>"," sumTradeDuration = 0"," for i = 0 to strategy.closedtrades - 1"," sumTradeDuration += strategy.closedtrades.exit_time(i) - strategy.closedtrades.entry_time(i)"," result = nz(sumTradeDuration / strategy.closedtrades)","","// Display average duration converted to seconds and formatted using 2 decimal points","if barstate.islastconfirmedhistory",' label.new(bar_index, high, str.tostring(avgTradeDuration() / 1000, "#.##") + " seconds")'],seeAlso:["[strategy.opentrades.entry_time](#fun_strategy.opentrades.entry_time)","[strategy.closedtrades.exit_time](#fun_strategy.closedtrades.exit_time)","[time](#var_time)"],syntax:["strategy.closedtrades.entry_time(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.closedtrades.exit_price",desc:["Returns the price of the closed trade's exit."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.closedtrades.exit_price Example 1")',"","// We are creating a long trade every 5 bars","if bar_index % 5 == 0",' strategy.entry("Long", strategy.long)','strategy.close("Long")',"","// Return the exit price from the latest closed trade.","exitPrice = strategy.closedtrades.exit_price(strategy.closedtrades - 1)","",'plot(exitPrice, "Long exit price")']},{desc:[],examples:["// Calculates the average profit percentage for all closed trades.","//@version=5",'strategy("strategy.closedtrades.exit_price Example 2")',"","// Strategy calls to create single short and long trades.","if bar_index == last_bar_index - 15",' strategy.entry("Long Entry", strategy.long)',"else if bar_index == last_bar_index - 10",' strategy.close("Long Entry")',' strategy.entry("Short", strategy.short)',"else if bar_index == last_bar_index - 5",' strategy.close("Short")',"","// Calculate profit for both closed trades.","profitPct = 0.0","for tradeNo = 0 to strategy.closedtrades - 1"," entryP = strategy.closedtrades.entry_price(tradeNo)"," exitP = strategy.closedtrades.exit_price(tradeNo)"," profitPct += (exitP - entryP) / entryP * strategy.closedtrades.size(tradeNo) * 100"," ","// Calculate average profit percent for both closed trades.","avgProfitPct = nz(profitPct / strategy.closedtrades)","","plot(avgProfitPct)"]}],seeAlso:["[strategy.closedtrades.entry_price](#fun_strategy.closedtrades.entry_price)"],syntax:["strategy.closedtrades.exit_price(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.exit_bar_index",desc:["Returns the bar_index of the closed trade's exit."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.closedtrades.exit_bar_index Example 1")',"","// Strategy calls to place a single short trade. We enter the trade at the first bar and exit the trade at 10 bars before the last chart bar.","if bar_index == 0",' strategy.entry("Short", strategy.short)',"if bar_index == last_bar_index - 10",' strategy.close("Short")',"","// Calculate the amount of bars since the last closed trade.","barsSinceClosed = strategy.closedtrades > 0 ? bar_index - strategy.closedtrades.exit_bar_index(strategy.closedtrades - 1) : na","",'plot(barsSinceClosed, "Bars since last closed trade")']},{desc:[],examples:["// Calculates the average amount of bars per trade.","//@version=5",'strategy("strategy.closedtrades.exit_bar_index Example 2")',"","// Enter long trades on three rising bars; exit on two falling bars.","if ta.rising(close, 3)",' strategy.entry("Long", strategy.long)',"if ta.falling(close, 2)",' strategy.close("Long")',"","// Function that calculates the average amount of bars per trade.","avgBarsPerTrade() =>"," sumBarsPerTrade = 0"," for tradeNo = 0 to strategy.closedtrades - 1"," // Loop through all closed trades, starting with the oldest."," sumBarsPerTrade += strategy.closedtrades.exit_bar_index(tradeNo) - strategy.closedtrades.entry_bar_index(tradeNo) + 1"," result = nz(sumBarsPerTrade / strategy.closedtrades)","","plot(avgBarsPerTrade())"]}],seeAlso:["[bar_index](#var_bar_index)","[last_bar_index](#var_last_bar_index)"],syntax:["strategy.closedtrades.exit_bar_index(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.closedtrades.exit_time",desc:["Returns the UNIX time of the closed trade's exit, expressed in milliseconds."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.closedtrades.exit_time Example 1")',"","// Enter long trades on three rising bars; exit on two falling bars.","if ta.rising(close, 3)",' strategy.entry("Long", strategy.long)',"if ta.falling(close, 2)",' strategy.close("Long")',"","// Calculate the average trade duration. ","avgTradeDuration() =>"," sumTradeDuration = 0"," for i = 0 to strategy.closedtrades - 1"," sumTradeDuration += strategy.closedtrades.exit_time(i) - strategy.closedtrades.entry_time(i)"," result = nz(sumTradeDuration / strategy.closedtrades)","","// Display average duration converted to seconds and formatted using 2 decimal points.","if barstate.islastconfirmedhistory",' label.new(bar_index, high, str.tostring(avgTradeDuration() / 1000, "#.##") + " seconds")']},{desc:[],examples:["// Reopens a closed trade after X seconds.","//@version=5",'strategy("strategy.closedtrades.exit_time Example 2")',"","// Strategy calls to emulate a single long trade at the first bar.","if bar_index == 0",' strategy.entry("Long", strategy.long)',"","reopenPositionAfter(timeSec) =>"," if strategy.closedtrades > 0"," if time - strategy.closedtrades.exit_time(strategy.closedtrades - 1) >= timeSec * 1000",' strategy.entry("Long", strategy.long)',"","// Reopen last closed position after 120 sec. ","reopenPositionAfter(120)","","if ta.change(strategy.opentrades)",' strategy.exit("Long", stop = low * 0.9, profit = high * 2.5)']}],seeAlso:["[strategy.closedtrades.entry_time](#fun_strategy.closedtrades.entry_time)"],syntax:["strategy.closedtrades.exit_time(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.closedtrades.size",desc:["Returns the direction and the number of contracts traded in the closed trade. If the value is > 0, the market position was long. If the value is < 0, the market position was short."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("`strategy.closedtrades.size` Example 1")',"","// We calculate the max amt of shares we can buy.","amtShares = math.floor(strategy.equity / close)","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long, qty = amtShares)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Plot the number of contracts traded in the last closed trade. ",'plot(strategy.closedtrades.size(strategy.closedtrades - 1), "Number of contracts traded")']},{desc:[],examples:["// Calculates the average profit percentage for all closed trades.","//@version=5",'strategy("`strategy.closedtrades.size` Example 2")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","","// Calculate profit for both closed trades.","profitPct = 0.0","for tradeNo = 0 to strategy.closedtrades - 1"," entryP = strategy.closedtrades.entry_price(tradeNo)"," exitP = strategy.closedtrades.exit_price(tradeNo)"," profitPct += (exitP - entryP) / entryP * strategy.closedtrades.size(tradeNo) * 100"," ","// Calculate average profit percent for both closed trades.","avgProfitPct = nz(profitPct / strategy.closedtrades)","","plot(avgProfitPct)"]}],seeAlso:["[strategy.opentrades.size](#fun_strategy.opentrades.size)","[strategy.position_size](#var_strategy.position_size)","[strategy.closedtrades](#var_strategy.closedtrades)","[strategy.opentrades](#var_strategy.opentrades)"],syntax:["strategy.closedtrades.size(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.profit",desc:["Returns the profit/loss of the closed trade, expressed in [strategy.account_currency](#var_strategy.account_currency). Losses are expressed as negative values."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.profit` Example")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Calculate average gross profit by adding the difference between gross profit and commission.","avgGrossProfit() =>"," sumGrossProfit = 0.0"," for tradeNo = 0 to strategy.closedtrades - 1"," sumGrossProfit += strategy.closedtrades.profit(tradeNo) - strategy.closedtrades.commission(tradeNo)"," result = nz(sumGrossProfit / strategy.closedtrades)"," ",'plot(avgGrossProfit(), "Average gross profit")'],seeAlso:["[strategy.opentrades.profit](#fun_strategy.opentrades.profit)","[strategy.closedtrades.commission](#fun_strategy.closedtrades.commission)"],syntax:["strategy.closedtrades.profit(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.commission",desc:["Returns the sum of entry and exit fees paid in the closed trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.commission` Example", commission_type = strategy.commission.percent, commission_value = 0.1)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Plot total fees for the latest closed trade.","plot(strategy.closedtrades.commission(strategy.closedtrades - 1))"],seeAlso:["[strategy](#fun_strategy)","[strategy.opentrades.commission](#fun_strategy.opentrades.commission)"],syntax:["strategy.closedtrades.commission(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.max_runup",desc:["Returns the maximum run up of the closed trade, i.e., the maximum possible profit during the trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.max_runup` Example")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Get the biggest max trade runup value from all of the closed trades.","maxTradeRunUp() =>"," maxRunup = 0.0"," for tradeNo = 0 to strategy.closedtrades - 1"," maxRunup := math.max(maxRunup, strategy.closedtrades.max_runup(tradeNo))"," result = maxRunup","",'plot(maxTradeRunUp(), "Max trade runup")'],seeAlso:["[strategy.opentrades.max_runup](#fun_strategy.opentrades.max_runup)","[strategy.max_runup](#var_strategy.max_runup)"],syntax:["strategy.closedtrades.max_runup(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.max_drawdown",desc:["Returns the maximum drawdown of the closed trade, i.e., the maximum possible loss during the trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.max_drawdown` Example")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Get the biggest max trade drawdown value from all of the closed trades.","maxTradeDrawDown() =>"," maxDrawdown = 0.0"," for tradeNo = 0 to strategy.closedtrades - 1"," maxDrawdown := math.max(maxDrawdown, strategy.closedtrades.max_drawdown(tradeNo))"," result = maxDrawdown","",'plot(maxTradeDrawDown(), "Biggest max drawdown")'],remarks:["The function returns na if trade_num is not in the range: 0 to strategy.closedtrades - 1."],seeAlso:["[strategy.opentrades.max_drawdown](#fun_strategy.opentrades.max_drawdown)","[strategy.max_drawdown](#var_strategy.max_drawdown)"],syntax:["strategy.closedtrades.max_drawdown(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.max_drawdown_percent",desc:["Returns the maximum drawdown of the closed trade, i.e., the maximum possible loss during the trade, expressed as a percentage and calculated by formula: `Lowest Value During Trade / (Entry Price x Quantity) * 100`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.closedtrades.max_drawdown](#fun_strategy.closedtrades.max_drawdown)","[strategy.max_drawdown](#var_strategy.max_drawdown)"],syntax:["strategy.closedtrades.max_drawdown_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.max_runup_percent",desc:["Returns the maximum run-up of the closed trade, i.e., the maximum possible profit during the trade, expressed as a percentage and calculated by formula: `Highest Value During Trade / (Entry Price x Quantity) * 100`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.closedtrades.max_runup](#fun_strategy.closedtrades.max_runup)","[strategy.max_runup](#var_strategy.max_runup)"],syntax:["strategy.closedtrades.max_runup_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.profit_percent",desc:["Returns the profit/loss value of the closed trade, expressed as a percentage. Losses are expressed as negative values."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.closedtrades.profit](#fun_strategy.closedtrades.profit)"],syntax:["strategy.closedtrades.profit_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.max_drawdown_percent",desc:["Returns the maximum drawdown of the open trade, i.e., the maximum possible loss during the trade, expressed as a percentage and calculated by formula: `Lowest Value During Trade / (Entry Price x Quantity) * 100`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.opentrades.max_drawdown](#fun_strategy.opentrades.max_drawdown)","[strategy.max_drawdown](#var_strategy.max_drawdown)"],syntax:["strategy.opentrades.max_drawdown_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.max_runup_percent",desc:["Returns the maximum run-up of the open trade, i.e., the maximum possible profit during the trade, expressed as a percentage and calculated by formula: `Highest Value During Trade / (Entry Price x Quantity) * 100`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.opentrades.max_runup](#fun_strategy.opentrades.max_runup)","[strategy.max_runup](#var_strategy.max_runup)"],syntax:["strategy.opentrades.max_runup_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.profit_percent",desc:["Returns the profit/loss of the open trade, expressed as a percentage. Losses are expressed as negative values."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[strategy.opentrades.profit](#fun_strategy.opentrades.profit)"],syntax:["strategy.opentrades.profit_percent(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.closedtrades.entry_id",desc:["Returns the id of the closed trade's entry."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("strategy.closedtrades.entry_id Example", overlay = true)',"","// Enter a short position and close at the previous to last bar.","if bar_index == 1",' strategy.entry("Short at bar #" + str.tostring(bar_index), strategy.short)',"if bar_index == last_bar_index - 2"," strategy.close_all()"," ","// Display ID of the last entry position.","if barstate.islastconfirmedhistory",' label.new(last_bar_index, high, "Last Entry ID is: " + strategy.closedtrades.entry_id(strategy.closedtrades - 1))'],returns:["Returns the id of the closed trade's entry."],remarks:["The function returns na if trade_num is not in the range: 0 to strategy.closedtrades-1."],seeAlso:["[strategy.closedtrades.entry_bar_index](#fun_strategy.closedtrades.entry_bar_index)","[strategy.closedtrades.entry_price](#fun_strategy.closedtrades.entry_price)","[strategy.closedtrades.entry_time](#fun_strategy.closedtrades.entry_time)"],syntax:["strategy.closedtrades.entry_id(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.closedtrades.exit_id",desc:["Returns the id of the closed trade's exit."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("strategy.closedtrades.exit_id Example", overlay = true)',"","// Strategy calls to create single short and long trades","if bar_index == last_bar_index - 15",' strategy.entry("Long Entry", strategy.long)',"else if bar_index == last_bar_index - 10",' strategy.entry("Short Entry", strategy.short)'," ","// When a new open trade is detected then we create the exit strategy corresponding with the matching entry id","// We detect the correct entry id by determining if a position is long or short based on the position quantity","if ta.change(strategy.opentrades)"," posSign = strategy.opentrades.size(strategy.opentrades - 1)",' strategy.exit(posSign > 0 ? "SL Long Exit" : "SL Short Exit", strategy.opentrades.entry_id(strategy.opentrades - 1), stop = posSign > 0 ? high - ta.tr : low + ta.tr)',"","// When a new closed trade is detected then we place a label above the bar with the exit info","if ta.change(strategy.closedtrades)",' msg = "Trade closed by: " + strategy.closedtrades.exit_id(strategy.closedtrades - 1)'," label.new(bar_index, high + (3 * ta.tr), msg)"],returns:["Returns the id of the closed trade's exit."],remarks:["The function returns na if trade_num is not in the range: 0 to strategy.closedtrades-1."],seeAlso:["[strategy.closedtrades.exit_bar_index](#fun_strategy.closedtrades.exit_bar_index)","[strategy.closedtrades.exit_price](#fun_strategy.closedtrades.exit_price)","[strategy.closedtrades.exit_time](#fun_strategy.closedtrades.exit_time)"],syntax:["strategy.closedtrades.exit_id(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.opentrades.entry_comment",desc:["Returns the comment message of the open trade's entry, or\n[na](#var_na) if there is no entry with this `trade_num`."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.opentrades.entry_comment()` Example", overlay = true)',"","stopPrice = open * 1.01","","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","","if (longCondition)",' strategy.entry("Long", strategy.long, stop = stopPrice, comment = str.tostring(stopPrice, "#.####"))',"","var testTable = table.new(position.top_right, 1, 3, color.orange, border_width = 1)","","if barstate.islastconfirmedhistory or barstate.isrealtime"," table.cell(testTable, 0, 0, 'Last entry stats')",' table.cell(testTable, 0, 1, "Order stop price value: " + strategy.opentrades.entry_comment(strategy.opentrades - 1))',' table.cell(testTable, 0, 2, "Actual Entry Price: " + str.tostring(strategy.opentrades.entry_price(strategy.opentrades - 1)))'],seeAlso:["[strategy](#fun_strategy)","[strategy.entry](#fun_strategy.entry)","[strategy.opentrades](#var_strategy.opentrades)"],syntax:["strategy.opentrades.entry_comment(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.closedtrades.entry_comment",desc:["Returns the comment message of the closed trade's entry, or [na](#var_na)\nif there is no entry with this `trade_num`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.entry_comment()` Example", overlay = true)',"","stopPrice = open * 1.01","","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","","if (longCondition)",' strategy.entry("Long", strategy.long, stop = stopPrice, comment = str.tostring(stopPrice, "#.####"))',' strategy.exit("EXIT", trail_points = 1000, trail_offset = 0)',"","var testTable = table.new(position.top_right, 1, 3, color.orange, border_width = 1)","","if barstate.islastconfirmedhistory or barstate.isrealtime"," table.cell(testTable, 0, 0, 'Last closed trade:')",' table.cell(testTable, 0, 1, "Order stop price value: " + strategy.closedtrades.entry_comment(strategy.closedtrades - 1))',' table.cell(testTable, 0, 2, "Actual Entry Price: " + str.tostring(strategy.closedtrades.entry_price(strategy.closedtrades - 1)))'],seeAlso:["[strategy](#fun_strategy)","[strategy.entry](#fun_strategy.entry)","[strategy.closedtrades](#var_strategy.closedtrades)"],syntax:["strategy.closedtrades.entry_comment(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.closedtrades.exit_comment",desc:["Returns the comment message of the closed trade's exit, or\n[na](#var_na) if there is no entry with this `trade_num`."],args:[{name:"trade_num",desc:"The trade number of the closed trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.closedtrades.exit_comment()` Example", overlay = true)',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)",' strategy.entry("Long", strategy.long)',' strategy.exit("Exit", stop = open * 0.95, limit = close * 1.05, trail_points = 100, trail_offset = 0, comment_profit = "TP", comment_loss = "SL", comment_trailing = "TRAIL")',"","exitStats() =>"," int slCount = 0"," int tpCount = 0"," int trailCount = 0"," "," if strategy.closedtrades > 0"," for i = 0 to strategy.closedtrades - 1"," switch strategy.closedtrades.exit_comment(i)",' "TP" => tpCount += 1',' "SL" => slCount += 1',' "TRAIL" => trailCount += 1'," [slCount, tpCount, trailCount]","","var testTable = table.new(position.top_right, 1, 4, color.orange, border_width = 1)","","if barstate.islastconfirmedhistory"," [slCount, tpCount, trailCount] = exitStats()",' table.cell(testTable, 0, 0, "Closed trades (" + str.tostring(strategy.closedtrades) +") stats:")',' table.cell(testTable, 0, 1, "Stop Loss: " + str.tostring(slCount))',' table.cell(testTable, 0, 2, "Take Profit: " + str.tostring(tpCount))',' table.cell(testTable, 0, 3, "Trailing Stop: " + str.tostring(trailCount))'],seeAlso:["[strategy](#fun_strategy)","[strategy.exit](#fun_strategy.exit)","[strategy.close](#fun_strategy.close)","[strategy.closedtrades](#fun_strategy.closedtrades)"],syntax:["strategy.closedtrades.exit_comment(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.opentrades.entry_price",desc:["Returns the price of the open trade's entry."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.opentrades.entry_price Example 1", overlay = true)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if ta.crossover(close, ta.sma(close, 14))",' strategy.entry("Long", strategy.long)',"","// Return the entry price for the latest closed trade.","currEntryPrice = strategy.opentrades.entry_price(strategy.opentrades - 1)","currExitPrice = currEntryPrice * 1.05","","if high >= currExitPrice",' strategy.close("Long")',"",'plot(currEntryPrice, "Long entry price", style = plot.style_linebr)','plot(currExitPrice, "Long exit price", color.green, style = plot.style_linebr)']},{desc:[],examples:["// Calculates the average price for the open position.","//@version=5",'strategy("strategy.opentrades.entry_price Example 2", pyramiding = 2)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Calculates the average price for the open position.","avgOpenPositionPrice() =>"," sumOpenPositionPrice = 0.0"," for tradeNo = 0 to strategy.opentrades - 1"," sumOpenPositionPrice += strategy.opentrades.entry_price(tradeNo) * strategy.opentrades.size(tradeNo) / strategy.position_size"," result = nz(sumOpenPositionPrice / strategy.opentrades)","","plot(avgOpenPositionPrice())"]}],seeAlso:["[strategy.closedtrades.exit_price](#fun_strategy.closedtrades.exit_price)"],syntax:["strategy.opentrades.entry_price(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.entry_bar_index",desc:["Returns the bar_index of the open trade's entry."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["// Wait 10 bars and then close the position.","//@version=5",'strategy("`strategy.opentrades.entry_bar_index` Example")',"","barsSinceLastEntry() =>"," strategy.opentrades > 0 ? bar_index - strategy.opentrades.entry_bar_index(strategy.opentrades - 1) : na","","// Enter a long position if there are no open positions.","if strategy.opentrades == 0",' strategy.entry("Long", strategy.long)',"","// Close the long position after 10 bars. ","if barsSinceLastEntry() >= 10",' strategy.close("Long")']}],seeAlso:["[strategy.closedtrades.entry_bar_index](#fun_strategy.closedtrades.entry_bar_index)","[strategy.closedtrades.exit_bar_index](#fun_strategy.closedtrades.exit_bar_index)"],syntax:["strategy.opentrades.entry_bar_index(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.opentrades.entry_time",desc:["Returns the UNIX time of the open trade's entry, expressed in milliseconds."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("strategy.opentrades.entry_time Example")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Calculates duration in milliseconds since the last position was opened.","timeSinceLastEntry()=>"," strategy.opentrades > 0 ? (time - strategy.opentrades.entry_time(strategy.opentrades - 1)) : na","",'plot(timeSinceLastEntry() / 1000 * 60 * 60 * 24, "Days since last entry")'],seeAlso:["[strategy.closedtrades.entry_time](#fun_strategy.closedtrades.entry_time)","[strategy.closedtrades.exit_time](#fun_strategy.closedtrades.exit_time)"],syntax:["strategy.opentrades.entry_time(trade_num) → series int"],returnedTypes:["series int"]},{name:"strategy.opentrades.size",desc:["Returns the direction and the number of contracts traded in the open trade. If the value is > 0, the market position was long. If the value is < 0, the market position was short."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("`strategy.opentrades.size` Example 1")',"","// We calculate the max amt of shares we can buy.","amtShares = math.floor(strategy.equity / close)","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long, qty = amtShares)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Plot the number of contracts in the latest open trade.",'plot(strategy.opentrades.size(strategy.opentrades - 1), "Amount of contracts in latest open trade")']},{desc:[],examples:["// Calculates the average profit percentage for all open trades.","//@version=5",'strategy("`strategy.opentrades.size` Example 2")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Calculate profit for all open trades.","profitPct = 0.0","for tradeNo = 0 to strategy.opentrades - 1"," entryP = strategy.opentrades.entry_price(tradeNo)"," exitP = close"," profitPct += (exitP - entryP) / entryP * strategy.opentrades.size(tradeNo) * 100"," ","// Calculate average profit percent for all open trades.","avgProfitPct = nz(profitPct / strategy.opentrades)","plot(avgProfitPct)"]}],seeAlso:["[strategy.closedtrades.size](#fun_strategy.closedtrades.size)","[strategy.position_size](#var_strategy.position_size)","[strategy.opentrades](#var_strategy.opentrades)","[strategy.closedtrades](#var_strategy.closedtrades)"],syntax:["strategy.opentrades.size(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.profit",desc:["Returns the profit/loss of the open trade, expressed in [strategy.account_currency](#var_strategy.account_currency). Losses are expressed as negative values."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["// Returns the profit of the last open trade.","//@version=5",'strategy("`strategy.opentrades.profit` Example 1", commission_type = strategy.commission.percent, commission_value = 0.1)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"",'plot(strategy.opentrades.profit(strategy.opentrades - 1), "Profit of the latest open trade")']},{desc:[],examples:["// Calculates the profit for all open trades.","//@version=5",'strategy("`strategy.opentrades.profit` Example 2", pyramiding = 5)',"","// Strategy calls to enter 5 long positions every 2 bars.","if bar_index % 2 == 0",' strategy.entry("Long", strategy.long, qty = 5)',"","// Calculate open profit or loss for the open positions.","tradeOpenPL() =>"," sumProfit = 0.0"," for tradeNo = 0 to strategy.opentrades - 1"," sumProfit += strategy.opentrades.profit(tradeNo)"," result = sumProfit"," ",'plot(tradeOpenPL(), "Profit of all open trades")']}],seeAlso:["[strategy.closedtrades.profit](#fun_strategy.closedtrades.profit)","[strategy.openprofit](#var_strategy.openprofit)","[strategy.netprofit](#var_strategy.netprofit)","[strategy.grossprofit](#var_strategy.grossprofit)"],syntax:["strategy.opentrades.profit(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.commission",desc:["Returns the sum of entry and exit fees paid in the open trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["// Calculates the gross profit or loss for the current open position.","//@version=5",'strategy("`strategy.opentrades.commission` Example", commission_type = strategy.commission.percent, commission_value = 0.1)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Calculate gross profit or loss for open positions only.","tradeOpenGrossPL() =>"," sumOpenGrossPL = 0.0"," for tradeNo = 0 to strategy.opentrades - 1"," sumOpenGrossPL += strategy.opentrades.profit(tradeNo) - strategy.opentrades.commission(tradeNo)"," result = sumOpenGrossPL"," ","plot(tradeOpenGrossPL())"]}],seeAlso:["[strategy](#fun_strategy)","[strategy.closedtrades.commission](#fun_strategy.closedtrades.commission)"],syntax:["strategy.opentrades.commission(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.max_runup",desc:["Returns the maximum run up of the open trade, i.e., the maximum possible profit during the trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.opentrades.max_runup Example 1")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Plot the max runup of the latest open trade.",'plot(strategy.opentrades.max_runup(strategy.opentrades - 1), "Max runup of the latest open trade")']},{desc:[],examples:["// Calculates the max trade runup value for all open trades.","//@version=5",'strategy("strategy.opentrades.max_runup Example 2", pyramiding = 100)',"","// Enter a long position every 30 bars.","if bar_index % 30 == 0",' strategy.entry("Long", strategy.long)',"","// Calculate biggest max trade runup value from all of the open trades.","maxOpenTradeRunUp() =>"," maxRunup = 0.0"," for tradeNo = 0 to strategy.opentrades - 1"," maxRunup := math.max(maxRunup, strategy.opentrades.max_runup(tradeNo))"," result = maxRunup","",'plot(maxOpenTradeRunUp(), "Biggest max runup of all open trades")']}],seeAlso:["[strategy.closedtrades.max_runup](#fun_strategy.closedtrades.max_runup)","[strategy.max_drawdown](#var_strategy.max_drawdown)"],syntax:["strategy.opentrades.max_runup(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.max_drawdown",desc:["Returns the maximum drawdown of the open trade, i.e., the maximum possible loss during the trade, expressed in [strategy.account_currency](#var_strategy.account_currency)."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("strategy.opentrades.max_drawdown Example 1")',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Plot the max drawdown of the latest open trade.",'plot(strategy.opentrades.max_drawdown(strategy.opentrades - 1), "Max drawdown of the latest open trade")']},{desc:[],examples:["// Calculates the max trade drawdown value for all open trades.","//@version=5",'strategy("`strategy.opentrades.max_drawdown` Example 2", pyramiding = 100)',"","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long)',"if bar_index % 20 == 0",' strategy.close("Long")',"","// Get the biggest max trade drawdown value from all of the open trades.","maxTradeDrawDown() =>"," maxDrawdown = 0.0"," for tradeNo = 0 to strategy.opentrades - 1"," maxDrawdown := math.max(maxDrawdown, strategy.opentrades.max_drawdown(tradeNo))"," result = maxDrawdown","",'plot(maxTradeDrawDown(), "Biggest max drawdown")']}],remarks:["The function returns na if trade_num is not in the range: 0 to strategy.closedtrades - 1."],seeAlso:["[strategy.closedtrades.max_drawdown](#fun_strategy.closedtrades.max_drawdown)","[strategy.max_drawdown](#var_strategy.max_drawdown)"],syntax:["strategy.opentrades.max_drawdown(trade_num) → series float"],returnedTypes:["series float"]},{name:"strategy.opentrades.entry_id",desc:["Returns the id of the open trade's entry."],args:[{name:"trade_num",desc:"The trade number of the open trade. The number of the first trade is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'strategy("`strategy.opentrades.entry_id` Example", overlay = true)',"","// We enter a long position when 14 period sma crosses over 28 period sma.","// We enter a short position when 14 period sma crosses under 28 period sma.","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))","","// Strategy calls to enter a long or short position when the corresponding condition is met.","if longCondition",' strategy.entry("Long entry at bar #" + str.tostring(bar_index), strategy.long)',"if shortCondition",' strategy.entry("Short entry at bar #" + str.tostring(bar_index), strategy.short)',"","// Display ID of the latest open position.","if barstate.islastconfirmedhistory",' label.new(bar_index, high + (2 * ta.tr), "Last opened position is \\n " + strategy.opentrades.entry_id(strategy.opentrades - 1))'],returns:["Returns the id of the open trade's entry."],remarks:["The function returns na if trade_num is not in the range: 0 to strategy.opentrades-1."],seeAlso:["[strategy.opentrades.entry_bar_index](#fun_strategy.opentrades.entry_bar_index)","[strategy.opentrades.entry_price](#fun_strategy.opentrades.entry_price)","[strategy.opentrades.entry_time](#fun_strategy.opentrades.entry_time)"],syntax:["strategy.opentrades.entry_id(trade_num) → series string"],returnedTypes:["series string"]},{name:"strategy.convert_to_account",desc:["Converts the value from the currency that the symbol on the chart is traded in ([syminfo.currency](#var_syminfo.currency)) to the currency used by the strategy ([strategy.account_currency](#var_strategy.account_currency))."],args:[{name:"value",desc:"The value to be converted.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'strategy("`strategy.convert_to_account` Example 1", currency = currency.EUR)',"",'plot(close, "Close price using default currency")','plot(strategy.convert_to_account(close), "Close price converted to strategy currency")']},{desc:[],examples:[`// Calculates the "Buy and hold return" using your account's currency.`,"//@version=5",'strategy("`strategy.convert_to_account` Example 2", currency = currency.EUR)',"",'dateInput = input.time(timestamp("20 Jul 2021 00:00 +0300"), "From Date", confirm = true)',"","buyAndHoldReturnPct(fromDate) =>"," if time >= fromDate"," money = close * syminfo.pointvalue"," var initialBal = strategy.convert_to_account(money)"," (strategy.convert_to_account(money) - initialBal) / initialBal * 100"," ","plot(buyAndHoldReturnPct(dateInput))"]}],seeAlso:["[strategy](#fun_strategy)","[strategy.convert_to_symbol](#fun_strategy.convert_to_symbol)"],syntax:["strategy.convert_to_account(value) → series float"],returnedTypes:["series float"]},{name:"strategy.default_entry_qty",desc:['Calculates the default quantity, in units, of an entry order from [strategy.entry](#fun_strategy.entry) or [strategy.order](#fun_strategy.order) if it were to fill at the specified `fill_price` value. The calculation depends on several strategy properties, including `default_qty_type`, `default_qty_value`, `currency`, and other parameters in the [strategy](#fun_strategy) function and their representation in the "Properties" tab of the strategy\'s settings.'],args:[{name:"fill_price",desc:"The fill price for which to calculate the default order quantity.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'strategy("Supertrend Strategy", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 15)',"","//@variable The length of the ATR calculation.",'atrPeriod = input(10, "ATR Length")',"//@variable The ATR multiplier.",'factor = input.float(3.0, "Factor", step = 0.01)',"//@variable The tick offset of the stop order.",'stopOffsetInput = input.int(100, "Tick offset for entry stop")',"","// Get the direction of the SuperTrend.","[_, direction] = ta.supertrend(factor, atrPeriod)","","if ta.change(direction) < 0"," //@variable The stop price of the entry order."," stopPrice = close + syminfo.mintick * stopOffsetInput"," //@variable The expected default fill quantity at the `stopPrice`. This value may not reflect actual qty of the filled order, because fill price may be different."," calculatedQty = strategy.default_entry_qty(stopPrice)",' strategy.entry("My Long Entry Id", strategy.long, stop = stopPrice)',' label.new(bar_index, stopPrice, str.format("Stop set at {0}\\nExpected qty at {0}: {1}", math.round_to_mintick(stopPrice), calculatedQty))',"","if ta.change(direction) > 0"," strategy.close_all()"],remarks:["This function does not consider open positions simulated by a strategy. For example, if a strategy script has an open position from a long order with a `qty` of 10 units, using the [strategy.entry](#fun_strategy.entry) function to simulate a short order with a `qty` of 5 will prompt the script to sell 15 units to reverse the position. This function will still return 5 in such a case since it doesn't consider an open trade.","This value represents the default calculated quantity of an order.","Order placement commands can override the default value by explicitly passing a new `qty` value in the function call."],syntax:["strategy.default_entry_qty(fill_price) → series float"],returnedTypes:["series float"]},{name:"strategy.convert_to_symbol",desc:["Converts the value from the currency used by the strategy ([strategy.account_currency](#var_strategy.account_currency)) to the currency that the symbol on the chart is traded in ([syminfo.currency](#var_syminfo.currency))."],args:[{name:"value",desc:"The value to be converted.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'strategy("`strategy.convert_to_symbol` Example", currency = currency.EUR)',"","// Calculate the max qty we can buy using current chart's currency.","calcContracts(accountMoney) =>"," math.floor(strategy.convert_to_symbol(accountMoney) / syminfo.pointvalue / close)","","// Return max qty we can buy using 300 euros","qt = calcContracts(300)","","// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars using our custom qty.","if bar_index % 15 == 0",' strategy.entry("Long", strategy.long, qty = qt)',"if bar_index % 20 == 0",' strategy.close("Long")'],seeAlso:["[strategy](#fun_strategy)","[strategy.convert_to_account](#fun_strategy.convert_to_account)"],syntax:["strategy.convert_to_symbol(value) → series float"],returnedTypes:["series float"]},{name:"chart.point.from_index",desc:["Returns a [chart.point](#op_chart.point) object with `index` as its x-coordinate and `price` as its y-coordinate."],args:[{name:"index",desc:"The x-coordinate of the point, expressed as a bar index value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"price",desc:"The y-coordinate of the point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["The `time` field values of [chart.point](#op_chart.point) instances returned from this function will be [na](#var_na), meaning drawing objects with `xloc` values set to `xloc.bar_time` will not work with them."],syntax:["chart.point.from_index(index, price) → chart.point"],returnedTypes:["chart.point"]},{name:"chart.point.copy",desc:["Creates a copy of a [chart.point](#op_chart.point) object with the specified `id`."],args:[{name:"id",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["chart.point.copy(id) → chart.point"],returnedTypes:["chart.point"]},{name:"chart.point.from_time",desc:["Returns a [chart.point](#op_chart.point) object with `time` as its x-coordinate and `price` as its y-coordinate."],args:[{name:"time",desc:"The x-coordinate of the point, expressed as a UNIX time value, in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"price",desc:"The y-coordinate of the point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["The `index` field values of [chart.point](#op_chart.point) instances returned from this function will be [na](#var_na), meaning drawing objects with `xloc` values set to `xloc.bar_index` will not work with them."],syntax:["chart.point.from_time(time, price) → chart.point"],returnedTypes:["chart.point"]},{name:"chart.point.now",desc:["Returns a [chart.point](#op_chart.point) object with `price` as the y-coordinate"],args:[{name:"price",desc:"The y-coordinate of the point. Optional. The default is [close](#var_close).",allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["The [chart.point](#op_chart.point) instance returned from this function records values for its `index` and `time` fields on the bar it executed on, making it suitable for use with drawing objects of any `xloc` type."],syntax:["chart.point.now(price) → chart.point"],returnedTypes:["chart.point"]},{name:"chart.point.new",seeAlso:["[polyline.new](#fun_polyline.new)"],desc:["Creates a new [chart.point](#op_chart.point) object with the specified `time`, `index`, and `price`."],args:[{name:"time",desc:"The x-coordinate of the point, expressed as a UNIX time value, in milliseconds.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"index",desc:"The x-coordinate of the point, expressed as a bar index value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"price",desc:"The y-coordinate of the point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["Whether a drawing object uses a point's `time` or `index` field as an x-coordinate depends on the `xloc` type used in the function call that returned the drawing.","It's important to note that this function does not verify that the `time` and `index` values refer to the same bar. "],syntax:["chart.point.new(time, index, price) → chart.point"],returnedTypes:["chart.point"]},{name:"line.set_first_point",desc:["Sets the first point of the `id` line to `point`."],args:[{name:"id",desc:"A [line](#op_line) object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["line.set_first_point(id, point) → void"],returnedTypes:["void"]},{name:"line.set_second_point",desc:["Sets the second point of the `id` line to `point`."],args:[{name:"id",desc:"A [line](#op_line) object.",required:!0,allowedTypeIDs:["series line"],displayType:"series line"},{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["line.set_second_point(id, point) → void"],returnedTypes:["void"]},{name:"label.set_point",desc:["Sets the location of the `id` label to `point`."],args:[{name:"id",desc:"A [label](#op_label) object.",required:!0,allowedTypeIDs:["series label"],displayType:"series label"},{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["label.set_point(id, point) → void"],returnedTypes:["void"]},{name:"box.set_top_left_point",desc:["Sets the top-left corner location of the `id` box to `point`."],args:[{name:"id",desc:"A [box](#op_box) object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["box.set_top_left_point(id, point) → void"],returnedTypes:["void"]},{name:"box.set_bottom_right_point",desc:["Sets the bottom-right corner location of the `id` box to `point`."],args:[{name:"id",desc:"A [box](#op_box) object.",required:!0,allowedTypeIDs:["series box"],displayType:"series box"},{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["box.set_bottom_right_point(id, point) → void"],returnedTypes:["void"]},{name:"library",desc:["Declaration statement identifying a script as a [library](https://www.tradingview.com/pine-script-docs/en/v5/concepts/Libraries.html)."],args:[{name:"title",desc:"The title of the library and its identifier. It cannot contain spaces, special characters or begin with a digit. It is used as the publication's default title, and to uniquely identify the library in the [import](#op_import) statement, when another script uses it. It is also used as the script's name on the chart.",required:!0,allowedTypeIDs:["const string"],displayType:"const string"},{name:"overlay",desc:"If true, the library will be added over the chart. If false, it will be added in a separate pane. Optional. The default is false.",allowedTypeIDs:["const bool"],displayType:"const bool"}],examples:["//@version=5","// @description Math library",'library("num_methods", overlay = true)','// Calculate "sinh()" from the float parameter `x`',"export sinh(float x) =>"," (math.exp(x) - math.exp(-x)) / 2.0","plot(sinh(0))"],seeAlso:["[indicator](#fun_indicator)","[strategy](#fun_strategy)"],syntax:["library(title, overlay) → void"],returnedTypes:["void"]},{name:"runtime.error",desc:["When called, causes a runtime error with the error message specified in the `message` argument."],args:[{name:"message",desc:"Error message.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],syntax:["runtime.error(message) → void"],returnedTypes:["void"]},{name:"log.info",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "info" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"message",desc:"Log message.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.info(message) → void"],returnedTypes:["void"]},{name:"log.info",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "info" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"formatString",desc:"Format string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"arg0, arg1, ...",desc:"Values to format.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series string","simple string","input string","const string","int[]","float[]","bool[]","string[]"],displayType:"series int/float/bool/string/int[]/float[]/bool[]/string[]"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.info(formatString, arg0, arg1, ...) → void"],returnedTypes:["void"]},{name:"log.warning",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "warning" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"message",desc:"Log message.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.warning(message) → void"],returnedTypes:["void"]},{name:"log.warning",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "warning" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"formatString",desc:"Format string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"arg0, arg1, ...",desc:"Values to format.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series string","simple string","input string","const string","int[]","float[]","bool[]","string[]"],displayType:"series int/float/bool/string/int[]/float[]/bool[]/string[]"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.warning(formatString, arg0, arg1, ...) → void"],returnedTypes:["void"]},{name:"log.error",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "error" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"message",desc:"Log message.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.error(message) → void"],returnedTypes:["void"]},{name:"log.error",desc:['Converts the formatting string and value(s) into a formatted string, and sends the result to the "Pine Logs" menu tagged with the "error" debug level.',"","The formatting string can contain literal text and one placeholder in curly braces {} for each value to be formatted. Each placeholder consists of the index of the required argument (beginning at 0) that will replace it, and an optional format specifier. The index represents the position of that argument in the function's argument list."],args:[{name:"formatString",desc:"Format string.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"arg0, arg1, ...",desc:"Values to format.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float","series bool","simple bool","input bool","const bool","series string","simple string","input string","const string","int[]","float[]","bool[]","string[]"],displayType:"series int/float/bool/string/int[]/float[]/bool[]/string[]"}],examples:["//@version=5",'strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, process_orders_on_close = true)','bracketTickSizeInput = input.int(1000, "Stoploss/Take-Profit distance (in ticks)")',"","longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))","if (longCondition)"," limitLevel = close * 1.01",' log.info("Long limit order has been placed at {0}", limitLevel)',' strategy.order("My Long Entry Id", strategy.long, limit = limitLevel)',"",' log.info("Exit orders have been placed: Take-profit at {0}, Stop-loss at {1}", close)',' strategy.exit("Exit", "My Long Entry Id", profit = bracketTickSizeInput, loss = bracketTickSizeInput)',"","if strategy.opentrades > 10",' log.warning("{0} positions opened in the same direction in a row. Try adjusting `bracketTickSizeInput`", strategy.opentrades)',"","last10Perc = strategy.initial_capital / 10 > strategy.equity","if (last10Perc and not last10Perc[1])",' log.error("The strategy has lost 90% of the initial capital!")'],returns:["The formatted string."],remarks:[`Any curly braces within an unquoted pattern must be balanced. For example, "ab {0} de" and "ab '}' de" are valid patterns, but "ab {0'}' de", "ab } de" and "''{''" are not.`,"","The function can apply additional formatting to some values inside of the `{}`. The list of additional formatting options can be found in the EXAMPLE section of the [str.format](#fun_str.format) article.","","The string used as the `formatString` argument can contain single quote characters ('). However, one must pair all single quotes in that string to avoid unexpected formatting results.","",'The "Pine Logs..." button is accessible from the "More" dropdown in the Pine Editor and from the "More" dropdown in the status line of any script that uses `log.*()` functions.'],syntax:["log.error(formatString, arg0, arg1, ...) → void"],returnedTypes:["void"]},{name:"map.new<type,type>",desc:["Creates a new map object: a collection that consists of key-value pairs, where all keys are of the `keyType`, and all values are of the `valueType`.","`keyType` can only be a primitive type, i.e., one of the following: [int](#op_int), [float](#op_float), [bool](#op_bool), [string](#op_string), [color](#op_color).","`valueType` can be of any type except `array<>`, `matrix<>`, and `map<>`. User-defined types are allowed, even if they have `array<>`, `matrix<>`, or `map<>` as one of their fields."],args:[],returns:["The ID of a map object which may be used in other map.*() functions."],syntax:["map.new<keyType, valueType>() → map<keyType, valueType>"],examples:["//@version=5",'indicator("map.new<string, int> example")',"a = map.new<string, int>()",'a.put("example", 1)','label.new(bar_index, close, str.tostring(a.get("example")))'],remarks:["Each key is unique and can only appear once. When adding a new value with a key that the map already contains, that value replaces the old value associated with the key.","Maps maintain insertion order. Note that the order does not change when inserting a pair with a `key` that's already in the map. The new pair replaces the existing pair with the `key` in such cases."],seeAlso:["[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.get](#fun_map.get)","[array.new<type>](#fun_array.new<type>)"],template:!0},{name:"map.copy",desc:["Creates a copy of an existing map."],returns:["A copy of the `id` map."],args:[{name:"id",desc:"A map object to copy.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],syntax:["map.copy(id) → map<keyType, valueType>"],examples:["//@version=5",'indicator("map.copy example")',"a = map.new<string, int>()",'a.put("example", 1)',"b = map.copy(a)","a := map.new<string, int>()",'a.put("example", 2)','plot(a.get("example"))','plot(b.get("example"))'],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.get](#fun_map.get)","[map.size](#fun_map.size)"]},{name:"map.size",desc:["Returns the number of key-value pairs in the `id` map."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.size example")',"a = map.new<int, int>()","size = 10","for i = 0 to size"," a.put(i, size-i)","plot(map.size(a))"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.get](#fun_map.get)"],syntax:["map.size(id) → series int"],returnedTypes:["series int"]},{name:"map.get",desc:["Returns the value associated with the specified `key` in the `id` map."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"},{name:"key",desc:"The key of the value to retrieve.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.get example")',"a = map.new<int, int>()","size = 10","for i = 0 to size"," a.put(i, size-i)","plot(map.get(a, 1))"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.contains](#fun_map.contains)"],syntax:["map.get(id, key) → <value_type>"],returnedTypes:[]},{name:"map.contains",desc:["Returns [true](#var_true) if the `key` was found in the `id` map, [false](#var_false) otherwise."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"},{name:"key",desc:"The key to search in the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.includes example")',"a = map.new<string, float>()",'a.put("open", open)',"p = close",'if map.contains(a, "open")',' p := a.get("open")',"plot(p)"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.size](#fun_map.size)"],syntax:["map.contains(id, key) → series bool"],returnedTypes:["series bool"]},{name:"map.keys",desc:["Returns an array of all the keys in the `id` map. The resulting array is a copy and any changes to it are not reflected in the original map."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.keys example")',"a = map.new<string, float>()",'a.put("open", open)','a.put("high", high)','a.put("low", low)','a.put("close", close)',"keys = map.keys(a)","ohlc = 0.0","for key in keys"," ohlc += a.get(key)","plot(ohlc/4)"],remarks:["Maps maintain insertion order. The elements within the array returned by this function will also be in the insertion order."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.get](#fun_map.get)","[map.values](#fun_map.values)","[map.size](#fun_map.size)"],syntax:["map.keys(id) → type[]"],returnedTypes:["array<>"]},{name:"map.values",desc:["Returns an array of all the values in the `id` map. The resulting array is a copy and any changes to it are not reflected in the original map."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.values example")',"a = map.new<string, float>()",'a.put("open", open)','a.put("high", high)','a.put("low", low)','a.put("close", close)',"values = map.values(a)","ohlc = 0.0","for value in values"," ohlc += value","plot(ohlc/4)"],remarks:["Maps maintain insertion order. The elements within the array returned by this function will also be in the insertion order."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.get](#fun_map.get)","[map.keys](#fun_map.keys)","[map.size](#fun_map.size)"],syntax:["map.values(id) → type[]"],returnedTypes:["array<>"]},{name:"map.put",desc:["Puts a new key-value pair into the `id` map."],returns:["The previous value associated with `key` if the key was already present in the map, or [na](#var_na) if the key is new."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"},{name:"key",desc:"The key to put into the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"},{name:"value",desc:"The key value to put into the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.put example")',"a = map.new<string, float>()",'map.put(a, "first", 10)','map.put(a, "second", 15)','prevFirst = map.put(a, "first", 20)','currFirst = a.get("first")',"plot(prevFirst)","plot(currFirst)"],remarks:["Maps maintain insertion order. Note that the order does not change when inserting a pair with a `key` that's already in the map. The new pair replaces the existing pair with the `key` in such cases."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put_all](#fun_map.put_all)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.put(id, key, value) → <value_type>"],returnedTypes:[]},{name:"map.put_all",desc:["Puts all key-value pairs from the `id2` map into the `id` map."],args:[{name:"id",desc:"A map object to append to.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"},{name:"id2",desc:"A map object to be appended.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.put_all example")',"a = map.new<string, float>()","b = map.new<string, float>()",'a.put("first", 10)','a.put("second", 15)','b.put("third", 20)',"map.put_all(a, b)",'plot(a.get("third"))'],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.put_all(id, id2) → void"],returnedTypes:["void"]},{name:"map.remove",desc:["Removes a key-value pair from the `id` map."],returns:["The previous value associated with `key` if the key was present in the map, or [na](#var_na) if there was no such key."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"},{name:"key",desc:"The key of the pair to remove from the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.remove example")',"a = map.new<string, color>()",'a.put("firstColor", color.green)','oldColorValue = map.remove(a, "firstColor")',"plot(close, color = oldColorValue)"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.clear](#fun_map.clear)"],syntax:["map.remove(id, key) → <value_type>"],returnedTypes:[]},{name:"map.clear",desc:["Clears the map, removing all key-value pairs from it."],args:[{name:"id",desc:"A map object.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.clear example")',"oddMap = map.new<int, bool>()","oddMap.put(1, true)","oddMap.put(2, false)","oddMap.put(3, true)","map.clear(oddMap)","plot(oddMap.size())"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put_all](#fun_map.put_all)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.clear(id) → void"],returnedTypes:["void"]},{name:"polyline.new",seeAlso:["[chart.point.new](#fun_chart.point.new)"],desc:["Creates a new [polyline](#op_polyline) instance and displays it on the chart, sequentially connecting all of the points in the `points` array with line segments. The segments in the drawing can be straight or curved depending on the `curved` parameter."],returns:["The ID of a new polyline object that a script can use in other `polyline.*()` functions."],args:[{name:"points",desc:"An array of [chart.point](#op_chart.point) objects for the drawing to sequentially connect.",required:!0,allowedTypeIDs:["chart.point[]"],displayType:"chart.point[]"},{name:"curved",desc:"If [true](#var_true), the drawing will connect all points from the `points` array using curved line segments. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"closed",desc:"If [true](#var_true), the drawing will also connect the first point to the last point from the `points` array, resulting in a closed polyline. Optional. The default is [false](#var_false).",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"},{name:"xloc",desc:"Determines the field of the [chart.point](#op_chart.point) objects in the `points` array that the polyline will use for its x-coordinates. If [xloc.bar_index](#var_xloc.bar_index), the polyline will use the `index` field from each point. If [xloc.bar_time](#var_xloc.bar_time), it will use the `time` field. Optional. The default is [xloc.bar_index](#var_xloc.bar_index).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"line_color",desc:"The color of the line segments. Optional. The default is [color.blue](#var_color.blue).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"fill_color",desc:"The fill color of the polyline. Optional. The default is [na](#var_na).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"line_style",desc:"The style of the polyline. Possible values: [line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed), [line.style_arrow_left](#var_line.style_arrow_left), [line.style_arrow_right](#var_line.style_arrow_right), [line.style_arrow_both](#var_line.style_arrow_both). Optional. The default is [line.style_solid](#var_line.style_solid).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"line_width",desc:"The width of the line segments, expressed in pixels. Optional. The default is 1.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("Polylines example", overlay = true)',"","//@variable If `true`, connects all points in the polyline with curved line segments. ",'bool curvedInput = input.bool(false, "Curve Polyline")',"//@variable If `true`, connects the first point in the polyline to the last point.",'bool closedInput = input.bool(true, "Close Polyline")',"//@variable The color of the space filled by the polyline.",'color fillcolor = input.color(color.new(color.blue, 90), "Fill Color")',"","// Time and price inputs for the polyline's points. ",'p1x = input.time(0, "p1", confirm = true, inline = "p1")','p1y = input.price(0, " ", confirm = true, inline = "p1")','p2x = input.time(0, "p2", confirm = true, inline = "p2")','p2y = input.price(0, " ", confirm = true, inline = "p2")','p3x = input.time(0, "p3", confirm = true, inline = "p3")','p3y = input.price(0, " ", confirm = true, inline = "p3")','p4x = input.time(0, "p4", confirm = true, inline = "p4")','p4y = input.price(0, " ", confirm = true, inline = "p4")','p5x = input.time(0, "p5", confirm = true, inline = "p5")','p5y = input.price(0, " ", confirm = true, inline = "p5")',"","if barstate.islastconfirmedhistory"," //@variable An array of `chart.point` objects for the new polyline."," var points = array.new<chart.point>()"," // Push new `chart.point` instances into the `points` array."," points.push(chart.point.from_time(p1x, p1y))"," points.push(chart.point.from_time(p2x, p2y))"," points.push(chart.point.from_time(p3x, p3y))"," points.push(chart.point.from_time(p4x, p4y))"," points.push(chart.point.from_time(p5x, p5y))"," // Add labels for each `chart.point` in `points`.",' l1p1 = label.new(points.get(0), text = "p1", xloc = xloc.bar_time, color = na)',' l1p2 = label.new(points.get(1), text = "p2", xloc = xloc.bar_time, color = na)',' l2p1 = label.new(points.get(2), text = "p3", xloc = xloc.bar_time, color = na)',' l2p2 = label.new(points.get(3), text = "p4", xloc = xloc.bar_time, color = na)'," // Create a new polyline that connects each `chart.point` in the `points` array, starting from the first."," polyline.new(points, curved = curvedInput, closed = closedInput, fill_color = fillcolor, xloc = xloc.bar_time)"],syntax:["polyline.new(points, curved, closed, xloc, line_color, fill_color, line_style, line_width) → series polyline"],returnedTypes:["series polyline"]},{name:"polyline.delete",desc:["Deletes the specified [polyline](#op_polyline) object. It has no effect if the `id` doesn't exist."],args:[{name:"id",desc:"The polyline ID to delete.",required:!0,allowedTypeIDs:["series polyline"],displayType:"series polyline"}],syntax:["polyline.delete(id) → void"],returnedTypes:["void"]}],methods:[{name:"copy",desc:["Clones the box object."],args:[],examples:["//@version=5","indicator('Last 50 bars price ranges', overlay = true)","LOOKBACK = 50","highest = ta.highest(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","if barstate.islastconfirmedhistory"," var BoxLast = box.new(bar_index[LOOKBACK], highest, bar_index, lowest, bgcolor = color.new(color.green, 80))"," var BoxPrev = box.copy(BoxLast)"," box.set_lefttop(BoxPrev, bar_index[LOOKBACK * 2], highest[50])"," box.set_rightbottom(BoxPrev, bar_index[LOOKBACK], lowest[50])"," box.set_bgcolor(BoxPrev, color.new(color.red, 80))"],seeAlso:["[box.new](#fun_box.new)","[box.delete](#fun_box.delete)"],syntax:["box.copy(id) → series box"],returnedTypes:["series box"],originalName:"box.copy",thisType:["series box"]},{name:"delete",desc:["Deletes the specified box object. If it has already been deleted, does nothing."],args:[],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.delete(id) → void"],returnedTypes:["void"],originalName:"box.delete",thisType:["series box"]},{name:"get_left",desc:["Returns the bar index or the UNIX time (depending on the last value used for 'xloc') of the left border of the box."],args:[],returns:["A bar index or a UNIX timestamp (in milliseconds)."],seeAlso:["[box.new](#fun_box.new)","[box.set_left](#fun_box.set_left)"],syntax:["box.get_left(id) → series int"],returnedTypes:["series int"],originalName:"box.get_left",thisType:["series box"]},{name:"get_right",desc:["Returns the bar index or the UNIX time (depending on the last value used for 'xloc') of the right border of the box."],args:[],returns:["A bar index or a UNIX timestamp (in milliseconds)."],seeAlso:["[box.new](#fun_box.new)","[box.set_right](#fun_box.set_right)"],syntax:["box.get_right(id) → series int"],returnedTypes:["series int"],originalName:"box.get_right",thisType:["series box"]},{name:"get_top",desc:["Returns the price value of the top border of the box."],args:[],returns:["The price value."],seeAlso:["[box.new](#fun_box.new)","[box.set_top](#fun_box.set_top)"],syntax:["box.get_top(id) → series float"],returnedTypes:["series float"],originalName:"box.get_top",thisType:["series box"]},{name:"get_bottom",desc:["Returns the price value of the bottom border of the box."],args:[],returns:["The price value."],seeAlso:["[box.new](#fun_box.new)","[box.set_bottom](#fun_box.set_bottom)"],syntax:["box.get_bottom(id) → series float"],returnedTypes:["series float"],originalName:"box.get_bottom",thisType:["series box"]},{name:"set_left",desc:["Sets the left coordinate of the box."],args:[{name:"left",desc:"Bar index or bar time of the left border. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)","[box.get_left](#fun_box.get_left)"],syntax:["box.set_left(id, left) → void"],returnedTypes:["void"],originalName:"box.set_left",thisType:["series box"]},{name:"set_lefttop",desc:["Sets the left and top coordinates of the box."],args:[{name:"left",desc:"Bar index or bar time of the left border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"top",desc:"Price value of the top border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_left](#fun_box.get_left)","[box.get_top](#fun_box.get_top)"],syntax:["box.set_lefttop(id, left, top) → void"],returnedTypes:["void"],originalName:"box.set_lefttop",thisType:["series box"]},{name:"set_right",desc:["Sets the right coordinate of the box."],args:[{name:"right",desc:"Bar index or bar time of the right border. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)","[box.get_right](#fun_box.get_right)"],syntax:["box.set_right(id, right) → void"],returnedTypes:["void"],originalName:"box.set_right",thisType:["series box"]},{name:"set_rightbottom",desc:["Sets the right and bottom coordinates of the box."],args:[{name:"right",desc:"Bar index or bar time of the right border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bottom",desc:"Price value of the bottom border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_right](#fun_box.get_right)","[box.get_bottom](#fun_box.get_bottom)"],syntax:["box.set_rightbottom(id, right, bottom) → void"],returnedTypes:["void"],originalName:"box.set_rightbottom",thisType:["series box"]},{name:"set_top",desc:["Sets the top coordinate of the box."],args:[{name:"top",desc:"Price value of the top border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_top](#fun_box.get_top)"],syntax:["box.set_top(id, top) → void"],returnedTypes:["void"],originalName:"box.set_top",thisType:["series box"]},{name:"set_bottom",desc:["Sets the bottom coordinate of the box."],args:[{name:"bottom",desc:"Price value of the bottom border.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[box.new](#fun_box.new)","[box.get_bottom](#fun_box.get_bottom)"],syntax:["box.set_bottom(id, bottom) → void"],returnedTypes:["void"],originalName:"box.set_bottom",thisType:["series box"]},{name:"set_border_color",desc:["Sets the border color of the box."],args:[{name:"color",desc:"New border color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_border_color(id, color) → void"],returnedTypes:["void"],originalName:"box.set_border_color",thisType:["series box"]},{name:"set_bgcolor",desc:["Sets the background color of the box."],args:[{name:"color",desc:"New background color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_bgcolor(id, color) → void"],returnedTypes:["void"],originalName:"box.set_bgcolor",thisType:["series box"]},{name:"set_border_width",desc:["Sets the border width of the box."],args:[{name:"width",desc:"Width of the four borders, in pixels.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[box.new](#fun_box.new)"],syntax:["box.set_border_width(id, width) → void"],returnedTypes:["void"],originalName:"box.set_border_width",thisType:["series box"]},{name:"set_border_style",desc:["Sets the border style of the box."],args:[{name:"style",desc:"New border style.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.new](#fun_box.new)","[line.style_solid](#var_line.style_solid), [line.style_dotted](#var_line.style_dotted), [line.style_dashed](#var_line.style_dashed)"],syntax:["box.set_border_style(id, style) → void"],returnedTypes:["void"],originalName:"box.set_border_style",thisType:["series box"]},{name:"set_extend",desc:["Sets extending type of the border of this box object. When [extend.none](#var_extend.none) is used, the horizontal borders start at the left border and end at the right border. With [extend.left](#var_extend.left) or [extend.right](#var_extend.right), the horizontal borders are extended indefinitely to the left or right of the box, respectively. With [extend.both](#var_extend.both), the horizontal borders are extended on both sides."],args:[{name:"extend",desc:"New extending type.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.new](#fun_box.new)","[extend.none](#var_extend.none), [extend.right](#var_extend.right), [extend.left](#var_extend.left), [extend.both](#var_extend.both)"],syntax:["box.set_extend(id, extend) → void"],returnedTypes:["void"],originalName:"box.set_extend",thisType:["series box"]},{name:"set_text_font_family",desc:["The function sets the font family of the text inside the box."],args:[{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the box font")',"if barstate.islastconfirmedhistory",' b = box.new(bar_index, open-ta.tr, bar_index-50, open-ta.tr*5, text="monospace")'," box.set_text_font_family(b, font.family_monospace)"],seeAlso:["[box.new](#fun_box.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["box.set_text_font_family(id, text_font_family) → void"],returnedTypes:["void"],originalName:"box.set_text_font_family",thisType:["series box"]},{name:"set_text_halign",desc:["The function sets the horizontal alignment of the box's text."],args:[{name:"text_halign",desc:"The horizontal alignment of a box's text. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_color](#fun_box.set_text_color)"],syntax:["box.set_text_halign(id, text_halign) → void"],returnedTypes:["void"],originalName:"box.set_text_halign",thisType:["series box"]},{name:"set_text_valign",desc:["The function sets the vertical alignment of a box's text."],args:[{name:"text_valign",desc:"The vertical alignment of the box's text. Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_color](#fun_box.set_text_color)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_valign(id, text_valign) → void"],returnedTypes:["void"],originalName:"box.set_text_valign",thisType:["series box"]},{name:"set_text_size",desc:["The function sets the size of the box's text."],args:[{name:"text_size",desc:"The size of the text. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_color](#fun_box.set_text_color)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_size(id, text_size) → void"],returnedTypes:["void"],originalName:"box.set_text_size",thisType:["series box"]},{name:"set_text",desc:["The function sets the text in the box."],args:[{name:"text",desc:"The text to be displayed inside the box.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text_color](#fun_box.set_text_color)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text(id, text) → void"],returnedTypes:["void"],originalName:"box.set_text",thisType:["series box"]},{name:"set_text_color",desc:["The function sets the color of the text inside the box."],args:[{name:"text_color",desc:"The color of the text.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)"],syntax:["box.set_text_color(id, text_color) → void"],returnedTypes:["void"],originalName:"box.set_text_color",thisType:["series box"]},{name:"copy",desc:["Clones the line object."],args:[],examples:["//@version=5","indicator('Last 100 bars price range', overlay = true)","LOOKBACK = 100","highest = ta.highest(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","if barstate.islastconfirmedhistory"," var lineTop = line.new(bar_index[LOOKBACK], highest, bar_index, highest, color = color.green)"," var lineBottom = line.copy(lineTop)"," line.set_y1(lineBottom, lowest)"," line.set_y2(lineBottom, lowest)"," line.set_color(lineBottom, color.red)"],returns:["New line ID object which may be passed to line.setXXX and line.getXXX functions."],seeAlso:["[line.new](#fun_line.new)","[line.delete](#fun_line.delete)"],syntax:["line.copy(id) → series line"],returnedTypes:["series line"],originalName:"line.copy",thisType:["series line"]},{name:"set_text_wrap",desc:["The function sets the mode of wrapping of the text inside the box."],args:[{name:"text_wrap",desc:"The mode of the wrapping. Possible values: [text.wrap_auto](#var_text.wrap_auto), [text.wrap_none](#var_text.wrap_none).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[box.set_text](#fun_box.set_text)","[box.set_text_size](#fun_box.set_text_size)","[box.set_text_valign](#fun_box.set_text_valign)","[box.set_text_halign](#fun_box.set_text_halign)","[box.set_text_color](#fun_box.set_text_color)"],syntax:["box.set_text_wrap(id, text_wrap) → void"],returnedTypes:["void"],originalName:"box.set_text_wrap",thisType:["series box"]},{name:"set_x1",desc:["Sets bar index or bar time (depending on the xloc) of the first point."],args:[{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_x1(id, x) → void"],returnedTypes:["void"],originalName:"line.set_x1",thisType:["series line"]},{name:"set_y1",desc:["Sets price of the first point"],args:[{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_y1(id, y) → void"],returnedTypes:["void"],originalName:"line.set_y1",thisType:["series line"]},{name:"set_xy1",desc:["Sets bar index/time and price of the first point."],args:[{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_xy1(id, x, y) → void"],returnedTypes:["void"],originalName:"line.set_xy1",thisType:["series line"]},{name:"set_x2",desc:["Sets bar index or bar time (depending on the xloc) of the second point."],args:[{name:"x",desc:"Bar index or bar time. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_x2(id, x) → void"],returnedTypes:["void"],originalName:"line.set_x2",thisType:["series line"]},{name:"set_y2",desc:["Sets price of the second point."],args:[{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_y2(id, y) → void"],returnedTypes:["void"],originalName:"line.set_y2",thisType:["series line"]},{name:"set_xy2",desc:["Sets bar index/time and price of the second point"],args:[{name:"x",desc:"Bar index or bar time.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"Price.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_xy2(id, x, y) → void"],returnedTypes:["void"],originalName:"line.set_xy2",thisType:["series line"]},{name:"set_xloc",desc:["Sets x-location and new bar index/time values."],args:[{name:"x1",desc:"Bar index or bar time of the first point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"x2",desc:"Bar index or bar time of the second point.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"xloc",desc:"New x-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[xloc.bar_index](#var_xloc.bar_index)","[xloc.bar_time](#var_xloc.bar_time)","[line.new](#fun_line.new)"],syntax:["line.set_xloc(id, x1, x2, xloc) → void"],returnedTypes:["void"],originalName:"line.set_xloc",thisType:["series line"]},{name:"set_extend",desc:["Sets extending type of this line object. If extend=[extend.none](#var_extend.none), draws segment starting at point (x1, y1) and ending at point (x2, y2). If extend is equal to [extend.right](#var_extend.right) or [extend.left](#var_extend.left), draws a ray starting at point (x1, y1) or (x2, y2), respectively. If extend=[extend.both](#var_extend.both), draws a straight line that goes through these points."],args:[{name:"extend",desc:"New extending type.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[extend.none](#var_extend.none)","[extend.right](#var_extend.right)","[extend.left](#var_extend.left)","[extend.both](#var_extend.both)","[line.new](#fun_line.new)"],syntax:["line.set_extend(id, extend) → void"],returnedTypes:["void"],originalName:"line.set_extend",thisType:["series line"]},{name:"set_color",desc:["Sets the line color"],args:[{name:"color",desc:"New line color",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_color(id, color) → void"],returnedTypes:["void"],originalName:"line.set_color",thisType:["series line"]},{name:"set_style",desc:["Sets the line style"],args:[{name:"style",desc:"New line style.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[line.style_solid](#var_line.style_solid)","[line.style_dotted](#var_line.style_dotted)","[line.style_dashed](#var_line.style_dashed)","[line.style_arrow_left](#var_line.style_arrow_left)","[line.style_arrow_right](#var_line.style_arrow_right)","[line.style_arrow_both](#var_line.style_arrow_both)","[line.new](#fun_line.new)"],syntax:["line.set_style(id, style) → void"],returnedTypes:["void"],originalName:"line.set_style",thisType:["series line"]},{name:"set_width",desc:["Sets the line width."],args:[{name:"width",desc:"New line width in pixels.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.set_width(id, width) → void"],returnedTypes:["void"],originalName:"line.set_width",thisType:["series line"]},{name:"delete",desc:["Deletes the specified line object. If it has already been deleted, does nothing."],args:[],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.delete(id) → void"],returnedTypes:["void"],originalName:"line.delete",thisType:["series line"]},{name:"get_x1",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of the first point of the line."],args:[],examples:["//@version=5",'indicator("line.get_x1")',"my_line = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time)","a = line.get_x1(my_line)","plot(time - line.get_x1(my_line)) //draws zero plot"],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_x1(id) → series int"],returnedTypes:["series int"],originalName:"line.get_x1",thisType:["series line"]},{name:"get_y1",desc:["Returns price of the first point of the line."],args:[],returns:["Price value."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_y1(id) → series float"],returnedTypes:["series float"],originalName:"line.get_y1",thisType:["series line"]},{name:"get_x2",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of the second point of the line."],args:[],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_x2(id) → series int"],returnedTypes:["series int"],originalName:"line.get_x2",thisType:["series line"]},{name:"get_y2",desc:["Returns price of the second point of the line."],args:[],returns:["Price value."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_y2(id) → series float"],returnedTypes:["series float"],originalName:"line.get_y2",thisType:["series line"]},{name:"get_price",desc:["Returns the price level of a line at a given bar index."],args:[{name:"x",desc:"Bar index for which price is required.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("GetPrice", overlay=true)',"var line l = na","if bar_index == 10"," l := line.new(0, high[5], bar_index, high)","plot(line.get_price(l, bar_index), color=color.green)"],returns:["Price value of line 'id' at bar index 'x'."],remarks:["The line is considered to have been created using 'extend=extend.both'.","This function can only be called for lines created using 'xloc.bar_index'. If you try to call it for a line created with 'xloc.bar_time', it will generate an error."],seeAlso:["[line.new](#fun_line.new)"],syntax:["line.get_price(id, x) → series float"],returnedTypes:["series float"],originalName:"line.get_price",thisType:["series line"]},{name:"copy",desc:["Clones the label object."],args:[],examples:["//@version=5","indicator('Last 100 bars highest/lowest', overlay = true)","LOOKBACK = 100","highest = ta.highest(LOOKBACK)","highestBars = ta.highestbars(LOOKBACK)","lowest = ta.lowest(LOOKBACK)","lowestBars = ta.lowestbars(LOOKBACK)","if barstate.islastconfirmedhistory"," var labelHigh = label.new(bar_index + highestBars, highest, str.tostring(highest), color = color.green)"," var labelLow = label.copy(labelHigh)"," label.set_xy(labelLow, bar_index + lowestBars, lowest)"," label.set_text(labelLow, str.tostring(lowest))"," label.set_color(labelLow, color.red)"," label.set_style(labelLow, label.style_label_up)"],returns:["New label ID object which may be passed to label.setXXX and label.getXXX functions."],seeAlso:["[label.new](#fun_label.new)","[label.delete](#fun_label.delete)"],syntax:["label.copy(id) → series label"],returnedTypes:["series label"],originalName:"label.copy",thisType:["series label"]},{name:"delete",desc:["Deletes the specified linefill object. If it has already been deleted, does nothing."],args:[],syntax:["linefill.delete(id) → void"],returnedTypes:["void"],originalName:"linefill.delete",thisType:["series linefill"]},{name:"set_color",desc:["The function sets the color of the linefill object passed to it."],args:[{name:"color",desc:"The color of the linefill object.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],syntax:["linefill.set_color(id, color) → void"],returnedTypes:["void"],originalName:"linefill.set_color",thisType:["series linefill"]},{name:"get_line1",desc:["Returns the ID of the first line used in the `id` linefill."],args:[],syntax:["linefill.get_line1(id) → series line"],returnedTypes:["series line"],originalName:"linefill.get_line1",thisType:["series linefill"]},{name:"get_line2",desc:["Returns the ID of the second line used in the `id` linefill."],args:[],syntax:["linefill.get_line2(id) → series line"],returnedTypes:["series line"],originalName:"linefill.get_line2",thisType:["series linefill"]},{name:"set_x",desc:["Sets bar index or bar time (depending on the xloc) of the label position."],args:[{name:"x",desc:"New bar index or bar time of the label position. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_x(id, x) → void"],returnedTypes:["void"],originalName:"label.set_x",thisType:["series label"]},{name:"set_y",desc:["Sets price of the label position"],args:[{name:"y",desc:"New price of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_y(id, y) → void"],returnedTypes:["void"],originalName:"label.set_y",thisType:["series label"]},{name:"set_xy",desc:["Sets bar index/time and price of the label position."],args:[{name:"x",desc:"New bar index or bar time of the label position. Note that objects positioned using [xloc.bar_index](#var_xloc.bar_index) cannot be drawn further than 500 bars into the future.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"y",desc:"New price of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_xy(id, x, y) → void"],returnedTypes:["void"],originalName:"label.set_xy",thisType:["series label"]},{name:"set_xloc",desc:["Sets x-location and new bar index/time value."],args:[{name:"x",desc:"New bar index or bar time of the label position.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"xloc",desc:"New x-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[xloc.bar_index](#var_xloc.bar_index)","[xloc.bar_time](#var_xloc.bar_time)","[label.new](#fun_label.new)"],syntax:["label.set_xloc(id, x, xloc) → void"],returnedTypes:["void"],originalName:"label.set_xloc",thisType:["series label"]},{name:"set_yloc",desc:["Sets new y-location calculation algorithm."],args:[{name:"yloc",desc:"New y-location value.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[yloc.price](#var_yloc.price)","[yloc.abovebar](#var_yloc.abovebar)","[yloc.belowbar](#var_yloc.belowbar)","[label.new](#fun_label.new)"],syntax:["label.set_yloc(id, yloc) → void"],returnedTypes:["void"],originalName:"label.set_yloc",thisType:["series label"]},{name:"set_text",desc:["Sets label text"],args:[{name:"text",desc:"New label text.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_text(id, text) → void"],returnedTypes:["void"],originalName:"label.set_text",thisType:["series label"]},{name:"set_text_font_family",desc:["The function sets the font family of the text inside the label."],args:[{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the label font")',"if barstate.islastconfirmedhistory",' l = label.new(bar_index, 0, "monospace", yloc=yloc.abovebar)'," label.set_text_font_family(l, font.family_monospace)"],seeAlso:["[label.new](#fun_label.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["label.set_text_font_family(id, text_font_family) → void"],returnedTypes:["void"],originalName:"label.set_text_font_family",thisType:["series label"]},{name:"set_color",desc:["Sets label border and arrow color."],args:[{name:"color",desc:"New label border and arrow color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_color(id, color) → void"],returnedTypes:["void"],originalName:"label.set_color",thisType:["series label"]},{name:"set_style",desc:["Sets label style."],args:[{name:"style",desc:"New label style. Possible values: [label.style_none](#var_label.style_none), [label.style_xcross](#var_label.style_xcross), [label.style_cross](#var_label.style_cross), [label.style_triangleup](#var_label.style_triangleup), [label.style_triangledown](#var_label.style_triangledown), [label.style_flag](#var_label.style_flag), [label.style_circle](#var_label.style_circle), [label.style_arrowup](#var_label.style_arrowup), [label.style_arrowdown](#var_label.style_arrowdown), [label.style_label_up](#var_label.style_label_up), [label.style_label_down](#var_label.style_label_down), [label.style_label_left](#var_label.style_label_left), [label.style_label_right](#var_label.style_label_right), [label.style_label_lower_left](#var_label.style_label_lower_left), [label.style_label_lower_right](#var_label.style_label_lower_right), [label.style_label_upper_left](#var_label.style_label_upper_left), [label.style_label_upper_right](#var_label.style_label_upper_right), [label.style_label_center](#var_label.style_label_center), [label.style_square](#var_label.style_square), [label.style_diamond](#var_label.style_diamond), [label.style_text_outline](#var_label.style_text_outline).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_style(id, style) → void"],returnedTypes:["void"],originalName:"label.set_style",thisType:["series label"]},{name:"set_textcolor",desc:["Sets color of the label text."],args:[{name:"textcolor",desc:"New text color.",required:!0,allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_textcolor(id, textcolor) → void"],returnedTypes:["void"],originalName:"label.set_textcolor",thisType:["series label"]},{name:"set_size",desc:["Sets arrow and text size of the specified label object."],args:[{name:"size",desc:"Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge). Default value is [size.auto](#var_size.auto).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[size.auto](#var_size.auto)","[size.tiny](#var_size.tiny)","[size.small](#var_size.small)","[size.normal](#var_size.normal)","[size.large](#var_size.large)","[size.huge](#var_size.huge)","[label.new](#fun_label.new)"],syntax:["label.set_size(id, size) → void"],returnedTypes:["void"],originalName:"label.set_size",thisType:["series label"]},{name:"set_textalign",desc:["Sets the alignment for the label text."],args:[{name:"textalign",desc:"Label text alignment. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[text.align_left](#var_text.align_left)","[text.align_center](#var_text.align_center)","[text.align_right](#var_text.align_right)","[label.new](#fun_label.new)"],syntax:["label.set_textalign(id, textalign) → void"],returnedTypes:["void"],originalName:"label.set_textalign",thisType:["series label"]},{name:"set_tooltip",desc:["Sets the tooltip text."],args:[{name:"tooltip",desc:"Tooltip text.",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.set_tooltip(id, tooltip) → void"],returnedTypes:["void"],originalName:"label.set_tooltip",thisType:["series label"]},{name:"delete",desc:["Deletes the specified label object. If it has already been deleted, does nothing."],args:[],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.delete(id) → void"],returnedTypes:["void"],originalName:"label.delete",thisType:["series label"]},{name:"get_x",desc:["Returns UNIX time or bar index (depending on the last xloc value set) of this label's position."],args:[],examples:["//@version=5",'indicator("label.get_x")','my_label = label.new(time, open, text="Open bar text", xloc=xloc.bar_time)',"a = label.get_x(my_label)","plot(time - label.get_x(my_label)) //draws zero plot"],returns:["UNIX timestamp (in milliseconds) or bar index."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_x(id) → series int"],returnedTypes:["series int"],originalName:"label.get_x",thisType:["series label"]},{name:"get_y",desc:["Returns price of this label's position."],args:[],returns:["Floating point value representing price."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_y(id) → series float"],returnedTypes:["series float"],originalName:"label.get_y",thisType:["series label"]},{name:"get_text",desc:["Returns the text of this label object."],args:[],examples:["//@version=5",'indicator("label.get_text")','my_label = label.new(time, open, text="Open bar text", xloc=xloc.bar_time)',"a = label.get_text(my_label)",'label.new(time, close, text = a + " new", xloc=xloc.bar_time)'],returns:["String object containing the text of this label."],seeAlso:["[label.new](#fun_label.new)"],syntax:["label.get_text(id) → series string"],returnedTypes:["series string"],originalName:"label.get_text",thisType:["series label"]},{name:"copy",desc:["The function creates a copy of an existing array."],syntax:["array.copy(id) → array<type>"],args:[],examples:["//@version=5",'indicator("array.copy example")',"length = 5","a = array.new_float(length, close)","b = array.copy(a)","a := array.new_float(length, open)","plot(array.sum(a) / length)","plot(array.sum(b) / length)"],returns:["A copy of an array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],originalName:"array.copy",thisType:["array<>"]},{name:"slice",desc:["The function creates a slice from an existing array. If an object from the slice changes, the changes are applied to both the new and the original arrays."],syntax:["array.slice(id, index_from, index_to) → array<type>"],args:[{name:"index_from",desc:"Zero-based index at which to begin extraction.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"index_to",desc:"Zero-based index before which to end extraction. The function extracts up to but not including the element with this index.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.slice example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","// take elements from 0 to 4","// *note that changes in slice also modify original array ","slice = array.slice(a, 0, 5)","plot(array.sum(a) / 10)","plot(array.sum(slice) / 5)"],returns:["A shallow copy of an array's slice."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],originalName:"array.slice",thisType:["array<>"]},{name:"size",desc:["The function returns the number of elements in an array."],args:[],examples:["//@version=5",'indicator("array.size example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","// note that changes in slice also modify original array","slice = array.slice(a, 0, 5)","array.push(slice, open)","// size was changed in slice and in original array","plot(array.size(a))","plot(array.size(slice))"],returns:["The number of elements in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sum](#fun_array.sum)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],syntax:["array.size(id) → series int"],returnedTypes:["series int"],originalName:"array.size",thisType:["array<>"]},{name:"first",desc:["Returns the array's first element. Throws a runtime error if the array is empty."],syntax:["array.first(id) → series <type>"],args:[],examples:["//@version=5",'indicator("array.first example")',"arr = array.new_int(3, 10)","plot(array.first(arr))"],seeAlso:["[array.last](#fun_array.last)","[array.get](#fun_array.get)"],originalName:"array.first",thisType:["array<>"]},{name:"last",desc:["Returns the array's last element. Throws a runtime error if the array is empty."],syntax:["array.last(id) → series <type>"],args:[],examples:["//@version=5",'indicator("array.last example")',"arr = array.new_int(3, 10)","plot(array.last(arr))"],seeAlso:["[array.first](#fun_array.first)","[array.get](#fun_array.get)"],originalName:"array.last",thisType:["array<>"]},{name:"every",desc:["Returns [true](#var_true) if all elements of the `id` array are [true](#var_true), [false](#var_false) otherwise."],args:[],remarks:["This function also works with arrays of [int](#op_int) and [float](#op_float) types, in which case zero values are considered [false](#var_false), and all others [true](#var_true)."],seeAlso:["[array.some](#fun_array.some)","[array.get](#fun_array.get)"],syntax:["array.every(id) → series bool"],returnedTypes:["series bool"],originalName:"array.every",thisType:["bool[]"]},{name:"some",desc:["Returns [true](#var_true) if at least one element of the `id` array is [true](#var_true), [false](#var_false) otherwise."],args:[],remarks:["This function also works with arrays of [int](#op_int) and [float](#op_float) types, in which case zero values are considered [false](#var_false), and all others [true](#var_true)."],seeAlso:["[array.every](#fun_array.every)","[array.get](#fun_array.get)"],syntax:["array.some(id) → series bool"],returnedTypes:["series bool"],originalName:"array.some",thisType:["bool[]"]},{name:"get",desc:["The function returns the value of the element at the specified index."],syntax:["array.get(id, index) → series <type>"],args:[{name:"index",desc:"The index of the element whose value is to be returned.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.get example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i] - open[i])","plot(array.get(a, 9))"],returns:["The array element's value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.slice](#fun_array.slice)","[array.sort](#fun_array.sort)"],originalName:"array.get",thisType:["array<>"]},{name:"min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id) → series float"],returnedTypes:["series float"],originalName:"array.min",thisType:["float[]","int[]"]},{name:"min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id) → series int"],returnedTypes:["series int"],originalName:"array.min",thisType:["float[]","int[]"]},{name:"min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"nth",desc:"The nth smallest value to return, where zero is the smallest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id, nth) → series float"],returnedTypes:["series float"],originalName:"array.min",thisType:["float[]","int[]"]},{name:"min",desc:["The function returns the smallest value, or the nth smallest value in a given array."],args:[{name:"nth",desc:"The nth smallest value to return, where zero is the smallest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.min")',"a = array.from(5, -2, 0, 9, 1)","secondLowest = array.min(a, 1) // 0","plot(secondLowest)"],returns:["The smallest or the nth smallest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.min(id, nth) → series int"],returnedTypes:["series int"],originalName:"array.min",thisType:["float[]","int[]"]},{name:"max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id) → series float"],returnedTypes:["series float"],originalName:"array.max",thisType:["float[]","int[]"]},{name:"max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id) → series int"],returnedTypes:["series int"],originalName:"array.max",thisType:["float[]","int[]"]},{name:"max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"nth",desc:"The nth greatest value to return, where zero is the greatest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id, nth) → series float"],returnedTypes:["series float"],originalName:"array.max",thisType:["float[]","int[]"]},{name:"max",desc:["The function returns the greatest value, or the nth greatest value in a given array."],args:[{name:"nth",desc:"The nth greatest value to return, where zero is the greatest. Optional. The default is zero.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.max")',"a = array.from(5, -2, 0, 9, 1)","thirdHighest = array.max(a, 2) // 1","plot(thirdHighest)"],returns:["The greatest or the nth greatest value in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.sum](#fun_array.sum)"],syntax:["array.max(id, nth) → series int"],returnedTypes:["series int"],originalName:"array.max",thisType:["float[]","int[]"]},{name:"range",desc:["The function returns the difference between the min and max values from a given array."],args:[],examples:["//@version=5",'indicator("array.range example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.range(a))"],returns:["The difference between the min and max values in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.range(id) → series float"],returnedTypes:["series float"],originalName:"array.range",thisType:["float[]","int[]"]},{name:"range",desc:["The function returns the difference between the min and max values from a given array."],args:[],examples:["//@version=5",'indicator("array.range example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.range(a))"],returns:["The difference between the min and max values in the array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.min](#fun_array.min)","[array.max](#fun_array.max)","[array.sum](#fun_array.sum)"],syntax:["array.range(id) → series int"],returnedTypes:["series int"],originalName:"array.range",thisType:["float[]","int[]"]},{name:"sum",desc:["The function returns the sum of an array's elements."],args:[],examples:["//@version=5",'indicator("array.sum example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.sum(a))"],returns:["The sum of the array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)"],syntax:["array.sum(id) → series float"],returnedTypes:["series float"],originalName:"array.sum",thisType:["float[]","int[]"]},{name:"sum",desc:["The function returns the sum of an array's elements."],args:[],examples:["//@version=5",'indicator("array.sum example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.sum(a))"],returns:["The sum of the array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)"],syntax:["array.sum(id) → series int"],returnedTypes:["series int"],originalName:"array.sum",thisType:["float[]","int[]"]},{name:"set",desc:["The function sets the value of the element at the specified index."],args:[{name:"index",desc:"The index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The new value to be set.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.set example")',"a = array.new_float(10)","for i = 0 to 9"," array.set(a, i, close[i])","plot(array.sum(a) / 10)"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.get](#fun_array.get)","[array.slice](#fun_array.slice)"],syntax:["array.set(id, index, value) → void"],returnedTypes:["void"],originalName:"array.set",thisType:["array<>"]},{name:"fill",desc:["The function sets elements of an array to a single value. If no index is specified, all elements are set. If only a start index (default 0) is supplied, the elements starting at that index are set. If both index parameters are used, the elements from the starting index up to but not including the end index (default na) are set."],args:[{name:"value",desc:"Value to fill the array with.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"},{name:"index_from",desc:"Start index, default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"index_to",desc:"End index, default is na. Must be one greater than the index of the last element to set.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.fill example")',"a = array.new_float(10)","array.fill(a, close)","plot(array.sum(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.slice](#fun_array.slice)"],syntax:["array.fill(id, value, index_from, index_to) → void"],returnedTypes:["void"],originalName:"array.fill",thisType:["array<>"]},{name:"insert",desc:["The function changes the contents of an array by adding new elements in place."],args:[{name:"index",desc:"The index at which to insert the value.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The value to add to the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.insert example")',"a = array.new_float(5, close)","array.insert(a, 0, open)","plot(array.get(a, 5))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.insert(id, index, value) → void"],returnedTypes:["void"],originalName:"array.insert",thisType:["array<>"]},{name:"join",desc:["The function creates and returns a new string by concatenating all the elements of an array, separated by the specified separator string."],args:[{name:"separator",desc:"The string used to separate each array element.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("array.join example")',"a = array.new_float(5, 5)",'label.new(bar_index, close, array.join(a, ","))'],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.join(id, separator) → series string"],returnedTypes:["series string"],originalName:"array.join",thisType:["float[]","int[]","string[]"]},{name:"push",desc:["The function appends a value to an array."],args:[{name:"value",desc:"The value of the element added to the end of the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.push example")',"a = array.new_float(5, 0)","array.push(a, open)","plot(array.get(a, 5))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)","[array.unshift](#fun_array.unshift)"],syntax:["array.push(id, value) → void"],returnedTypes:["void"],originalName:"array.push",thisType:["array<>"]},{name:"remove",desc:["The function changes the contents of an array by removing the element with the specified index."],syntax:["array.remove(id, index) → series <type>"],args:[{name:"index",desc:"The index of the element to remove.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("array.remove example")',"a = array.new_float(5,high)","removedEl = array.remove(a, 0)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.insert](#fun_array.insert)","[array.pop](#fun_array.pop)","[array.shift](#fun_array.shift)"],originalName:"array.remove",thisType:["array<>"]},{name:"pop",desc:["The function removes the last element from an array and returns its value."],syntax:["array.pop(id) → series <type>"],args:[],examples:["//@version=5",'indicator("array.pop example")',"a = array.new_float(5,high)","removedEl = array.pop(a)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)","[array.shift](#fun_array.shift)"],originalName:"array.pop",thisType:["array<>"]},{name:"clear",desc:["The function removes all elements from an array."],args:[],examples:["//@version=5",'indicator("array.clear example")',"a = array.new_float(5,high)","array.clear(a)","array.push(a, close)","plot(array.get(a,0))","plot(array.size(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.pop](#fun_array.pop)"],syntax:["array.clear(id) → void"],returnedTypes:["void"],originalName:"array.clear",thisType:["array<>"]},{name:"sort",desc:["The function sorts the elements of an array."],args:[{name:"order",desc:"The sort order: order.ascending (default) or order.descending.",allowedTypeIDs:["simple sort_order","input sort_order","const sort_order"],displayType:"simple sort_order"}],examples:["//@version=5",'indicator("array.sort example")',"a = array.new_float(0,0)","for i = 0 to 5"," array.push(a, high[i])","array.sort(a, order.descending)","if barstate.islast"," label.new(bar_index, close, str.tostring(a))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.sort(id, order) → void"],returnedTypes:["void"],originalName:"array.sort",thisType:["float[]","int[]","string[]"]},{name:"sort_indices",desc:["Returns an array of indices which, when used to index the original array, will access its elements in their sorted order. It does not modify the original array."],args:[{name:"order",desc:"The sort order: order.ascending or order.descending. Optional. The default is order.ascending.",allowedTypeIDs:["series sort_order","simple sort_order","input sort_order","const sort_order"],displayType:"series sort_order"}],examples:["//@version=5",'indicator("array.sort_indices")',"a = array.from(5, -2, 0, 9, 1)","sortedIndices = array.sort_indices(a) // [1, 2, 4, 0, 3]","indexOfSmallestValue = array.get(sortedIndices, 0) // 1","smallestValue = array.get(a, indexOfSmallestValue) // -2","plot(smallestValue)"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.sort_indices(id, order) → int[]"],returnedTypes:["int[]"],originalName:"array.sort_indices",thisType:["float[]","int[]","string[]"]},{name:"percentrank",desc:["Returns the percentile rank of the element at the specified `index`."],args:[{name:"index",desc:"The index of the element for which the percentile rank should be calculated.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],remarks:["Percentile rank is the percentage of how many elements in the array are less than or equal to the reference value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentrank(id, index) → series float"],returnedTypes:["series float"],originalName:"array.percentrank",thisType:["float[]","int[]"]},{name:"percentrank",desc:["Returns the percentile rank of the element at the specified `index`."],args:[{name:"index",desc:"The index of the element for which the percentile rank should be calculated.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],remarks:["Percentile rank is the percentage of how many elements in the array are less than or equal to the reference value."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentrank(id, index) → series int"],returnedTypes:["series int"],originalName:"array.percentrank",thisType:["float[]","int[]"]},{name:"percentile_nearest_rank",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using the nearest-rank method."],args:[{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_nearest_rank(id, percentage) → series float"],returnedTypes:["series float"],originalName:"array.percentile_nearest_rank",thisType:["float[]","int[]"]},{name:"percentile_nearest_rank",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using the nearest-rank method."],args:[{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_nearest_rank(id, percentage) → series int"],returnedTypes:["series int"],originalName:"array.percentile_nearest_rank",thisType:["float[]","int[]"]},{name:"percentile_linear_interpolation",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using linear interpolation."],args:[{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring. Linear interpolation estimates the value between two ranks."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_linear_interpolation(id, percentage) → series float"],returnedTypes:["series float"],originalName:"array.percentile_linear_interpolation",thisType:["float[]","int[]"]},{name:"percentile_linear_interpolation",desc:["Returns the value for which the specified percentage of array values (percentile) are less than or equal to it, using linear interpolation."],args:[{name:"percentage",desc:"The percentage of values that must be equal or less than the returned value.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],remarks:["In statistics, the percentile is the percent of ranking items that appear at or below a certain score. This measurement shows the percentage of scores within a standard frequency distribution that is lower than the percentile rank you're measuring. Linear interpolation estimates the value between two ranks."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.percentile_linear_interpolation(id, percentage) → series int"],returnedTypes:["series int"],originalName:"array.percentile_linear_interpolation",thisType:["float[]","int[]"]},{name:"abs",desc:["Returns an array containing the absolute value of each element in the original array."],args:[],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.abs(id) → float[]"],returnedTypes:["float[]"],originalName:"array.abs",thisType:["float[]","int[]"]},{name:"abs",desc:["Returns an array containing the absolute value of each element in the original array."],args:[],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.abs(id) → int[]"],returnedTypes:["int[]"],originalName:"array.abs",thisType:["float[]","int[]"]},{name:"binary_search",desc:["The function returns the index of the value, or -1 if the value is not found. The array to search must be sorted in ascending order."],args:[{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],examples:["//@version=5",'indicator("array.binary_search")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search(a, 0) // 1","plot(position)"],remarks:["A binary search works on arrays pre-sorted in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search(id, val) → series int"],returnedTypes:["series int"],originalName:"array.binary_search",thisType:["float[]","int[]"]},{name:"binary_search_leftmost",desc:["The function returns the index of the value if it is found. When the value is not found, the function returns the index of the next smallest element to the left of where the value would lie if it was in the array. The array to search must be sorted in ascending order."],args:[{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("array.binary_search_leftmost")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search_leftmost(a, 3) // 2","plot(position)"]},{desc:[],examples:["//@version=5",'indicator("array.binary_search_leftmost, repetitive elements")',"a = array.from(4, 5, 5, 5)","// Returns the index of the first instance.","position = array.binary_search_leftmost(a, 5) ","plot(position) // Plots 1"]}],remarks:["A binary search works on arrays pre-sorted in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search_leftmost(id, val) → series int"],returnedTypes:["series int"],originalName:"array.binary_search_leftmost",thisType:["float[]","int[]"]},{name:"binary_search_rightmost",desc:["The function returns the index of the value if it is found. When the value is not found, the function returns the index of the element to the right of where the value would lie if it was in the array. The array must be sorted in ascending order."],args:[{name:"val",desc:"The value to search for in the array.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int","series float","simple float","input float","const float"],displayType:"series int/float"}],detailedDesc:[{desc:[],examples:["//@version=5",'indicator("array.binary_search_rightmost")',"a = array.from(5, -2, 0, 9, 1)","array.sort(a) // [-2, 0, 1, 5, 9]","position = array.binary_search_rightmost(a, 3) // 3","plot(position)"]},{desc:[],examples:["//@version=5",'indicator("array.binary_search_rightmost, repetitive elements")',"a = array.from(4, 5, 5, 5)","// Returns the index of the last instance.","position = array.binary_search_rightmost(a, 5) ","plot(position) // Plots 3"]}],remarks:["A binary search works on sorted arrays in ascending order. It begins by comparing an element in the middle of the array with the target value. If the element matches the target value, its position in the array is returned. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array. By doing this recursively, the algorithm progressively eliminates smaller and smaller portions of the array in which the target value cannot lie."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice)","[array.reverse](#fun_array.reverse)","[order.ascending](#var_order.ascending)","[order.descending](#var_order.descending)"],syntax:["array.binary_search_rightmost(id, val) → series int"],returnedTypes:["series int"],originalName:"array.binary_search_rightmost",thisType:["float[]","int[]"]},{name:"concat",desc:["The function is used to merge two arrays. It pushes all elements from the second array to the first array, and returns the first array."],syntax:["array.concat(id1, id2) → array<type>"],args:[{name:"id2",desc:"The second array object.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],examples:["//@version=5",'indicator("array.concat example")',"a = array.new_float(0,0)","b = array.new_float(0,0)","for i = 0 to 4"," array.push(a, high[i])"," array.push(b, low[i])","c = array.concat(a,b)","plot(array.size(a))","plot(array.size(b))","plot(array.size(c))"],returns:["The first array with merged elements from the second array."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.insert](#fun_array.insert)","[array.slice](#fun_array.slice),"],originalName:"array.concat",thisType:["array<>"]},{name:"avg",desc:["The function returns the mean of an array's elements."],args:[],examples:["//@version=5",'indicator("array.avg example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.avg(a))"],returns:["Mean of array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.stdev](#fun_array.stdev)"],syntax:["array.avg(id) → series float"],returnedTypes:["series float"],originalName:"array.avg",thisType:["float[]","int[]"]},{name:"avg",desc:["The function returns the mean of an array's elements."],args:[],examples:["//@version=5",'indicator("array.avg example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.avg(a))"],returns:["Mean of array's elements."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.stdev](#fun_array.stdev)"],syntax:["array.avg(id) → series int"],returnedTypes:["series int"],originalName:"array.avg",thisType:["float[]","int[]"]},{name:"stdev",desc:["The function returns the standard deviation of an array's elements."],args:[{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.stdev example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.stdev(a))"],returns:["The standard deviation of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)"],syntax:["array.stdev(id, biased) → series float"],returnedTypes:["series float"],originalName:"array.stdev",thisType:["float[]","int[]"]},{name:"stdev",desc:["The function returns the standard deviation of an array's elements."],args:[{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.stdev example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.stdev(a))"],returns:["The standard deviation of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)"],syntax:["array.stdev(id, biased) → series int"],returnedTypes:["series int"],originalName:"array.stdev",thisType:["float[]","int[]"]},{name:"variance",desc:["The function returns the variance of an array's elements."],args:[{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.variance example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.variance(a))"],returns:["The variance of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.stdev](#fun_array.stdev)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)","[array.covariance](#fun_array.covariance)"],syntax:["array.variance(id, biased) → series float"],returnedTypes:["series float"],originalName:"array.variance",thisType:["float[]","int[]"]},{name:"variance",desc:["The function returns the variance of an array's elements."],args:[{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.variance example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.variance(a))"],returns:["The variance of the array's elements."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.stdev](#fun_array.stdev)","[array.min](#fun_array.min)","[array.avg](#fun_array.avg)","[array.covariance](#fun_array.covariance)"],syntax:["array.variance(id, biased) → series int"],returnedTypes:["series int"],originalName:"array.variance",thisType:["float[]","int[]"]},{name:"covariance",desc:["The function returns the covariance of two arrays."],args:[{name:"id2",desc:"An array object.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"},{name:"biased",desc:"Determines which estimate should be used. Optional. The default is true.",allowedTypeIDs:["series bool","simple bool","input bool","const bool"],displayType:"series bool"}],examples:["//@version=5",'indicator("array.covariance example")',"a = array.new_float(0)","b = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])"," array.push(b, open[i])","plot(array.covariance(a, b))"],returns:["The covariance of two arrays."],remarks:["If `biased` is true, function will calculate using a biased estimate of the entire population, if false - unbiased estimate of a sample."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.max](#fun_array.max)","[array.stdev](#fun_array.stdev)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)"],syntax:["array.covariance(id1, id2, biased) → series float"],returnedTypes:["series float"],originalName:"array.covariance",thisType:["int[]","float[]"]},{name:"mode",desc:["The function returns the mode of an array's elements. If there are several values with the same frequency, it returns the smallest value."],args:[],examples:["//@version=5",'indicator("array.mode example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.mode(a))"],returns:["The most frequently occurring value from the `id` array. If none exists, returns the smallest value instead."],seeAlso:["[array.new_float](#fun_array.new_float)","[ta.mode](#fun_ta.mode)","[matrix.mode](#fun_matrix.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.mode(id) → series float"],returnedTypes:["series float"],originalName:"array.mode",thisType:["float[]","int[]"]},{name:"mode",desc:["The function returns the mode of an array's elements. If there are several values with the same frequency, it returns the smallest value."],args:[],examples:["//@version=5",'indicator("array.mode example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.mode(a))"],returns:["The most frequently occurring value from the `id` array. If none exists, returns the smallest value instead."],seeAlso:["[array.new_float](#fun_array.new_float)","[ta.mode](#fun_ta.mode)","[matrix.mode](#fun_matrix.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.mode(id) → series int"],returnedTypes:["series int"],originalName:"array.mode",thisType:["float[]","int[]"]},{name:"median",desc:["The function returns the median of an array's elements."],args:[],examples:["//@version=5",'indicator("array.median example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.median(a))"],returns:["The median of the array's elements."],seeAlso:["[array.median](#fun_array.median)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.median(id) → series float"],returnedTypes:["series float"],originalName:"array.median",thisType:["float[]","int[]"]},{name:"median",desc:["The function returns the median of an array's elements."],args:[],examples:["//@version=5",'indicator("array.median example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.median(a))"],returns:["The median of the array's elements."],seeAlso:["[array.median](#fun_array.median)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.min](#fun_array.min)"],syntax:["array.median(id) → series int"],returnedTypes:["series int"],originalName:"array.median",thisType:["float[]","int[]"]},{name:"standardize",desc:["The function returns the array of standardized elements."],args:[],examples:["//@version=5",'indicator("array.standardize example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","b = array.standardize(a)","plot(array.min(b))","plot(array.max(b))"],returns:["The array of standardized elements."],seeAlso:["[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.mode](#fun_array.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.stdev](#fun_array.stdev)"],syntax:["array.standardize(id) → float[]"],returnedTypes:["float[]"],originalName:"array.standardize",thisType:["float[]","int[]"]},{name:"standardize",desc:["The function returns the array of standardized elements."],args:[],examples:["//@version=5",'indicator("array.standardize example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","b = array.standardize(a)","plot(array.min(b))","plot(array.max(b))"],returns:["The array of standardized elements."],seeAlso:["[array.max](#fun_array.max)","[array.min](#fun_array.min)","[array.mode](#fun_array.mode)","[array.avg](#fun_array.avg)","[array.variance](#fun_array.variance)","[array.stdev](#fun_array.stdev)"],syntax:["array.standardize(id) → int[]"],returnedTypes:["int[]"],originalName:"array.standardize",thisType:["float[]","int[]"]},{name:"indexof",desc:["The function returns the index of the first occurrence of the value, or -1 if the value is not found."],args:[{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.indexof example")',"a = array.new_float(5,high)","index = array.indexof(a, high)","plot(index)"],returns:["The index of an element."],seeAlso:["[array.lastindexof](#fun_array.lastindexof)","[array.get](#fun_array.get)","[array.lastindexof](#fun_array.lastindexof)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.indexof(id, value) → series int"],returnedTypes:["series int"],originalName:"array.indexof",thisType:["array<>"]},{name:"lastindexof",desc:["The function returns the index of the last occurrence of the value, or -1 if the value is not found."],args:[{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.lastindexof example")',"a = array.new_float(5,high)","index = array.lastindexof(a, high)","plot(index)"],returns:["The index of an element."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.lastindexof(id, value) → series int"],returnedTypes:["series int"],originalName:"array.lastindexof",thisType:["array<>"]},{name:"includes",desc:["The function returns true if the value was found in an array, false otherwise."],args:[{name:"value",desc:"The value to search in the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.includes example")',"a = array.new_float(5,high)","p = close","if array.includes(a, high)"," p := open","plot(p)"],returns:["True if the value was found in the array, false otherwise."],seeAlso:["[array.new_float](#fun_array.new_float)","[array.indexof](#fun_array.indexof)","[array.shift](#fun_array.shift)","[array.remove](#fun_array.remove)","[array.insert](#fun_array.insert)"],syntax:["array.includes(id, value) → series bool"],returnedTypes:["series bool"],originalName:"array.includes",thisType:["array<>"]},{name:"shift",desc:["The function removes an array's first element and returns its value."],syntax:["array.shift(id) → series <type>"],args:[],examples:["//@version=5",'indicator("array.shift example")',"a = array.new_float(5,high)","removedEl = array.shift(a)","plot(array.size(a))","plot(removedEl)"],returns:["The value of the removed element."],seeAlso:["[array.unshift](#fun_array.unshift)","[array.set](#fun_array.set)","[array.push](#fun_array.push)","[array.remove](#fun_array.remove)","[array.includes](#fun_array.includes)"],originalName:"array.shift",thisType:["array<>"]},{name:"unshift",desc:["The function inserts the value at the beginning of the array."],args:[{name:"value",desc:"The value to add to the start of the array.",required:!0,allowedTypeIDs:[],displayType:"series <type of the array's elements>"}],examples:["//@version=5",'indicator("array.unshift example")',"a = array.new_float(5, 0)","array.unshift(a, open)","plot(array.get(a, 0))"],seeAlso:["[array.shift](#fun_array.shift)","[array.set](#fun_array.set)","[array.insert](#fun_array.insert)","[array.remove](#fun_array.remove)","[array.indexof](#fun_array.indexof)"],syntax:["array.unshift(id, value) → void"],returnedTypes:["void"],originalName:"array.unshift",thisType:["array<>"]},{name:"reverse",desc:["The function reverses an array. The first array element becomes the last, and the last array element becomes the first."],args:[],examples:["//@version=5",'indicator("array.reverse example")',"a = array.new_float(0)","for i = 0 to 9"," array.push(a, close[i])","plot(array.get(a, 0))","array.reverse(a)","plot(array.get(a, 0))"],seeAlso:["[array.new_float](#fun_array.new_float)","[array.sort](#fun_array.sort)","[array.push](#fun_array.push)","[array.set](#fun_array.set)","[array.avg](#fun_array.avg)"],syntax:["array.reverse(id) → void"],returnedTypes:["void"],originalName:"array.reverse",thisType:["array<>"]},{name:"delete",desc:["The function deletes a table."],args:[],examples:["//@version=5",'indicator("table.delete example")',"var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)","if barstate.islast",' table.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + str.tostring(open))',' table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + str.tostring(close), bgcolor=color.teal)',"if barstate.isrealtime"," table.delete(testTable)"],seeAlso:["[table.new](#fun_table.new)","[table.clear](#fun_table.clear)"],syntax:["table.delete(table_id) → void"],returnedTypes:["void"],originalName:"table.delete",thisType:["series table"]},{name:"set_position",desc:["The function sets the position of a table."],args:[{name:"position",desc:"Position of the table. Possible values are: [position.top_left](#var_position.top_left), [position.top_center](#var_position.top_center), [position.top_right](#var_position.top_right), [position.middle_left](#var_position.middle_left), [position.middle_center](#var_position.middle_center), [position.middle_right](#var_position.middle_right), [position.bottom_left](#var_position.bottom_left), [position.bottom_center](#var_position.bottom_center), [position.bottom_right](#var_position.bottom_right).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)"],syntax:["table.set_position(table_id, position) → void"],returnedTypes:["void"],originalName:"table.set_position",thisType:["series table"]},{name:"set_bgcolor",desc:["The function sets the background color of a table."],args:[{name:"bgcolor",desc:"The background color of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_bgcolor(table_id, bgcolor) → void"],returnedTypes:["void"],originalName:"table.set_bgcolor",thisType:["series table"]},{name:"set_frame_color",desc:["The function sets the color of the outer frame of a table."],args:[{name:"frame_color",desc:"The color of the frame of the table. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_border_color](#fun_table.set_border_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_frame_color(table_id, frame_color) → void"],returnedTypes:["void"],originalName:"table.set_frame_color",thisType:["series table"]},{name:"set_border_color",desc:["The function sets the color of the borders (excluding the outer frame) of the table's cells."],args:[{name:"border_color",desc:"The color of the borders. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_border_color(table_id, border_color) → void"],returnedTypes:["void"],originalName:"table.set_border_color",thisType:["series table"]},{name:"set_frame_width",desc:["The function set the width of the outer frame of a table."],args:[{name:"frame_width",desc:"The width of the outer frame of the table. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_border_width](#fun_table.set_border_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_frame_width(table_id, frame_width) → void"],returnedTypes:["void"],originalName:"table.set_frame_width",thisType:["series table"]},{name:"set_border_width",desc:["The function sets the width of the borders (excluding the outer frame) of the table's cells."],args:[{name:"border_width",desc:"The width of the borders. Optional. The default is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.clear](#fun_table.clear)","[table.delete](#fun_table.delete)","[table.new](#fun_table.new)","[table.set_frame_color](#fun_table.set_frame_color)","[table.set_frame_width](#fun_table.set_frame_width)","[table.set_bgcolor](#fun_table.set_bgcolor)","[table.set_border_color](#fun_table.set_border_color)","[table.set_position](#fun_table.set_position)"],syntax:["table.set_border_width(table_id, border_width) → void"],returnedTypes:["void"],originalName:"table.set_border_width",thisType:["series table"]},{name:"cell",desc:["The function defines a cell in the table and sets its attributes."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"The text to be displayed inside the cell. Optional. The default is empty string.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"width",desc:"The width of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the width based on the text inside the cell. Value 0 has the same effect.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"height",desc:"The height of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the height based on the text inside of the cell. Value 0 has the same effect.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_color",desc:"The color of the text. Optional. The default is [color.black](#var_color.black).",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"text_halign",desc:"The horizontal alignment of the cell's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_valign",desc:"The vertical alignment of the cell's text. Optional. The default value is [text.align_center](#var_text.align_center). Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_size",desc:"The size of the text. An optional parameter, the default value is [size.normal](#var_size.normal). Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"bgcolor",desc:"The background color of the text. Optional. The default is no color.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"},{name:"tooltip",desc:"The tooltip to be displayed inside the cell. Optional.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"},{name:"text_font_family",desc:"The font family of the text. Optional. The default value is [font.family_default](#var_font.family_default). Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],remarks:["This function does not create the table itself, but defines the table’s cells. To use it, you first need to create a table object with [table.new](#fun_table.new).","Each [table.cell](#fun_table.cell) call overwrites all previously defined properties of a cell. If you call [table.cell](#fun_table.cell) twice in a row, e.g., the first time with text='Test Text', and the second time with text_color=[color.red](#var_color.red) but without a new text argument, the default value of the 'text' being an empty string, it will overwrite 'Test Text', and your cell will display an empty string. If you want, instead, to modify any of the cell's properties, use the table.cell_set_*() functions.","A single script can only display one table in each of the possible locations. If [table.cell](#fun_table.cell) is used on several bars to change the same attribute of a cell (e.g. change the background color of the cell to red on the first bar, then to yellow on the second bar), only the last change will be reflected in the table, i.e., the cell’s background will be yellow. Avoid unnecessary setting of cell properties by enclosing function calls in an [if](#op_if) [barstate.islast](#var_barstate.islast) block whenever possible, to restrict their execution to the last bar of the series."],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell(table_id, column, row, text, width, height, text_color, text_halign, text_valign, text_size, bgcolor, tooltip, text_font_family) → void"],returnedTypes:["void"],originalName:"table.cell",thisType:["series table"]},{name:"cell_set_text",desc:["The function sets the text in the specified cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text",desc:"The text to be displayed inside the cell.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("TABLE example")',"var tLog = table.new(position = position.top_left, rows = 1, columns = 2, bgcolor = color.yellow, border_width=1)",'table.cell(tLog, row = 0, column = 0, text = "sometext", text_color = color.blue)','table.cell_set_text(tLog, row = 0, column = 0, text = "sometext")'],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text(table_id, column, row, text) → void"],returnedTypes:["void"],originalName:"table.cell_set_text",thisType:["series table"]},{name:"cell_set_text_font_family",desc:["The function sets the font family of the text inside the cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_font_family",desc:"The font family of the text. Possible values: [font.family_default](#var_font.family_default), [font.family_monospace](#var_font.family_monospace).",required:!0,allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("Example of setting the table cell font")',"var t = table.new(position.top_left, rows = 1, columns = 1)",'table.cell(t, 0, 0, "monospace", text_color = color.blue)',"table.cell_set_text_font_family(t, 0, 0, font.family_monospace)"],seeAlso:["[table.new](#fun_table.new)","[font.family_default](#var_font.family_default)","[font.family_monospace](#var_font.family_monospace)"],syntax:["table.cell_set_text_font_family(table_id, column, row, text_font_family) → void"],returnedTypes:["void"],originalName:"table.cell_set_text_font_family",thisType:["series table"]},{name:"cell_set_tooltip",desc:["The function sets the tooltip in the specified cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"tooltip",desc:"The tooltip to be displayed inside the cell.",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],examples:["//@version=5",'indicator("TABLE example")',"var tLog = table.new(position = position.top_left, rows = 1, columns = 2, bgcolor = color.yellow, border_width=1)",'table.cell(tLog, row = 0, column = 0, text = "sometext", text_color = color.blue)','table.cell_set_tooltip(tLog, row = 0, column = 0, tooltip = "sometext")'],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_text](#fun_table.cell_set_text)"],syntax:["table.cell_set_tooltip(table_id, column, row, tooltip) → void"],returnedTypes:["void"],originalName:"table.cell_set_tooltip",thisType:["series table"]},{name:"cell_set_width",desc:["The function sets the width of the cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"width",desc:"The width of the cell as a % of the chart window. Passing 0 auto-adjusts the width based on the text inside of the cell.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_width(table_id, column, row, width) → void"],returnedTypes:["void"],originalName:"table.cell_set_width",thisType:["series table"]},{name:"cell_set_height",desc:["The function sets the height of cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"height",desc:"The height of the cell as a % of the chart window. Passing 0 auto-adjusts the height based on the text inside of the cell.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_height(table_id, column, row, height) → void"],returnedTypes:["void"],originalName:"table.cell_set_height",thisType:["series table"]},{name:"cell_set_text_color",desc:["The function sets the color of the text inside the cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_color",desc:"The color of the text.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_color(table_id, column, row, text_color) → void"],returnedTypes:["void"],originalName:"table.cell_set_text_color",thisType:["series table"]},{name:"cell_set_text_halign",desc:["The function sets the horizontal alignment of the cell's text."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_halign",desc:"The horizontal alignment of a cell's text. Possible values: [text.align_left](#var_text.align_left), [text.align_center](#var_text.align_center), [text.align_right](#var_text.align_right).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_halign(table_id, column, row, text_halign) → void"],returnedTypes:["void"],originalName:"table.cell_set_text_halign",thisType:["series table"]},{name:"cell_set_text_valign",desc:["The function sets the vertical alignment of a cell's text."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_valign",desc:"The vertical alignment of the cell's text. Possible values: [text.align_top](#var_text.align_top), [text.align_center](#var_text.align_center), [text.align_bottom](#var_text.align_bottom).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_valign(table_id, column, row, text_valign) → void"],returnedTypes:["void"],originalName:"table.cell_set_text_valign",thisType:["series table"]},{name:"cell_set_text_size",desc:["The function sets the size of the cell's text."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"text_size",desc:"The size of the text. Possible values: [size.auto](#var_size.auto), [size.tiny](#var_size.tiny), [size.small](#var_size.small), [size.normal](#var_size.normal), [size.large](#var_size.large), [size.huge](#var_size.huge).",allowedTypeIDs:["series string","simple string","input string","const string"],displayType:"series string"}],seeAlso:["[table.cell_set_bgcolor](#fun_table.cell_set_bgcolor)","[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_text_size(table_id, column, row, text_size) → void"],returnedTypes:["void"],originalName:"table.cell_set_text_size",thisType:["series table"]},{name:"cell_set_bgcolor",desc:["The function sets the background color of the cell."],args:[{name:"column",desc:"The index of the cell's column. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row",desc:"The index of the cell's row. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"bgcolor",desc:"The background color of the cell.",allowedTypeIDs:["series color","simple color","input color","const color"],displayType:"series color"}],seeAlso:["[table.cell_set_height](#fun_table.cell_set_height)","[table.cell_set_text](#fun_table.cell_set_text)","[table.cell_set_text_color](#fun_table.cell_set_text_color)","[table.cell_set_text_halign](#fun_table.cell_set_text_halign)","[table.cell_set_text_size](#fun_table.cell_set_text_size)","[table.cell_set_text_valign](#fun_table.cell_set_text_valign)","[table.cell_set_width](#fun_table.cell_set_width)","[table.cell_set_tooltip](#fun_table.cell_set_tooltip)"],syntax:["table.cell_set_bgcolor(table_id, column, row, bgcolor) → void"],returnedTypes:["void"],originalName:"table.cell_set_bgcolor",thisType:["series table"]},{name:"clear",desc:["The function removes a cell or a sequence of cells from the table. The cells are removed in a rectangle shape where the start_column and start_row specify the top-left corner, and end_column and end_row specify the bottom-right corner."],args:[{name:"start_column",desc:"The index of the column of the first cell to delete. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"start_row",desc:"The index of the row of the first cell to delete. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_column",desc:"The index of the column of the last cell to delete. Optional. The default is the argument used for start_column. Numbering starts at 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_row",desc:"The index of the row of the last cell to delete. Optional. The default is the argument used for start_row. Numbering starts at 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("A donut", overlay=true)',"if barstate.islast"," colNum = 8, rowNum = 8",' padding = "◯"'," donutTable = table.new(position.middle_right, colNum, rowNum)"," for c = 0 to colNum - 1"," for r = 0 to rowNum - 1"," table.cell(donutTable, c, r, text=padding, bgcolor=#face6e, text_color=color.new(color.black, 100))"," table.clear(donutTable, 2, 2, 5, 5)"],seeAlso:["[table.delete](#fun_table.delete)","[table.new](#fun_table.new)"],syntax:["table.clear(table_id, start_column, start_row, end_column, end_row) → void"],returnedTypes:["void"],originalName:"table.clear",thisType:["series table"]},{name:"row",desc:["The function creates a one-dimensional array from the elements of a matrix row."],args:[{name:"row",desc:"Index of the required row.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.row()` Example", "", true)',"",'// Create a 2x3 "float" matrix from `hlc3` values.',"m = matrix.new<float>(2, 3, hlc3)","","// Return an array with the values of the first row of the matrix.","a = matrix.row(m, 0)","","// Plot the first value from the array `a`.","plot(array.get(a, 0))"],returns:["An array ID containing the `row` values of the `id` matrix."],remarks:["Indexing of rows starts at 0."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[array.get](#fun_array.get)","[matrix.col](#fun_matrix.col)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.row(id, row) → type[]"],returnedTypes:["array<>"],originalName:"matrix.row",thisType:["matrix<>"]},{name:"col",desc:["The function creates a one-dimensional array from the elements of a matrix column."],args:[{name:"column",desc:"Index of the required column.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.col()` Example", "", true)',"",'// Create a 2x3 "float" matrix from `hlc3` values.',"m = matrix.new<float>(2, 3, hlc3)","","// Return an array with the values of the first column of matrix `m`.","a = matrix.col(m, 0)","","// Plot the first value from the array `a`.","plot(array.get(a, 0))"],returns:["An array ID containing the `column` values of the `id` matrix."],remarks:["Indexing of rows starts at 0."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[array.get](#fun_array.get)","[matrix.col](#fun_matrix.col)","[matrix.columns](#fun_matrix.columns)"],syntax:["matrix.col(id, column) → type[]"],returnedTypes:["array<>"],originalName:"matrix.col",thisType:["matrix<>"]},{name:"reshape",desc:["The function rebuilds the `id` matrix to `rows` x `cols` dimensions."],args:[{name:"rows",desc:"The number of rows of the reshaped matrix.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"columns",desc:"The number of columns of the reshaped matrix.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.reshape()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix."," var m1 = matrix.new<float>(2, 3)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 0, 2, 3)"," matrix.set(m1, 1, 0, 4)"," matrix.set(m1, 1, 1, 5)"," matrix.set(m1, 1, 2, 6)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Reshape the copy to a 3x2."," matrix.reshape(m2, 3, 2)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Reshaped matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.add_row](#fun_matrix.add_row)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.reshape(id, rows, columns) → void"],returnedTypes:["void"],originalName:"matrix.reshape",thisType:["matrix<>"]},{name:"get",desc:["The function returns the element with the specified index of the matrix."],args:[{name:"row",desc:"Index of the required row.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column",desc:"Index of the required column.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.get()` Example", "", true)',"",'// Create a 2x3 "float" matrix from the `hl2` values.',"m = matrix.new<float>(2, 3, hl2)","","// Return the value of the element at index [0, 0] of matrix `m`.","x = matrix.get(m, 0, 0)","","plot(x)"],returns:["The value of the element at the `row` and `column` index of the `id` matrix."],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.get(id, row, column) → <matrix_type>"],returnedTypes:[],originalName:"matrix.get",thisType:["matrix<>"]},{name:"set",desc:["The function assigns `value` to the element at the `row` and `column` of the `id` matrix."],args:[{name:"row",desc:"The row index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column",desc:"The column index of the element to be modified.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"value",desc:"The new value to be set.",required:!0,allowedTypeIDs:[],displayType:"series <type of the matrix's elements>"}],examples:["//@version=5",'indicator("`matrix.set()` Example")',"",'// Create a 2x3 "int" matrix containing values `4`.',"m = matrix.new<int>(2, 3, 4)","","// Replace the value of element at row 1 and column 2 with value `3`.","matrix.set(m, 0, 1, 3)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.set(id, row, column, value) → void"],returnedTypes:["void"],originalName:"matrix.set",thisType:["matrix<>"]},{name:"add_row",desc:["The function adds a row at the `row` index of the `id` matrix. The row can consist of `na` values, or an array can be used to provide values."],args:[{name:"row",desc:"The index of the row after which the new row will be inserted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:["Adding a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a row with `na` values to the matrix.","matrix.add_row(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `2`."," var a = array.from(1, 2)"," "," // Add the `a` array as the first row of the empty matrix."," matrix.add_row(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Indexing of rows and columns starts at zero. Rather than add rows to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.add_row(id, row) → void"],returnedTypes:["void"],originalName:"matrix.add_row",thisType:["matrix<>"]},{name:"add_row",desc:["The function adds a row at the `row` index of the `id` matrix. The row can consist of `na` values, or an array can be used to provide values."],args:[{name:"row",desc:"The index of the row after which the new row will be inserted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"array_id",desc:"An array to be inserted. Optional.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],detailedDesc:[{desc:["Adding a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a row with `na` values to the matrix.","matrix.add_row(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a row to the matrix"],examples:["//@version=5",'indicator("`matrix.add_row()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `2`."," var a = array.from(1, 2)"," "," // Add the `a` array as the first row of the empty matrix."," matrix.add_row(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Indexing of rows and columns starts at zero. Rather than add rows to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_col](#fun_matrix.add_col)"],syntax:["matrix.add_row(id, row, array_id) → void"],returnedTypes:["void"],originalName:"matrix.add_row",thisType:["matrix<>"]},{name:"add_col",desc:["The function adds a column at the `column` index of the `id` matrix. The column can consist of `na` values, or an array can be used to provide values."],args:[{name:"column",desc:"The index of the column after which the new column will be inserted. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],detailedDesc:[{desc:["Adding a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a column with `na` values to the matrix.","matrix.add_col(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `3`."," var a = array.from(1, 3)"," "," // Add the `a` array as the first column of the empty matrix."," matrix.add_col(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Rather than add columns to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values. Adding a column is also much slower than adding a row with the [matrix.add_row](#fun_matrix.add_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_row](#fun_matrix.add_row)"],syntax:["matrix.add_col(id, column) → void"],returnedTypes:["void"],originalName:"matrix.add_col",thisType:["matrix<>"]},{name:"add_col",desc:["The function adds a column at the `column` index of the `id` matrix. The column can consist of `na` values, or an array can be used to provide values."],args:[{name:"column",desc:"The index of the column after which the new column will be inserted. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"array_id",desc:"An array to be inserted. Optional.",required:!0,allowedTypeIDs:["array<>"],displayType:"any array type"}],detailedDesc:[{desc:["Adding a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 1")',"",'// Create a 2x3 "int" matrix containing values `0`.',"m = matrix.new<int>(2, 3, 0)","","// Add a column with `na` values to the matrix.","matrix.add_col(m)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]},{desc:["Adding an array as a column to the matrix"],examples:["//@version=5",'indicator("`matrix.add_col()` Example 2")',"","if barstate.islastconfirmedhistory"," // Create an empty matrix object. "," var m = matrix.new<int>()"," "," // Create an array with values `1` and `3`."," var a = array.from(1, 3)"," "," // Add the `a` array as the first column of the empty matrix."," matrix.add_col(m, 0, a)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m))"]}],remarks:["Rather than add columns to an empty matrix, it is far more efficient to declare a matrix with explicit dimensions and fill it with values. Adding a column is also much slower than adding a row with the [matrix.add_row](#fun_matrix.add_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.add_row](#fun_matrix.add_row)"],syntax:["matrix.add_col(id, column, array_id) → void"],returnedTypes:["void"],originalName:"matrix.add_col",thisType:["matrix<>"]},{name:"remove_row",desc:["The function removes the row at `row` index of the `id` matrix and returns an array containing the removed row's values."],args:[{name:"row",desc:"The index of the row to be deleted. Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("matrix_remove_row", overlay = true)',"",'// Create a 2x2 "int" matrix containing values `1`.',"var matrixOrig = matrix.new<int>(2, 2, 1)","","// Set values to the 'matrixOrig' matrix.","matrix.set(matrixOrig, 0, 1, 2)","matrix.set(matrixOrig, 1, 0, 3)","matrix.set(matrixOrig, 1, 1, 4)","","// Create a copy of the 'matrixOrig' matrix.","matrixCopy = matrix.copy(matrixOrig)","","// Remove the first row from the matrix `matrixCopy`.","arr = matrix.remove_row(matrixCopy, 0)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 3, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(matrixOrig))",' table.cell(t, 1, 0, "Removed Elements:")'," table.cell(t, 1, 1, str.tostring(arr))",' table.cell(t, 2, 0, "Result Matrix:")'," table.cell(t, 2, 1, str.tostring(matrixCopy))"],returns:["An array containing the elements of the row removed from the `id` matrix."],remarks:["Indexing of rows and columns starts at zero. It is far more efficient to declare matrices with explicit dimensions than to build them by adding or removing rows."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.copy](#fun_matrix.copy)","[matrix.remove_col](#fun_matrix.remove_col)"],syntax:["matrix.remove_row(id, row) → type[]"],returnedTypes:["array<>"],originalName:"matrix.remove_row",thisType:["matrix<>"]},{name:"remove_col",desc:["The function removes the column at `column` index of the `id` matrix and returns an array containing the removed column's values."],args:[{name:"column",desc:"The index of the column to be removed. Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("matrix_remove_col", overlay = true)',"","// Create a 2x2 matrix with ones.","var matrixOrig = matrix.new<int>(2, 2, 1)","","// Set values to the 'matrixOrig' matrix.","matrix.set(matrixOrig, 0, 1, 2)","matrix.set(matrixOrig, 1, 0, 3)","matrix.set(matrixOrig, 1, 1, 4)","","","// Create a copy of the 'matrixOrig' matrix.","matrixCopy = matrix.copy(matrixOrig)","","// Remove the first column from the `matrixCopy` matrix.","arr = matrix.remove_col(matrixCopy, 0)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 3, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(matrixOrig))",' table.cell(t, 1, 0, "Removed Elements:")'," table.cell(t, 1, 1, str.tostring(arr))",' table.cell(t, 2, 0, "Result Matrix:")'," table.cell(t, 2, 1, str.tostring(matrixCopy))"],returns:["An array containing the elements of the column removed from the `id` matrix."],remarks:["Indexing of rows and columns starts at zero. It is far more efficient to declare matrices with explicit dimensions than to build them by adding or removing columns. Deleting a column is also much slower than deleting a row with the [matrix.remove_row](#fun_matrix.remove_row) function."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.copy](#fun_matrix.copy)","[matrix.remove_row](#fun_matrix.remove_row)"],syntax:["matrix.remove_col(id, column) → type[]"],returnedTypes:["array<>"],originalName:"matrix.remove_col",thisType:["matrix<>"]},{name:"fill",desc:["The function fills a rectangular area of the `id` matrix defined by the indices `from_column` to `to_column` (not including it) and `from_row` to `to_row`(not including it) with the `value`."],args:[{name:"value",desc:"The value to fill with.",required:!0,allowedTypeIDs:[],displayType:"series <type of the matrix's elements>"},{name:"from_row",desc:"Row index from which the fill will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_row",desc:"Row index where the fill will end (not inclusive). Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"from_column",desc:"Column index from which the fill will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_column",desc:"Column index where the fill will end (non inclusive). Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.fill()` Example")',"",'// Create a 4x5 "int" matrix containing values `0`.',"m = matrix.new<float>(4, 5, 0)","","// Fill the intersection of rows 1 to 2 and columns 2 to 3 of the matrix with `hl2` values.","matrix.fill(m, hl2, 0, 2, 1, 3)","","// Display using a label.","if barstate.islastconfirmedhistory"," label.new(bar_index, high, str.tostring(m))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.fill(id, value, from_row, to_row, from_column, to_column) → void"],returnedTypes:["void"],originalName:"matrix.fill",thisType:["matrix<>"]},{name:"submatrix",desc:["The function extracts a submatrix of the `id` matrix within the specified indices."],args:[{name:"from_row",desc:"Index of the row from which the extraction will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_row",desc:"Index of the row where the extraction will end (non inclusive). Optional. The default value is [matrix.rows](#fun_matrix.rows).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"from_column",desc:"Index of the column from which the extraction will begin (inclusive). Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"to_column",desc:"Index of the column where the extraction will end (non inclusive). Optional. The default value is [matrix.columns](#fun_matrix.columns).",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.submatrix()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix matrix with values `0`."," var m1 = matrix.new<int>(2, 3, 0)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 0, 2, 3)"," matrix.set(m1, 1, 0, 4)"," matrix.set(m1, 1, 1, 5)"," matrix.set(m1, 1, 2, 6)"," "," // Create a 2x2 submatrix of the `m1` matrix."," var m2 = matrix.submatrix(m1, 0, 2, 1, 3)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Submatrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix object containing the submatrix of the `id` matrix defined by the `from_row`, `to_row`, `from_column` and `to_column` indices."],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.row](#fun_matrix.row)","[matrix.col](#fun_matrix.col)","[matrix.reshape](#fun_matrix.reshape)"],syntax:["matrix.submatrix(id, from_row, to_row, from_column, to_column) → matrix<type>"],returnedTypes:["matrix<>"],originalName:"matrix.submatrix",thisType:["matrix<>"]},{name:"copy",desc:["The function creates a new matrix which is a copy of the original."],args:[],examples:["//@version=5",'indicator("`matrix.copy()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory",' // Create a 2x3 "float" matrix with `1` values.'," var m1 = matrix.new<float>(2, 3, 1)"," "," // Copy the matrix to a new one."," // Note that unlike what `matrix.copy()` does, "," // the simple assignment operation `m2 = m1`"," // would NOT create a new copy of the `m1` matrix."," // It would merely create a copy of its ID referencing the same matrix."," var m2 = matrix.copy(m1)"," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix object of the copied `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.copy(id) → matrix<type>"],returnedTypes:["matrix<>"],originalName:"matrix.copy",thisType:["matrix<>"]},{name:"columns",desc:["The function returns the number of columns in the matrix."],args:[],examples:["//@version=5",'indicator("`matrix.columns()` Example")',"","// Create a 2x6 matrix with values `0`.","var m = matrix.new<int>(2, 6, 0)","","// Get the quantity of columns in matrix `m`.","var x = matrix.columns(m)","","// Display using a label.","if barstate.islastconfirmedhistory",' label.new(bar_index, high, "Columns: " + str.tostring(x) + "\\n" + str.tostring(m))'],returns:["The number of columns in the matrix `id`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.col](#fun_matrix.col)","[matrix.row](#fun_matrix.row)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.columns(id) → series int"],returnedTypes:["series int"],originalName:"matrix.columns",thisType:["matrix<>"]},{name:"rows",desc:["The function returns the number of rows in the matrix."],args:[],examples:["//@version=5",'indicator("`matrix.rows()` Example")',"","// Create a 2x6 matrix with values `0`.","var m = matrix.new<int>(2, 6, 0)","","// Get the quantity of rows in the matrix.","var x = matrix.rows(m)","","// Display using a label.","if barstate.islastconfirmedhistory",' label.new(bar_index, high, "Rows: " + str.tostring(x) + "\\n" + str.tostring(m))'],returns:["The number of rows in the matrix `id`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.row](#fun_matrix.row)"],syntax:["matrix.rows(id) → series int"],returnedTypes:["series int"],originalName:"matrix.rows",thisType:["matrix<>"]},{name:"elements_count",desc:["The function returns the total number of all matrix elements."],args:[],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.elements_count(id) → series int"],returnedTypes:["series int"],originalName:"matrix.elements_count",thisType:["matrix<>"]},{name:"concat",desc:["The function appends the `m2` matrix to the `m1` matrix."],args:[{name:"id2",desc:"Matrix object whose elements will be appended to `id1`.",required:!0,allowedTypeIDs:["matrix<>"],displayType:"any matrix type"}],examples:["//@version=5",'indicator("`matrix.concat()` Example")',"",'// Create a 2x4 "int" matrix containing values `0`.',"m1 = matrix.new<int>(2, 4, 0)",'// Create a 2x4 "int" matrix containing values `1`.',"m2 = matrix.new<int>(2, 4, 1)","","// Append matrix `m2` to `m1`.","matrix.concat(m1, m2)","","// Display matrix elements.","if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))"],returns:["Returns the `id1` matrix concatenated with the `id2` matrix."],remarks:["The number of columns in both matrices must be identical."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.concat(id1, id2) → matrix<type>"],returnedTypes:["matrix<>"],originalName:"matrix.concat",thisType:["matrix<>"]},{name:"swap_rows",desc:["The function swaps the rows at the index `row1` and `row2` in the `id` matrix."],args:[{name:"row1",desc:"Index of the first row to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"row2",desc:"Index of the second row to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.swap_rows()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 3x2 matrix with ‘na’ values."," var m1 = matrix.new<int>(3, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," matrix.set(m1, 2, 0, 5)"," matrix.set(m1, 2, 1, 6)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Swap the first and second rows of the matrix copy."," matrix.swap_rows(m2, 0, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Swapped rows in copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.swap_columns](#fun_matrix.swap_columns)"],syntax:["matrix.swap_rows(id, row1, row2) → void"],returnedTypes:["void"],originalName:"matrix.swap_rows",thisType:["matrix<>"]},{name:"swap_columns",desc:["The function swaps the columns at the index `column1` and `column2` in the `id` matrix."],args:[{name:"column1",desc:"Index of the first column to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"column2",desc:"Index of the second column to be swapped.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.swap_columns()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix with ‘na’ values."," var m1 = matrix.new<int>(2, 2, na) "," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," "," // Swap the first and second columns of the matrix copy."," matrix.swap_columns(m2, 0, 1)",""," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Swapped columns in copy:")'," table.cell(t, 1, 1, str.tostring(m2))"],remarks:["Indexing of the rows and columns starts at zero."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.swap_columns(id, column1, column2) → void"],returnedTypes:["void"],originalName:"matrix.swap_columns",thisType:["matrix<>"]},{name:"reverse",desc:["The function reverses the order of rows and columns in the matrix `id`. The first row and first column become the last, and the last become the first."],args:[],examples:["//@version=5",'indicator("`matrix.reverse()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Copy the matrix to a new one."," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Copy matrix elements to a new matrix."," var m2 = matrix.copy(m1)"," "," // Reverse the `m2` copy of the original matrix. "," matrix.reverse(m2)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Reversed matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.reshape](#fun_matrix.reshape)"],syntax:["matrix.reverse(id) → void"],returnedTypes:["void"],originalName:"matrix.reverse",thisType:["matrix<>"]},{name:"sort",desc:["The function rearranges the rows in the `id` matrix following the sorted order of the values in the `column`."],args:[{name:"column",desc:"Index of the column whose sorted values determine the new order of rows. Optional. The default value is 0.",allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"order",desc:"The sort order. Possible values: [order.ascending](#var_order.ascending) (default), [order.descending](#var_order.descending).",allowedTypeIDs:["simple sort_order","input sort_order","const sort_order"],displayType:"simple sort_order"}],examples:["//@version=5",'indicator("`matrix.sort()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<float>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 3)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 1)"," matrix.set(m1, 1, 1, 2)"," "," // Copy the matrix to a new one."," var m2 = matrix.copy(m1)"," // Sort the rows of `m2` using the default arguments (first column and ascending order)."," matrix.sort(m2)"," "," // Display using a table."," if barstate.islastconfirmedhistory"," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Sorted matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.sort(id, column, order) → void"],returnedTypes:["void"],originalName:"matrix.sort",thisType:["matrix<int>","matrix<float>","matrix<string>"]},{name:"det",desc:["The function returns the [determinant](https://en.wikipedia.org/wiki/Determinant) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.det` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<float>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 3)","matrix.set(m, 0, 1, 7)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, -4)","","// Get the determinant of the matrix. ","var x = matrix.det(m)","","plot(x, 'Matrix determinant')"],returns:["The determinant value of the `id` matrix."],remarks:["Function calculation based on the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.det(id) → series float"],returnedTypes:["series float"],originalName:"matrix.det",thisType:["matrix<float>","matrix<int>"]},{name:"det",desc:["The function returns the [determinant](https://en.wikipedia.org/wiki/Determinant) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.det` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<float>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 3)","matrix.set(m, 0, 1, 7)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, -4)","","// Get the determinant of the matrix. ","var x = matrix.det(m)","","plot(x, 'Matrix determinant')"],returns:["The determinant value of the `id` matrix."],remarks:["Function calculation based on the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.det(id) → series int"],returnedTypes:["series int"],originalName:"matrix.det",thisType:["matrix<float>","matrix<int>"]},{name:"min",desc:["The function returns the smallest value from the matrix elements."],args:[],examples:["//@version=5",'indicator("`matrix.min()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the minimum value from the matrix.","var x = matrix.min(m)","","plot(x, 'Matrix minimum value')"],returns:["The smallest value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.min(id) → series float"],returnedTypes:["series float"],originalName:"matrix.min",thisType:["matrix<float>","matrix<int>"]},{name:"min",desc:["The function returns the smallest value from the matrix elements."],args:[],examples:["//@version=5",'indicator("`matrix.min()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the minimum value from the matrix.","var x = matrix.min(m)","","plot(x, 'Matrix minimum value')"],returns:["The smallest value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.max](#fun_matrix.max)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.min(id) → series int"],returnedTypes:["series int"],originalName:"matrix.min",thisType:["matrix<float>","matrix<int>"]},{name:"max",desc:["The function returns the largest value from the matrix elements."],args:[],examples:["//@version=5",'indicator("`matrix.max()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the maximum value in the matrix.","var x = matrix.max(m)","","plot(x, 'Matrix maximum value')"],returns:["The maximum value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.max(id) → series float"],returnedTypes:["series float"],originalName:"matrix.max",thisType:["matrix<float>","matrix<int>"]},{name:"max",desc:["The function returns the largest value from the matrix elements."],args:[],examples:["//@version=5",'indicator("`matrix.max()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the maximum value in the matrix.","var x = matrix.max(m)","","plot(x, 'Matrix maximum value')"],returns:["The maximum value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.min](#fun_matrix.min)","[matrix.avg](#fun_matrix.avg)","[matrix.sort](#fun_matrix.sort)"],syntax:["matrix.max(id) → series int"],returnedTypes:["series int"],originalName:"matrix.max",thisType:["matrix<float>","matrix<int>"]},{name:"avg",desc:["The function calculates the average of all elements in the matrix."],args:[],examples:["//@version=5",'indicator("`matrix.avg()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the average value of the matrix.","var x = matrix.avg(m)","","plot(x, 'Matrix average value')"],returns:["The average value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.avg(id) → series float"],returnedTypes:["series float"],originalName:"matrix.avg",thisType:["matrix<float>","matrix<int>"]},{name:"avg",desc:["The function calculates the average of all elements in the matrix."],args:[],examples:["//@version=5",'indicator("`matrix.avg()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the average value of the matrix.","var x = matrix.avg(m)","","plot(x, 'Matrix average value')"],returns:["The average value from the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.avg(id) → series int"],returnedTypes:["series int"],originalName:"matrix.avg",thisType:["matrix<float>","matrix<int>"]},{name:"median",desc:['The function calculates the [median](https://en.wikipedia.org/wiki/Median) ("the middle" value) of matrix elements.'],args:[],examples:["//@version=5",'indicator("`matrix.median()` Example")',"","// Create a 2x2 matrix.","m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the median of the matrix.","x = matrix.median(m)","","plot(x, 'Median of the matrix')"],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the median."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mode](#fun_matrix.mode)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.median(id) → series float"],returnedTypes:["series float"],originalName:"matrix.median",thisType:["matrix<float>","matrix<int>"]},{name:"median",desc:['The function calculates the [median](https://en.wikipedia.org/wiki/Median) ("the middle" value) of matrix elements.'],args:[],examples:["//@version=5",'indicator("`matrix.median()` Example")',"","// Create a 2x2 matrix.","m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 1)","matrix.set(m, 0, 1, 2)","matrix.set(m, 1, 0, 3)","matrix.set(m, 1, 1, 4)","","// Get the median of the matrix.","x = matrix.median(m)","","plot(x, 'Median of the matrix')"],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the median."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mode](#fun_matrix.mode)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.median(id) → series int"],returnedTypes:["series int"],originalName:"matrix.median",thisType:["matrix<float>","matrix<int>"]},{name:"mode",desc:["The function calculates the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) 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."],args:[],examples:["//@version=5",'indicator("`matrix.mode()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 0)","matrix.set(m, 0, 1, 0)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, 1)","","// Get the mode of the matrix.","var x = matrix.mode(m)","","plot(x, 'Mode of the matrix')"],returns:["The most frequently occurring value from the `id` matrix. If none exists, returns the smallest value instead."],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the mode."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.median](#fun_matrix.median)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.mode(id) → series float"],returnedTypes:["series float"],originalName:"matrix.mode",thisType:["matrix<float>","matrix<int>"]},{name:"mode",desc:["The function calculates the [mode](https://en.wikipedia.org/wiki/Mode_(statistics)) 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."],args:[],examples:["//@version=5",'indicator("`matrix.mode()` Example")',"","// Create a 2x2 matrix.","var m = matrix.new<int>(2, 2, na)","// Fill the matrix with values.","matrix.set(m, 0, 0, 0)","matrix.set(m, 0, 1, 0)","matrix.set(m, 1, 0, 1)","matrix.set(m, 1, 1, 1)","","// Get the mode of the matrix.","var x = matrix.mode(m)","","plot(x, 'Mode of the matrix')"],returns:["The most frequently occurring value from the `id` matrix. If none exists, returns the smallest value instead."],remarks:["Note that [na](#var_na) elements of the matrix are not considered when calculating the mode."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.median](#fun_matrix.median)","[matrix.sort](#fun_matrix.sort)","[matrix.avg](#fun_matrix.avg)"],syntax:["matrix.mode(id) → series int"],returnedTypes:["series int"],originalName:"matrix.mode",thisType:["matrix<float>","matrix<int>"]},{name:"transpose",desc:["The function creates a new, [transposed](https://en.wikipedia.org/wiki/Transpose#Transpose_of_a_matrix) version of the `id`. This interchanges the row and column index of each element."],args:[],examples:["//@version=5",'indicator("`matrix.transpose()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<float>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Create a transpose of the matrix."," var m2 = matrix.transpose(m1)"," "," // Display using a table."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Transposed matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the transposed version of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)","[matrix.reshape](#fun_matrix.reshape)","[matrix.reverse](#fun_matrix.reverse)"],syntax:["matrix.transpose(id) → matrix<type>"],returnedTypes:["matrix<>"],originalName:"matrix.transpose",thisType:["matrix<>"]},{name:"sum",desc:["The function returns a new matrix resulting from the [sum](https://en.wikipedia.org/wiki/Matrix_addition) of two matrices `id1` and `id2`, or of an `id1` matrix and an `id2` scalar (a numerical value)."],args:[{name:"id2",desc:"Second matrix object, or scalar value.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Sum of two matrices"],examples:["//@version=5",'indicator("`matrix.sum()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix that sums matrices `m1` and `m2`."," var m3 = matrix.sum(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Sum of a matrix and scalar"],examples:["//@version=5",'indicator("`matrix.sum()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the sum of the `m1` matrix with the "int" value `1`.'," var m2 = matrix.sum(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the sum of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.sum(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.sum",thisType:["matrix<int>","matrix<float>"]},{name:"sum",desc:["The function returns a new matrix resulting from the [sum](https://en.wikipedia.org/wiki/Matrix_addition) of two matrices `id1` and `id2`, or of an `id1` matrix and an `id2` scalar (a numerical value)."],args:[{name:"id2",desc:"Second matrix object, or scalar value.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Sum of two matrices"],examples:["//@version=5",'indicator("`matrix.sum()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix that sums matrices `m1` and `m2`."," var m3 = matrix.sum(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Sum of a matrix and scalar"],examples:["//@version=5",'indicator("`matrix.sum()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the sum of the `m1` matrix with the "int" value `1`.'," var m2 = matrix.sum(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Sum of a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the sum of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.sum(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.sum",thisType:["matrix<int>","matrix<float>"]},{name:"diff",desc:["The function returns a new matrix resulting from the subtraction between matrices `id1` and `id2`, or of matrix `id1` and an `id2` scalar (a numerical value)."],args:[{name:"id2",desc:"Matrix object or a scalar value to be subtracted.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Difference between two matrices"],examples:["//@version=5",'indicator("`matrix.diff()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix containing the difference between matrices `m1` and `m2`."," var m3 = matrix.diff(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Difference between a matrix and a scalar value"],examples:["//@version=5",'indicator("`matrix.diff()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the difference between the `m1` matrix and the "int" value `1`.'," var m2 = matrix.diff(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the difference between `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.diff(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.diff",thisType:["matrix<int>","matrix<float>"]},{name:"diff",desc:["The function returns a new matrix resulting from the subtraction between matrices `id1` and `id2`, or of matrix `id1` and an `id2` scalar (a numerical value)."],args:[{name:"id2",desc:"Matrix object or a scalar value to be subtracted.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Difference between two matrices"],examples:["//@version=5",'indicator("`matrix.diff()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `5`."," var m1 = matrix.new<float>(2, 3, 5) "," // Create a 2x3 matrix containing values `4`."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix containing the difference between matrices `m1` and `m2`."," var m3 = matrix.diff(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Difference between a matrix and a scalar value"],examples:["//@version=5",'indicator("`matrix.diff()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix with values `4`."," var m1 = matrix.new<float>(2, 3, 4)"," ",' // Create a new matrix containing the difference between the `m1` matrix and the "int" value `1`.'," var m2 = matrix.diff(m1, 1)"," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Difference between a matrix and a scalar:")'," table.cell(t, 0, 1, str.tostring(m2))"]}],returns:["A new matrix object containing the difference between `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.diff(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.diff",thisType:["matrix<int>","matrix<float>"]},{name:"mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.mult",thisType:["matrix<int>","matrix<float>"]},{name:"mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.mult",thisType:["matrix<int>","matrix<float>"]},{name:"mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["int[]"],displayType:"int[]"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → int[]"],returnedTypes:["int[]"],originalName:"matrix.mult",thisType:["matrix<int>","matrix<float>"]},{name:"mult",desc:["The function returns a new matrix resulting from the [product](https://en.wikipedia.org/wiki/Matrix_multiplication) between the matrices `id1` and `id2`, or between an `id1` matrix and an `id2` scalar (a numerical value), or between an `id1` matrix and an `id2` vector (an array of values)."],args:[{name:"id2",desc:"Second matrix object, value or array.",required:!0,allowedTypeIDs:["float[]"],displayType:"float[]"}],detailedDesc:[{desc:["Product of two matrices"],examples:["//@version=5",'indicator("`matrix.mult()` Example 1")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 6x2 matrix containing values `5`."," var m1 = matrix.new<float>(6, 2, 5) "," // Create a 2x3 matrix containing values `4`."," // Note that it must have the same quantity of rows as there are columns in the first matrix."," var m2 = matrix.new<float>(2, 3, 4) "," // Create a new matrix from the multiplication of the two matrices."," var m3 = matrix.mult(m1, m2) "," "," // Display using a table."," var t = table.new(position.top_right, 1, 2, color.green)",' table.cell(t, 0, 0, "Product of two matrices:")'," table.cell(t, 0, 1, str.tostring(m3))"]},{desc:["Product of a matrix and a scalar"],examples:["//@version=5",'indicator("`matrix.mult()` Example 2")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<float>(2, 3, 4) "," "," // Create a new matrix from the product of the two matrices."," scalar = 5"," var m2 = matrix.mult(m1, scalar) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Scalar:")'," table.cell(t, 2, 1, str.tostring(scalar))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 2:")'," table.cell(t, 4, 1, str.tostring(m2))"]},{desc:["Product of a matrix and an array vector"],examples:["//@version=5",'indicator("`matrix.mult()` Example 3")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x3 matrix containing values `4`."," var m1 = matrix.new<int>(2, 3, 4)"," "," // Create an array of three elements."," var int[] a = array.from(1, 1, 1)"," "," // Create a new matrix containing the product of the `m1` matrix and the `a` array."," var m3 = matrix.mult(m1, a) "," "," // Display using a table."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "x")',' table.cell(t, 2, 0, "Value:")',' table.cell(t, 2, 1, str.tostring(a, " "))',' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Matrix 3:")'," table.cell(t, 4, 1, str.tostring(m3))"]}],returns:["A new matrix object containing the product of `id2` and `id1`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.sum](#fun_matrix.sum)","[matrix.diff](#fun_matrix.diff)"],syntax:["matrix.mult(id1, id2) → float[]"],returnedTypes:["float[]"],originalName:"matrix.mult",thisType:["matrix<int>","matrix<float>"]},{name:"pinv",desc:["The function returns the [pseudoinverse](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse) of a matrix."],args:[],examples:["//@version=5",'indicator("`matrix.pinv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Pseudoinverse of the matrix."," var m2 = matrix.pinv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Pseudoinverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the pseudoinverse of the `id` matrix."],remarks:["The function is calculated using a [Moore–Penrose](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Definition) inverse formula based on singular-value decomposition of a matrix. For non-singular square matrices this function returns the result of [matrix.inv](#fun_matrix.inv)."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.inv](#fun_matrix.inv)"],syntax:["matrix.pinv(id) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.pinv",thisType:["matrix<float>","matrix<int>"]},{name:"pinv",desc:["The function returns the [pseudoinverse](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse) of a matrix."],args:[],examples:["//@version=5",'indicator("`matrix.pinv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Pseudoinverse of the matrix."," var m2 = matrix.pinv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Pseudoinverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix containing the pseudoinverse of the `id` matrix."],remarks:["The function is calculated using a [Moore–Penrose](https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Definition) inverse formula based on singular-value decomposition of a matrix. For non-singular square matrices this function returns the result of [matrix.inv](#fun_matrix.inv)."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.inv](#fun_matrix.inv)"],syntax:["matrix.pinv(id) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.pinv",thisType:["matrix<float>","matrix<int>"]},{name:"inv",desc:["The function returns the [inverse](https://en.wikipedia.org/wiki/Invertible_matrix) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.inv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Inverse of the matrix."," var m2 = matrix.inv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Inverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix, which is the inverse of the `id` matrix."],remarks:["The function is calculated using the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.pinv](#fun_matrix.pinv)","[matrix.copy](#fun_matrix.copy)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.inv(id) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.inv",thisType:["matrix<float>","matrix<int>"]},{name:"inv",desc:["The function returns the [inverse](https://en.wikipedia.org/wiki/Invertible_matrix) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.inv()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Inverse of the matrix."," var m2 = matrix.inv(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Inverse matrix:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["A new matrix, which is the inverse of the `id` matrix."],remarks:["The function is calculated using the [LU decomposition](https://en.wikipedia.org/wiki/LU_decomposition) algorithm."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.pinv](#fun_matrix.pinv)","[matrix.copy](#fun_matrix.copy)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.inv(id) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.inv",thisType:["matrix<float>","matrix<int>"]},{name:"rank",desc:["The function calculates the [rank](https://en.wikipedia.org/wiki/Rank_(linear_algebra)) of the matrix."],args:[],examples:["//@version=5",'indicator("`matrix.rank()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the rank of the matrix. "," r = matrix.rank(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Rank of the matrix:")'," table.cell(t, 1, 1, str.tostring(r)) "],returns:["The rank of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[str.tostring](#fun_str.tostring)"],syntax:["matrix.rank(id) → series int"],returnedTypes:["series int"],originalName:"matrix.rank",thisType:["matrix<>"]},{name:"trace",desc:["The function calculates the [trace](https://en.wikipedia.org/wiki/Trace_(linear_algebra)) of a matrix (the sum of the main diagonal's elements)."],args:[],examples:["//@version=5",'indicator("`matrix.trace()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the trace of the matrix."," tr = matrix.trace(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Trace of the matrix:")'," table.cell(t, 1, 1, str.tostring(tr))"],returns:["The trace of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.trace(id) → series float"],returnedTypes:["series float"],originalName:"matrix.trace",thisType:["matrix<float>","matrix<int>"]},{name:"trace",desc:["The function calculates the [trace](https://en.wikipedia.org/wiki/Trace_(linear_algebra)) of a matrix (the sum of the main diagonal's elements)."],args:[],examples:["//@version=5",'indicator("`matrix.trace()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 1)"," matrix.set(m1, 0, 1, 2)"," matrix.set(m1, 1, 0, 3)"," matrix.set(m1, 1, 1, 4)"," "," // Get the trace of the matrix."," tr = matrix.trace(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Trace of the matrix:")'," table.cell(t, 1, 1, str.tostring(tr))"],returns:["The trace of the `id` matrix."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.trace(id) → series int"],returnedTypes:["series int"],originalName:"matrix.trace",thisType:["matrix<float>","matrix<int>"]},{name:"eigenvalues",desc:["The function returns an array containing the [eigenvalues](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.eigenvalues()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvalues of the matrix."," tr = matrix.eigenvalues(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Array of Eigenvalues:")'," table.cell(t, 1, 1, str.tostring(tr)) "],returns:["An array containing the eigenvalues of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.eigenvectors](#fun_matrix.eigenvectors)"],syntax:["matrix.eigenvalues(id) → float[]"],returnedTypes:["float[]"],originalName:"matrix.eigenvalues",thisType:["matrix<float>","matrix<int>"]},{name:"eigenvalues",desc:["The function returns an array containing the [eigenvalues](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of a square matrix."],args:[],examples:["//@version=5",'indicator("`matrix.eigenvalues()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, na)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvalues of the matrix."," tr = matrix.eigenvalues(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Array of Eigenvalues:")'," table.cell(t, 1, 1, str.tostring(tr)) "],returns:["An array containing the eigenvalues of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.eigenvectors](#fun_matrix.eigenvectors)"],syntax:["matrix.eigenvalues(id) → int[]"],returnedTypes:["int[]"],originalName:"matrix.eigenvalues",thisType:["matrix<float>","matrix<int>"]},{name:"eigenvectors",desc:["Returns a matrix of [eigenvectors](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors), in which each column is an eigenvector of the `id` matrix."],args:[],examples:["//@version=5",'indicator("`matrix.eigenvectors()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix "," var m1 = matrix.new<int>(2, 2, 1)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvectors of the matrix."," m2 = matrix.eigenvectors(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Eigenvectors:")'," table.cell(t, 1, 1, str.tostring(m2)) "],returns:["A new matrix containing the eigenvectors of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.eigenvalues](#fun_matrix.eigenvalues)"],syntax:["matrix.eigenvectors(id) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.eigenvectors",thisType:["matrix<float>","matrix<int>"]},{name:"eigenvectors",desc:["Returns a matrix of [eigenvectors](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors), in which each column is an eigenvector of the `id` matrix."],args:[],examples:["//@version=5",'indicator("`matrix.eigenvectors()` Example")',"","// For efficiency, execute this code only once.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix "," var m1 = matrix.new<int>(2, 2, 1)"," // Fill the matrix with values."," matrix.set(m1, 0, 0, 2)"," matrix.set(m1, 0, 1, 4)"," matrix.set(m1, 1, 0, 6)"," matrix.set(m1, 1, 1, 8)"," "," // Get the eigenvectors of the matrix."," m2 = matrix.eigenvectors(m1)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Matrix Elements:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix Eigenvectors:")'," table.cell(t, 1, 1, str.tostring(m2)) "],returns:["A new matrix containing the eigenvectors of the `id` matrix."],remarks:['The function is calculated using "The Implicit QL Algorithm".'],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.eigenvalues](#fun_matrix.eigenvalues)"],syntax:["matrix.eigenvectors(id) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.eigenvectors",thisType:["matrix<float>","matrix<int>"]},{name:"kron",desc:["The function returns the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) for the `id1` and `id2` matrices."],args:[{name:"id2",desc:"Second matrix object.",required:!0,allowedTypeIDs:["matrix<float>"],displayType:"matrix<float>"}],examples:["//@version=5",'indicator("`matrix.kron()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create two matrices with default values `1` and `2`. "," var m1 = matrix.new<float>(2, 2, 1) "," var m2 = matrix.new<float>(2, 2, 2) "," "," // Calculate the Kronecker product of the matrices."," var m3 = matrix.kron(m1, m2) "," "," // Display matrix elements."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "⊗")',' table.cell(t, 2, 0, "Matrix 2:")'," table.cell(t, 2, 1, str.tostring(m2))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Kronecker product:")'," table.cell(t, 4, 1, str.tostring(m3))"],returns:["A new matrix containing the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) of `id1` and `id2`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mult](#fun_matrix.mult)","[str.tostring](#fun_str.tostring)","[table.new](#fun_table.new)"],syntax:["matrix.kron(id1, id2) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.kron",thisType:["matrix<float>","matrix<int>"]},{name:"kron",desc:["The function returns the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) for the `id1` and `id2` matrices."],args:[{name:"id2",desc:"Second matrix object.",required:!0,allowedTypeIDs:["matrix<int>"],displayType:"matrix<int>"}],examples:["//@version=5",'indicator("`matrix.kron()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create two matrices with default values `1` and `2`. "," var m1 = matrix.new<float>(2, 2, 1) "," var m2 = matrix.new<float>(2, 2, 2) "," "," // Calculate the Kronecker product of the matrices."," var m3 = matrix.kron(m1, m2) "," "," // Display matrix elements."," var t = table.new(position.top_right, 5, 2, color.green)",' table.cell(t, 0, 0, "Matrix 1:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 1, "⊗")',' table.cell(t, 2, 0, "Matrix 2:")'," table.cell(t, 2, 1, str.tostring(m2))",' table.cell(t, 3, 1, "=")',' table.cell(t, 4, 0, "Kronecker product:")'," table.cell(t, 4, 1, str.tostring(m3))"],returns:["A new matrix containing the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) of `id1` and `id2`."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.mult](#fun_matrix.mult)","[str.tostring](#fun_str.tostring)","[table.new](#fun_table.new)"],syntax:["matrix.kron(id1, id2) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.kron",thisType:["matrix<float>","matrix<int>"]},{name:"pow",desc:["The function calculates the product of the matrix by itself `power` times."],args:[{name:"power",desc:"The number of times the matrix will be multiplied by itself.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.pow()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, 2)"," // Calculate the power of three of the matrix."," var m2 = matrix.pow(m1, 3)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix³:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["The product of the `id` matrix by itself `power` times."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.mult](#fun_matrix.mult)"],syntax:["matrix.pow(id, power) → matrix<float>"],returnedTypes:["matrix<float>"],originalName:"matrix.pow",thisType:["matrix<float>","matrix<int>"]},{name:"pow",desc:["The function calculates the product of the matrix by itself `power` times."],args:[{name:"power",desc:"The number of times the matrix will be multiplied by itself.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("`matrix.pow()` Example")',"","// Display using a table.","if barstate.islastconfirmedhistory"," // Create a 2x2 matrix. "," var m1 = matrix.new<int>(2, 2, 2)"," // Calculate the power of three of the matrix."," var m2 = matrix.pow(m1, 3)"," "," // Display matrix elements."," var t = table.new(position.top_right, 2, 2, color.green)",' table.cell(t, 0, 0, "Original Matrix:")'," table.cell(t, 0, 1, str.tostring(m1))",' table.cell(t, 1, 0, "Matrix³:")'," table.cell(t, 1, 1, str.tostring(m2))"],returns:["The product of the `id` matrix by itself `power` times."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.mult](#fun_matrix.mult)"],syntax:["matrix.pow(id, power) → matrix<int>"],returnedTypes:["matrix<int>"],originalName:"matrix.pow",thisType:["matrix<float>","matrix<int>"]},{name:"is_zero",desc:["The function determines if all elements of the matrix are zero."],args:[],returns:["Returns true if all elements of the `id` matrix are zero, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_zero(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_zero",thisType:["matrix<float>","matrix<int>"]},{name:"is_identity",desc:["The function determines if a matrix is an [identity matrix](https://en.wikipedia.org/wiki/Identity_matrix) (elements with ones on the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal) and zeros elsewhere)."],args:[],returns:["Returns true if `id` is an identity matrix, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_diagonal](#fun_matrix.is_diagonal)"],syntax:["matrix.is_identity(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_identity",thisType:["matrix<float>","matrix<int>"]},{name:"is_binary",desc:["The function determines if the matrix is [binary](https://en.wikipedia.org/wiki/Logical_matrix) (when all elements of the matrix are 0 or 1)."],args:[],returns:["Returns true if the `id` matrix is binary, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_binary(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_binary",thisType:["matrix<float>","matrix<int>"]},{name:"is_symmetric",desc:["The function determines if a [square matrix](https://en.wikipedia.org/wiki/Square_matrix) is [symmetric](https://en.wikipedia.org/wiki/Symmetric_matrix) (elements are symmetric with respect to the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal))."],args:[],returns:["Returns true if the `id` matrix is symmetric, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_symmetric(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_symmetric",thisType:["matrix<float>","matrix<int>"]},{name:"is_antisymmetric",desc:["The function determines if a matrix is [antisymmetric](https://en.wikipedia.org/wiki/Skew-symmetric_matrix) (its [transpose](https://en.wikipedia.org/wiki/Transpose) equals its negative)."],args:[],returns:["Returns true, if the `id` matrix is antisymmetric, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_antisymmetric(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_antisymmetric",thisType:["matrix<float>","matrix<int>"]},{name:"is_diagonal",desc:["The function determines if the matrix is [diagonal](https://en.wikipedia.org/wiki/Diagonal_matrix) (all elements outside the main diagonal are zero)."],args:[],returns:["Returns true if the `id` matrix is diagonal, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_identity](#fun_matrix.is_identity)","[matrix.is_antidiagonal](#fun_matrix.is_antidiagonal)"],syntax:["matrix.is_diagonal(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_diagonal",thisType:["matrix<float>","matrix<int>"]},{name:"is_antidiagonal",desc:["The function determines if the matrix is [anti-diagonal](https://en.wikipedia.org/wiki/Anti-diagonal_matrix) (all elements outside the secondary diagonal are zero)."],args:[],returns:["Returns true if the `id` matrix is ​​anti-diagonal, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)","[matrix.is_identity](#fun_matrix.is_identity)","[matrix.is_diagonal](#fun_matrix.is_diagonal)"],syntax:["matrix.is_antidiagonal(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_antidiagonal",thisType:["matrix<float>","matrix<int>"]},{name:"is_triangular",desc:["The function determines if the matrix is [triangular](https://en.wikipedia.org/wiki/Triangular_matrix) (if all elements above or below the [main diagonal](https://en.wikipedia.org/wiki/Main_diagonal) are zero)."],args:[],returns:["Returns true if the `id` matrix is triangular, false otherwise."],remarks:["Returns false with non-square matrices."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)","[matrix.is_square](#fun_matrix.is_square)"],syntax:["matrix.is_triangular(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_triangular",thisType:["matrix<float>","matrix<int>"]},{name:"is_stochastic",desc:["The function determines if the matrix is [stochastic](https://en.wikipedia.org/wiki/Stochastic_matrix)."],args:[],returns:["Returns true if the `id` matrix is stochastic, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.set](#fun_matrix.set)"],syntax:["matrix.is_stochastic(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_stochastic",thisType:["matrix<float>","matrix<int>"]},{name:"is_square",desc:["The function determines if the matrix is [square](https://en.wikipedia.org/wiki/Square_matrix) (it has the same number of rows and columns)."],args:[],returns:["Returns true if the `id` matrix is square, false otherwise."],seeAlso:["[matrix.new<type>](#fun_matrix.new<type>)","[matrix.get](#fun_matrix.get)","[matrix.set](#fun_matrix.set)","[matrix.columns](#fun_matrix.columns)","[matrix.rows](#fun_matrix.rows)"],syntax:["matrix.is_square(id) → series bool"],returnedTypes:["series bool"],originalName:"matrix.is_square",thisType:["matrix<>"]},{name:"merge_cells",desc:["The function merges a sequence of cells in the table into one cell. The cells are merged in a rectangle shape where the start_column and start_row specify the top-left corner, and end_column and end_row specify the bottom-right corner."],args:[{name:"start_column",desc:"The index of the column of the first cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"start_row",desc:"The index of the row of the first cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_column",desc:"The index of the column of the last cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"},{name:"end_row",desc:"The index of the row of the last cell to merge. Numbering starts at 0.",required:!0,allowedTypeIDs:["series int","simple int","input int","const int"],displayType:"series int"}],examples:["//@version=5",'indicator("table.merge_cells example")',"SMA50 = ta.sma(close, 50)","SMA100 = ta.sma(close, 100)","SMA200 = ta.sma(close, 200)","if barstate.islast"," maTable = table.new(position.bottom_right, 3, 3, bgcolor = color.gray, border_width = 1, border_color = color.black)"," // Header",' table.cell(maTable, 0, 0, text = "SMA Table")'," table.merge_cells(maTable, 0, 0, 2, 0)"," // Cell Titles",' table.cell(maTable, 0, 1, text = "SMA 50")',' table.cell(maTable, 1, 1, text = "SMA 100")',' table.cell(maTable, 2, 1, text = "SMA 200")'," // Values"," table.cell(maTable, 0, 2, bgcolor = color.white, text = str.tostring(SMA50))"," table.cell(maTable, 1, 2, bgcolor = color.white, text = str.tostring(SMA100))"," table.cell(maTable, 2, 2, bgcolor = color.white, text = str.tostring(SMA200))"],remarks:["This function will merge cells, even if their properties are not yet defined with [table.cell](#fun_table.cell).","The resulting merged cell inherits all of its values from the cell located at `start_column`:`start_row`, except width and height. The width and height of the resulting merged cell are based on the width/height of other cells in the neighboring columns/rows and cannot be set manually.","To modify the merged cell with any of the `table.cell_set_*` functions, target the cell at the `start_column`:`start_row` coordinates.","An attempt to merge a cell that has already been merged will result in an error."],seeAlso:["[table.delete](#fun_table.delete)","[table.new](#fun_table.new)"],syntax:["table.merge_cells(table_id, start_column, start_row, end_column, end_row) → void"],returnedTypes:["void"],originalName:"table.merge_cells",thisType:["series table"]},{name:"copy",desc:["Creates a copy of a [chart.point](#op_chart.point) object with the specified `id`."],args:[],syntax:["chart.point.copy(id) → chart.point"],returnedTypes:["chart.point"],originalName:"chart.point.copy",thisType:["chart.point"]},{name:"set_first_point",desc:["Sets the first point of the `id` line to `point`."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["line.set_first_point(id, point) → void"],returnedTypes:["void"],originalName:"line.set_first_point",thisType:["series line"]},{name:"set_second_point",desc:["Sets the second point of the `id` line to `point`."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["line.set_second_point(id, point) → void"],returnedTypes:["void"],originalName:"line.set_second_point",thisType:["series line"]},{name:"set_point",desc:["Sets the location of the `id` label to `point`."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["label.set_point(id, point) → void"],returnedTypes:["void"],originalName:"label.set_point",thisType:["series label"]},{name:"set_top_left_point",desc:["Sets the top-left corner location of the `id` box to `point`."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["box.set_top_left_point(id, point) → void"],returnedTypes:["void"],originalName:"box.set_top_left_point",thisType:["series box"]},{name:"set_bottom_right_point",desc:["Sets the bottom-right corner location of the `id` box to `point`."],args:[{name:"point",desc:"A [chart.point](#op_chart.point) object.",required:!0,allowedTypeIDs:["chart.point"],displayType:"chart.point"}],syntax:["box.set_bottom_right_point(id, point) → void"],returnedTypes:["void"],originalName:"box.set_bottom_right_point",thisType:["series box"]},{name:"copy",desc:["Creates a copy of an existing map."],returns:["A copy of the `id` map."],args:[],syntax:["map.copy(id) → map<keyType, valueType>"],examples:["//@version=5",'indicator("map.copy example")',"a = map.new<string, int>()",'a.put("example", 1)',"b = map.copy(a)","a := map.new<string, int>()",'a.put("example", 2)','plot(a.get("example"))','plot(b.get("example"))'],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.get](#fun_map.get)","[map.size](#fun_map.size)"],originalName:"map.copy",thisType:["map<>"]},{name:"size",desc:["Returns the number of key-value pairs in the `id` map."],args:[],examples:["//@version=5",'indicator("map.size example")',"a = map.new<int, int>()","size = 10","for i = 0 to size"," a.put(i, size-i)","plot(map.size(a))"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.get](#fun_map.get)"],syntax:["map.size(id) → series int"],returnedTypes:["series int"],originalName:"map.size",thisType:["map<>"]},{name:"get",desc:["Returns the value associated with the specified `key` in the `id` map."],args:[{name:"key",desc:"The key of the value to retrieve.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.get example")',"a = map.new<int, int>()","size = 10","for i = 0 to size"," a.put(i, size-i)","plot(map.get(a, 1))"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.contains](#fun_map.contains)"],syntax:["map.get(id, key) → <value_type>"],returnedTypes:[],originalName:"map.get",thisType:["map<>"]},{name:"contains",desc:["Returns [true](#var_true) if the `key` was found in the `id` map, [false](#var_false) otherwise."],args:[{name:"key",desc:"The key to search in the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.includes example")',"a = map.new<string, float>()",'a.put("open", open)',"p = close",'if map.contains(a, "open")',' p := a.get("open")',"plot(p)"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.size](#fun_map.size)"],syntax:["map.contains(id, key) → series bool"],returnedTypes:["series bool"],originalName:"map.contains",thisType:["map<>"]},{name:"keys",desc:["Returns an array of all the keys in the `id` map. The resulting array is a copy and any changes to it are not reflected in the original map."],args:[],examples:["//@version=5",'indicator("map.keys example")',"a = map.new<string, float>()",'a.put("open", open)','a.put("high", high)','a.put("low", low)','a.put("close", close)',"keys = map.keys(a)","ohlc = 0.0","for key in keys"," ohlc += a.get(key)","plot(ohlc/4)"],remarks:["Maps maintain insertion order. The elements within the array returned by this function will also be in the insertion order."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.get](#fun_map.get)","[map.values](#fun_map.values)","[map.size](#fun_map.size)"],syntax:["map.keys(id) → type[]"],returnedTypes:["array<>"],originalName:"map.keys",thisType:["map<>"]},{name:"values",desc:["Returns an array of all the values in the `id` map. The resulting array is a copy and any changes to it are not reflected in the original map."],args:[],examples:["//@version=5",'indicator("map.values example")',"a = map.new<string, float>()",'a.put("open", open)','a.put("high", high)','a.put("low", low)','a.put("close", close)',"values = map.values(a)","ohlc = 0.0","for value in values"," ohlc += value","plot(ohlc/4)"],remarks:["Maps maintain insertion order. The elements within the array returned by this function will also be in the insertion order."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.get](#fun_map.get)","[map.keys](#fun_map.keys)","[map.size](#fun_map.size)"],syntax:["map.values(id) → type[]"],returnedTypes:["array<>"],originalName:"map.values",thisType:["map<>"]},{name:"put",desc:["Puts a new key-value pair into the `id` map."],returns:["The previous value associated with `key` if the key was already present in the map, or [na](#var_na) if the key is new."],args:[{name:"key",desc:"The key to put into the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"},{name:"value",desc:"The key value to put into the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.put example")',"a = map.new<string, float>()",'map.put(a, "first", 10)','map.put(a, "second", 15)','prevFirst = map.put(a, "first", 20)','currFirst = a.get("first")',"plot(prevFirst)","plot(currFirst)"],remarks:["Maps maintain insertion order. Note that the order does not change when inserting a pair with a `key` that's already in the map. The new pair replaces the existing pair with the `key` in such cases."],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put_all](#fun_map.put_all)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.put(id, key, value) → <value_type>"],returnedTypes:[],originalName:"map.put",thisType:["map<>"]},{name:"put_all",desc:["Puts all key-value pairs from the `id2` map into the `id` map."],args:[{name:"id2",desc:"A map object to be appended.",required:!0,allowedTypeIDs:["map<>"],displayType:"any map type"}],examples:["//@version=5",'indicator("map.put_all example")',"a = map.new<string, float>()","b = map.new<string, float>()",'a.put("first", 10)','a.put("second", 15)','b.put("third", 20)',"map.put_all(a, b)",'plot(a.get("third"))'],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.put_all(id, id2) → void"],returnedTypes:["void"],originalName:"map.put_all",thisType:["map<>"]},{name:"remove",desc:["Removes a key-value pair from the `id` map."],returns:["The previous value associated with `key` if the key was present in the map, or [na](#var_na) if there was no such key."],args:[{name:"key",desc:"The key of the pair to remove from the map.",required:!0,allowedTypeIDs:[],displayType:"series <type of the map's elements>"}],examples:["//@version=5",'indicator("map.remove example")',"a = map.new<string, color>()",'a.put("firstColor", color.green)','oldColorValue = map.remove(a, "firstColor")',"plot(close, color = oldColorValue)"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put](#fun_map.put)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.clear](#fun_map.clear)"],syntax:["map.remove(id, key) → <value_type>"],returnedTypes:[],originalName:"map.remove",thisType:["map<>"]},{name:"clear",desc:["Clears the map, removing all key-value pairs from it."],args:[],examples:["//@version=5",'indicator("map.clear example")',"oddMap = map.new<int, bool>()","oddMap.put(1, true)","oddMap.put(2, false)","oddMap.put(3, true)","map.clear(oddMap)","plot(oddMap.size())"],seeAlso:["[map.new<type,type>](#fun_map.new<type,type>)","[map.put_all](#fun_map.put_all)","[map.keys](#fun_map.keys)","[map.values](#fun_map.values)","[map.remove](#fun_map.remove)"],syntax:["map.clear(id) → void"],returnedTypes:["void"],originalName:"map.clear",thisType:["map<>"]},{name:"delete",desc:["Deletes the specified [polyline](#op_polyline) object. It has no effect if the `id` doesn't exist."],args:[],syntax:["polyline.delete(id) → void"],returnedTypes:["void"],originalName:"polyline.delete",thisType:["series polyline"]}]},Bu=[{label:"if",insertText:"if ${1:condition}\n ${2:local_block}\n",kind:"statement"},{label:"if...else",insertText:`if \${1:condition}
97
+ \${2:local_block_1}
98
+ else
99
+ \${3:local_block_2}
100
+ `,kind:"statement"},{label:"for...to",insertText:"for ${1:i} = 1 to ${2:to_num} by 1\n ${3:local_block}\n",kind:"loop"},{label:"for...in",insertText:"for [${1:index}, ${2:value}] in ${3:arr}\n ${4:local_block}\n",kind:"loop"},{label:"while",insertText:"while ${1:condition}\n ${2:local_block}\n",kind:"statement"},{label:"switch",insertText:"switch ${1:condition}\n ${2:value_1} => ${3:local_block_1}\n ${4:value_2} => ${5:local_block_2}\n => ${6:default_local_block}\n",kind:"statement"}],Ie={keywords:"keyword",functions:"built-in function",variables:"built-in variable",methods:"built-in method",types:"built-in type",annotations:"annotation",constants:"built-in variable",namespace:"namespace",userDefinedVariable:"user-defined variable",userDefinedType:"user-defined type",field:"field",userDefinedMethod:"user-defined method",userDefinedFunction:"user-defined function",returns:"returns",parameter:"parameter",namespaceDesc:"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.",toTriggerParameterHints:"to trigger parameters hint"},ju={clickOnKeywordForMoreHelp:"`click` on keyword for more help"};function Uu(){const n={},s={};return Object.keys(Bn).reduce((a,l)=>{const u=Bn[l],p=Ie[l],{mapObj:m,keys:v}=Wu(u,p);return a.keyMapList[l]=m,a.keyList[l]=v,a},{keyList:n,keyMapList:s}),{keyList:n,keyMapList:s}}function Wu(n,s){const a=new Map,l=[];return n.forEach(u=>{var m;u.title=s;const p=u.originalName||u.name;p!=="for...in"&&(a.has(p)?(m=a.get(p))==null||m.push(u):(l.push(p),a.set(p,[u])))}),{mapObj:a,keys:l}}const{keyList:Gg,keyMapList:rr}=Uu();var jn;(function(n){n.Comment="comment",n.Text="text",n.String="string",n.Paren="paren",n.StringInvalid="string.invalid",n.ConstantNumericInteger="constant.numeric.integer",n.ConstantNumericFloat="constant.numeric.float",n.ConstantLanguage="constant.language",n.ConstantLanguageBoolean="constant.other.boolean",n.ConstantOtherColor="constant.other.color",n.SupportVariable="support.variable",n.SupportType="support.type",n.Keyword="keyword",n.KeywordEquals="keyword.equals",n.KeywordOperator="keyword.operator",n.CustomType="entity.name.type",n.VariableOther="variable.other",n.Property="variable.other.property",n.SupportFunction="support.function",n.SupportMethod="support.method",n.ImportedFunction="meta.function-call",n.Function="entity.name.function",n.ImportName="entity.name.module",n.ImportAlias="entity.name.module.name",n.ExtensionMethod="entity.name.method",n.Annotation="comment.annotation",n.PunctuationOperator="punctuation.operator",n.Empty="empty",n.Source="source"})(jn||(jn={}));var ft;(function(n){n.Type="type",n.Returns="Returns",n.Syntax="Syntax",n.Remarks="Remarks",n.Fields="Fields",n.Description="Description",n.Example="Example"})(ft||(ft={}));function Hu(n){return n.replace(/<.*>/,"")}class Vu{constructor(){Object.defineProperty(this,"delimiter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineBreak",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"paragraphBreak",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.delimiter="***",this.lineBreak=`
101
+ `,this.paragraphBreak=`
102
+
103
+ `}bold(s){return`**${s}**`}italic(s){return`*${s.replace(">","&gt;").replace("<","&lt;")}*`}pineCode(s){return`\`\`\`
104
+ ${s}
105
+ \`\`\``}code(s){return`\`${s}\``}paragraph(...s){return[this.paragraphBreak,...s,this.paragraphBreak].join(this.lineBreak)}link(s,a){return`[${s}](${a.href})`}}const fe=new Vu;function $u(n,s=0,a=!0){const l=n[s];if(!l)return"";const u=/(Mac|iPhone|iPod|iPad)/i.test(window.navigator.userAgent),{name:p,title:m,desc:v,type:g,syntax:b,returns:w,remarks:k,fields:z}=l,E=[`${fe.bold(p)} (${m})`];if(n.length>1&&E.push(fe.italic(`+${n.length-1} overloads`)),E.push(fe.delimiter),v&&E.push(fe.paragraph(Array.isArray(v)?v.join(fe.lineBreak):v||"")),g&&E.push(fe.paragraph(fe.bold(ft.Type),fe.italic(g))),b&&b.length&&E.push(fe.paragraph(fe.bold(ft.Syntax),fe.pineCode(b.join(fe.lineBreak)))),w&&E.push(fe.paragraph(fe.bold(ft.Returns),fe.lineBreak,w.join(fe.lineBreak))),k&&k.length&&n.length<=1){let R="";typeof k=="string"?R=k:R=k.join(fe.lineBreak)||"",R.length<200&&E.push(fe.paragraph(fe.bold(ft.Remarks),fe.lineBreak,R))}if(z){const R=[];for(const L of z){const J=L.desc?` - ${L.desc}`:"";R.push(`${L.name} (${L.type}) ${J}`)}E.push(fe.paragraph(fe.bold(ft.Fields),fe.lineBreak,R.join(fe.paragraphBreak)))}return a&&E.push(fe.italic(`${fe.code(u?"⌘":"Ctrl")} + ${ju.clickOnKeywordForMoreHelp}`)),E.join(E.length===2?" ":fe.lineBreak)}function Gu(n){return n.replace(/<[^<>]+>/,"").replace(/(series|simple|const|input)\s+([\w\d.]+)/,"$2").replace(/\w[\w.\d]*\[\]/,"array")}class Xu{constructor(){Object.defineProperty(this,"_bracketsPostfix",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_builtinSubtreeCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_formatter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_namespaceCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suggestions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_outermostNsItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_funcArgsCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userSuggestions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userFuncArgsCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userNamespaceCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userOutermostNsItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_methodNamespaceCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userMethods",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userFunctions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_methodFuncs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._bracketsPostfix="(${0})",this._builtinSubtreeCache={},this._formatter=fe,this._namespaceCache=new Map,this._suggestions=[],this._outermostNsItems=new Map,this._funcArgsCache=new Map,this._userSuggestions=[],this._userFuncArgsCache=new Map,this._userNamespaceCache=new Map,this._userOutermostNsItems=new Map,this._methodNamespaceCache=new Map,this._userMethods=new Map,this._userTypes=new Map,this._methodFuncs=new Map,this._userFunctions=new Map}get methodFuncs(){return this._methodFuncs}get userFuncs(){return this._userFunctions}initBuiltinsTrees(){this._getBuiltinsCacheFragment(),this._suggestions=this._getAllCompletionItems(),this._getFuncArgumentsCompletionItemsToCache(this._builtinSubtreeCache.functions)}getArgSuggestions(s){return this._funcArgsCache.get(s)||this._userFuncArgsCache.get(s)}getSuggestions(s){return s?this._namespaceCache.get(s)||this._userNamespaceCache.get(s):this._suggestions.concat(this._userSuggestions)}_initUserDefind(){this._userFuncArgsCache.clear(),this._userNamespaceCache.clear(),this._userOutermostNsItems.clear(),this._methodNamespaceCache.clear(),this._methodFuncs.clear()}setUserDefind(s,a,l,u){this._initUserDefind();const p=this._mergeTreeSlices(this._generateTreeSlice(rr.methods,"method"),this._generateTreeSlice(u,"method"));this._getMethodNamespaceCache(p),this._userMethods=u,this._userTypes=a,this._userFunctions=s;const m=this._generateTreeSlice(s,"fun");this._userSuggestions=this._getAllUserCompletionItems(m,this._generateTreeSlice(a,"type"),this._generateTreeSlice(l,"var")),this._getUserFuncArgumentsCompletionItemsToCache(m)}_getAllUserCompletionItems(s,a,l){const u=this._getUserVariableCompletionItems(l),p=this._getTypeCompletionItems(a,!0),m=this._getFunctionCompletionItems(s,void 0,!0);return[...p,...m,...u,...this._userOutermostNsItems.values()]}_getAllCompletionItems(){const{variables:s,keywords:a,types:l,functions:u}=this._builtinSubtreeCache,p=this._getVariableCompletionItems(s),m=this._getKeywordCompletionItems(a),v=this._getTypeCompletionItems(l),g=this._getFunctionCompletionItems(u),b=this._getSnippetsCompletionsList();return[...p,...m,...v,...g,...this._outermostNsItems.values(),...b]}_getNodeKey(s,a){return`${a}_${s}`}_mergeTreeSlices(...s){const a=new Map;for(const l of s)for(const[u,p]of l){const m=a.get(u);m?a.set(u,{...m,children:this._mergeTreeSlices(p.children,m.children)}):a.set(u,p)}return a}_mergeCompletions(s,a){const l=this._namespaceCache.get(s);l?this._namespaceCache.set(s,[...l,...a]):this._namespaceCache.set(s,a)}_mergeUserCompletions(s,a){const l=this._userNamespaceCache.get(s);l?this._userNamespaceCache.set(s,[...l,...a]):this._userNamespaceCache.set(s,a)}_generateTreeSlice(s,a){const l=new Map;for(const[u,p]of s){const[m,...v]=u.split("."),g=v.length>0,b=l.get(this._getNodeKey(m,g?"ns":a));let w=new Map,k=p.map(E=>({...E,name:u})),z=this._getNodeKey(u,a);if(g&&a!=="type"){const E=new Map([[v.join("."),p]]);k=[{name:m,title:Ie.namespace}],z=this._getNodeKey(m,"ns"),w=this._generateTreeSlice(E,a)}b&&(k=[{name:m,title:Ie.namespace}],w=this._mergeTreeSlices(b.children,w)),l.set(z,{value:k,children:w})}return l}_getBuiltinsCacheFragment(){const{keywords:s,variables:a,constants:l,types:u,functions:p}=rr;return this._builtinSubtreeCache={keywords:this._generateTreeSlice(s,"key"),variables:this._mergeTreeSlices(this._generateTreeSlice(a,"var"),this._generateTreeSlice(l,"var")),types:this._generateTreeSlice(u,"type"),functions:this._generateTreeSlice(p,"fun")},this._builtinSubtreeCache}_getVariableCompletionItems(s,a){const l=[],u=[];for(const[p,m]of s){const{value:v,children:g}=m;if(p.startsWith("ns")){const b=this._getNamespaceCompletionItem(v[0]);if(a){u.push({...b});const k=`${a}.${b.label}`;b.label=k,b.insertText=k}const w=this._getVariableCompletionItems(g,b.label);a||this._outermostNsItems.set(p,b),l.push(...w)}else{const b=this._getVariableCompletionItem(v[0],a?3:2);if(a){u.push({...b});const{label:w}=b;b.label=`${a}.${w}`,b.insertText=`${a}.${b.insertText}`,b.filterText=`${w}\r`}l.push(b)}}return u.length&&a&&this._mergeCompletions(a,u),l}_setUserVariableSubItems(s,a){var g,b;let l=[];const u=Gu(s.type||""),p=this._methodNamespaceCache.get(u),m=a?`${a}.${s.name}`:s.name;p&&(l=p.filter(w=>{var R;const k=`${u}.${w.label}`,z=rr.methods.get(k)||this._userMethods.get(k),E=z==null?void 0:z.some(L=>!L.thisType||L.thisType[0].includes("<>")||L.thisType.includes(s.type||""));if(E&&z){const L=this._getNamedArgumentsCompletionList(((R=z[0])==null?void 0:R.args)||[]),J=`${m}.${w.label}`;this._userFuncArgsCache.set(J,L),this._methodFuncs.set(J,z)}return E}));const v=(b=(g=this._userTypes.get(u))==null?void 0:g[0])==null?void 0:b.fields;if(v)for(const w of v){const k=w.name,z=w.type,E=this._getInstanceTypeCompletionItemProp({name:k,type:z});this._setUserVariableSubItems({name:k,type:z},s.name),l.push({...E})}l.length&&this._mergeUserCompletions(m,l)}_getUserVariableCompletionItems(s,a){const l=[],u=[];for(const[p,m]of s){const{value:v,children:g}=m;if(this._setUserVariableSubItems(v[0]),p.startsWith("ns")){const b=this._getNamespaceCompletionItem(v[0]);if(a){u.push({...b});const k=`${a}.${b.label}`;b.label=k,b.insertText=k}const w=this._getUserVariableCompletionItems(g,b.label);a||this._userOutermostNsItems.set(p,b),l.push(...w)}else{const b=this._getVariableCompletionItem(v[0],a?2:1,!0);if(a){u.push({...b});const{label:w}=b;b.label=`${a}.${w}`,b.insertText=`${a}.${b.insertText}`,b.filterText=`${w}\r`}l.push(b)}}return u.length&&a&&this._mergeUserCompletions(a,u),l}_getTypeCompletionItems(s,a=!1){const l=[];for(const[,u]of s){const{value:p}=u,m=a?this._getCustomTypeCompletionItem(p[0]):this._getTypeCompletionItem(p[0]);l.push(m)}return l}_getKeywordCompletionItems(s){const a=[];for(const[,l]of s){const{value:u}=l,p=this._getKeywordCompletionItem(u[0]);a.push(p)}return a}_getMethodNamespaceCache(s,a){const l=[];for(const[u,p]of s){const{value:m,children:v}=p;if(u.startsWith("ns")){const g=this._getNamespaceCompletionItem(m[0]);if(a){l.push({...g});const b=`${a}.${g.label}`;g.label=b,g.insertText=b}this._getMethodNamespaceCache(v,g.label)}else{const g=this._getFunctionCompletionItem(m[0],a?3:2);if(m.length>1&&(g.detail=`${g.detail} (+${m.length-1} overloads)`),a){l.push({...g});const{label:b}=g;g.label=`${a}.${b}`,g.insertText=`${a}.${g.insertText}`,g.filterText=`${b}\r`}}}a&&this._methodNamespaceCache.set(a,l)}_getFunctionCompletionItems(s,a,l=!1){const u=[],p=[];for(const[m,v]of s){const{value:g,children:b}=v;if(m.startsWith("ns")){const w=this._getNamespaceCompletionItem(g[0]);if(a){p.push({...w});const z=`${a}.${w.label}`;w.label=z,w.insertText=z}const k=this._getFunctionCompletionItems(b,w.label,l);a||(l?this._userOutermostNsItems.set(m,w):this._outermostNsItems.set(m,w)),u.push(...k)}else{const w=this._getFunctionCompletionItem(g[0],a?3:2,l);if(g.length>1&&(w.detail=`${w.detail} (+${g.length-1} overloads)`),a){p.push({...w});const{label:k}=w;w.label=`${a}.${k}`,w.insertText=`${a}.${w.insertText}`,w.filterText=`${k}\r`}u.push(w)}}return p.length&&a&&(l?this._mergeUserCompletions(a,p):this._mergeCompletions(a,p)),u}_getSnippetsCompletionsList(){return Bu.map(s=>{const{label:a,kind:l,insertText:u}=s,p=a.charAt(0).toUpperCase()+a.substring(1),m={value:this._formatter.pineCode(u.replace(/\${\d:([^}]+)}|\${\d}/g,"$1"))};return{label:a,detail:`(${p} ${l})`,insertText:u,insertTextRules:pt.languages.CompletionItemInsertTextRule.InsertAsSnippet,sortText:`2_${a}`,kind:pt.languages.CompletionItemKind.Snippet,documentation:m}})}_getFuncArgumentsCompletionItemsToCache(s,a){for(const[l,u]of s){const{name:p}=u.value[0];if(l.startsWith("ns"))this._getFuncArgumentsCompletionItemsToCache(u.children,a?`${a}.${p}`:p);else{const m=new Map;u.value.reduce((b,w)=>{const k=w.args;return k&&k.length&&k.forEach(z=>{b.set(z.name,z)}),b},m);const v=this._getNamedArgumentsCompletionList([...m.values()]),g=a?`${a}.${p}`:p;this._funcArgsCache.set(g,v)}}}_getUserFuncArgumentsCompletionItemsToCache(s,a){for(const[l,u]of s){const{name:p}=u.value[0];if(l.startsWith("ns"))this._getUserFuncArgumentsCompletionItemsToCache(u.children,a?`${a}.${p}`:p);else{const m=new Map;u.value.reduce((b,w)=>{const k=w.args;return k&&k.length&&k.forEach(z=>{b.set(z.name,z)}),b},m);const v=this._getNamedArgumentsCompletionList([...m.values()]),g=a?`${a}.${p}`:p;this._userFuncArgsCache.set(g,v)}}}_getNamedArgumentsCompletionList(s){return s.map(a=>{const{name:l,desc:u,displayType:p}=a,m=`${l} = `,v=Array.isArray(u)?u.join(this._formatter.delimiter):u||"";return{label:m,documentation:{value:this._formatter.paragraph(this._formatter.bold(Ie.Description),this._formatter.lineBreak,v)},insertText:m,detail:`(${Ie.parameter}) ${Ie.types} ${p}`,kind:pt.languages.CompletionItemKind.Text,sortText:`0_${m}`}})}_getVariableCompletionItem(s,a=2,l=!0){const u=this._extractExamples(s),p=this._extractDescription(s),m=[this._createDescriptionSection(p)];u.length?m.push(this._createExampleSection(u)):s.syntax&&s.syntax.length&&m.push(this._createSyntaxSection(s.syntax));const v={value:m.join(this._formatter.lineBreak)},g=l?Ie.variables:Ie.userDefinedVariable;return{documentation:v,label:s.name,insertText:s.name,kind:pt.languages.CompletionItemKind.Variable,sortText:`${a}_${s.name}`,detail:`(${g}) ${s.type}`}}_getKeywordCompletionItem(s,a=2){const l=this._extractExamples(s),u=this._extractDescription(s),p=[this._createDescriptionSection(u)];return l.length?p.push(this._createExampleSection(l)):s.syntax&&s.syntax.length&&p.push(this._createSyntaxSection(s.syntax)),{documentation:{value:p.join(this._formatter.lineBreak)},label:s.name,insertText:s.name,kind:pt.languages.CompletionItemKind.Keyword,sortText:`${a}_${s.name}`,detail:`(${Ie.keywords})`}}_getTypeCompletionItem(s){const a=this._extractDescription(s);return{documentation:{value:this._createDescriptionSection(a)},label:s.name,insertText:s.name,kind:pt.languages.CompletionItemKind.Keyword,sortText:`1_${s.name}`,detail:`(${Ie.types})`}}_getCustomTypeCompletionItem(s){const a=this._extractDescription(s);return{documentation:{value:this._createDescriptionSection(a)},label:s.name,insertText:s.name,kind:pt.languages.CompletionItemKind.Keyword,sortText:`2_${s.name}`,detail:`(${Ie.userDefinedType})`}}_getInstanceTypeCompletionItemProp(s){const a=this._extractDescription(s),l=[];return a&&l.push(this._formatter.paragraph(this._formatter.bold(ft.Description),this._formatter.lineBreak,a)),{documentation:{value:l.join(this._formatter.lineBreak)},label:s.name,insertText:s.name,kind:pt.languages.CompletionItemKind.Field,sortText:`2_${s.name}`,detail:`(${Ie.field}) ${s.type}`}}_getFunctionCompletionItem(s,a=2,l=!0){var E;const u=s.returnedTypes&&s.returnedTypes[0]||s.syntax&&s.syntax[0]&&((E=s.syntax[0].split("→").pop())==null?void 0:E.trim()),p=this._extractExamples(s),m=this._extractDescription(s),v=[this._createDescriptionSection(m)];p.length?v.push(this._createExampleSection(p)):s.syntax&&s.syntax.length&&v.push(this._createSyntaxSection(s.syntax)),s.returns&&s.returns.length&&v.push(this._createReturnSection(s.returns));const g={value:v.join(this._formatter.lineBreak)},b=s.name,w=l?Ie.functions:Ie.userDefinedFunction,k=s.template,z=k?`${Hu(b)}<\${1}>`:b;return{documentation:g,label:k?`${b.replace(/<.+>/,"")}<type>`:b,kind:pt.languages.CompletionItemKind.Function,sortText:`${a}_${b}`,insertTextRules:pt.languages.CompletionItemInsertTextRule.InsertAsSnippet,insertText:z+this._bracketsPostfix,detail:`(${w}) ${Ie.returns} ${u}`,command:{id:"tcc.editor.function",title:"",arguments:[k?"editor.action.triggerSuggest":"editor.action.triggerParameterHints"]}}}_getNamespaceCompletionItem(s,a=2){const l=[this._createDescriptionSection(Ie.namespaceDesc)];return{label:s.name,documentation:{value:l.join(this._formatter.lineBreak)},detail:`(${Ie.namespace}) ${s.name}`,insertText:s.name,sortText:`${a}_${s.name}`,kind:pt.languages.CompletionItemKind.Module}}_extractExamples(s){let a;return s.examples||s.detailedDesc&&((a=s.detailedDesc[0])===null||a===void 0?void 0:a.examples)||[]}_extractDescription(s){return Array.isArray(s.desc)?s.desc.join(this._formatter.lineBreak):s.desc||""}_createExampleSection(s){return this._formatter.paragraph(this._formatter.bold(ft.Example),this._formatter.pineCode(s.join(this._formatter.lineBreak)))}_createSyntaxSection(s){return this._formatter.paragraph(this._formatter.bold(ft.Syntax),this._formatter.pineCode(s.join(this._formatter.lineBreak)))}_createReturnSection(s){return this._formatter.paragraph(this._formatter.bold(ft.Returns),this._formatter.lineBreak,s.join(this._formatter.lineBreak))}_createDescriptionSection(s){return!s||s.trim().length===0?"":this._formatter.paragraph(this._formatter.bold(ft.Description),this._formatter.lineBreak,s)}}const Sr=new Xu;class Yu{constructor(){Object.defineProperty(this,"_userFunctions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userMethods",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_overloadsFuncs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._userFunctions=new Map,this._userVariables=new Map,this._userTypes=new Map,this._userMethods=new Map,this._overloadsFuncs=[]}setUserDefined(s,a){const{functions:l,variables:u,types:p,methods:m}=s;l&&(this._userFunctions=l),u&&(this._userVariables=u),p&&(this._userTypes=p),m&&(this._userMethods=m),this._overloadsFuncs=a}parseLineContentFuncVar(s,a,l){const u=s.indexOf("//");if(this._removeString(s).indexOf("//")!==-1&&u<=a)return;s=s+" ";const p=this._getVariablesDocVal(s,a,l);if(p)return p;const m=this._getFuncsDocVal(s,a,l);if(m)return m;const v=s.match(/[a-zA-Z_][a-zA-Z_0-9]*(\s*\.\s*[a-zA-Z_][a-zA-Z_0-9]*)*(?=\s*<)/g);if(v){const g=this._matchContent(v,s,a);if(g){const b=this._getBuildInOther(g.name);if(b)return{docValue:b,isBuildIn:!0,index:0};{const w=this._getBuildInFunc(`${g.name}<type>`);if(w)return{docValue:w,isBuildIn:!0,index:0}}}}return null}_getBuildInFunc(s){return rr.functions.get(s)}_getBuildInMethod(s){return rr.methods.get(s)}_getBuildInOther(s){const{keywords:a,variables:l,constants:u,types:p}=rr;return a.get(s)||l.get(s)||u.get(s)||p.get(s)}parseCurrentInputFunc(s,a=!1,l=!1){let u=s.length-1,p=0,m=a,v=l;for(;u>=0;){const g=s.charAt(u);if(u-=1,/['"]/.test(g)){const b=g;if(g==="'"){if(m){m=!1;continue}}else if(v){v=!1;continue}for(;u>=0;){const w=s.charAt(u);if(u-=1,w===b)break}}if(!(m||v)&&(/\)/.test(g)&&(p+=1),/\(/.test(g))){if(p>0){p-=1;continue}let b="";for(;u>=0;){const w=s.charAt(u);if(u-=1,!(/\s/.test(w)&&!b)){if(/[^\w.]/.test(w))break;b=w+b}}if(b)return{funcName:b,startIndex:u+1}}}}parseCurrentInputFuncAndArg(s,a=!1,l=!1){const{funcName:u,startIndex:p}=this.parseCurrentInputFunc(s,a,l)||{};if(u&&typeof p=="number"){let m=s.slice(p+u.length).trim().slice(1),v=-1;if(a&&(v=m.lastIndexOf("'")),l){const w=m.lastIndexOf('"');(w!==-1&&w<v||v===-1)&&(v=w)}v!==-1&&(m=m.substring(0,v));const b=m.replace(/[\w.]+\(.*\)/g,"").split(",").map(w=>{const k=w.trim().split("=");return k.length<=1?"":k[0].trim()});return{funcName:u,args:b}}}_removeString(s){return s.replace(/\\"|\\'/g,"").replace(/"[^"]*"|'[^']*'/g,"")}_getVariablesDocVal(s,a,l){const u=this._removeString(s).replace(/\/\/.*/g,"").match(/[a-zA-Z_][a-zA-Z_0-9]*(\s*\.\s*[a-zA-Z_][a-zA-Z_0-9]*)*(?=\s*[^(a-zA-Z_0-9."'<])/g);if(u){const p=this._matchContent(u,s,a);if(p){const m={docValue:void 0,isBuildIn:!0,index:0},v=this._getBuildInOther(p.name);if(v)return m.docValue=v,m;const g=this._getUserVariablesDocVal(p.name,a,l);if(g)return Object.assign(m,{docValue:[g],isBuildIn:!1});const b=this._getUserTypesDocVal(p.name);if(b)return Object.assign(m,{docValue:b,isBuildIn:!1});const w=this._getTypesAndFileds(s,p.name,a,l);if(w&&typeof w!="string")return Object.assign(m,{docValue:[w],isBuildIn:!1})}}}_getUserVariablesDocVal(s,a,l){const m=[...this._userVariables.get(s)||[]].sort((v,g)=>(g.scope||0)-(v.scope||0)).find(v=>{const g=v.range;return((g==null?void 0:g.startColumn)||0)<=a&&((g==null?void 0:g.startLineNumber)||0)<=l&&((g==null?void 0:g.endLineNumber)||0)>=l});if(m)return m.title=Ie.userDefinedVariable,m.type=this._arrayTypeTransform(m.type),m}_getUserTypesDocVal(s){const a=this._userTypes.get(s);if(a)return a[0].title=Ie.userDefinedType,a}_getTypesAndFileds(s,a,l,u){var p,m;if(a.includes(".")){const v=a.split(".");let g=v[0],b,w=null,k=s.indexOf(a,l-a.length)+1,z=k+g.length-1;for(const E of v.slice(1)){if(!w){const R=k<=l&&z>=l,L=this._getUserVariablesDocVal(g,l,u);if(R&&L)return L;w=L==null?void 0:L.type}if(w){b=w,k=z+2,z=z+E.length+1;const R=this._userTypes.get(w),L=(m=(p=R==null?void 0:R[0])==null?void 0:p.fields)==null?void 0:m.find(J=>J.name===E);if(L&&k<=l&&z>=l)return{name:`${w}.${E}`,type:this._arrayTypeTransform(L.type),title:Ie.field};w=L==null?void 0:L.type}else g=`${g}.${E}`,z=z+E.length+1}return b}}_getFuncsDocVal(s,a,l){const u=s.match(/[a-zA-Z_][a-zA-Z_0-9]*(\s*\.\s*[a-zA-Z_][a-zA-Z_0-9]*)*(?=\s*\()/g);if(u){const p=this._matchContent(u,s,a);if(p){const m={docValue:void 0,isBuildIn:!0,index:0},v=this._getBuildInFunc(p.name);if(v)return m.index=this._getOverloadsFuncIndex(v,a,p.name,l),Object.assign(m,{docValue:v});const g=this._getUserFuncsDocVal(p.name);if(g)return Object.assign(m,{docValue:g,isBuildIn:!1});const b=this._getUserVarFuncsDocVal(s,p.name,a,l);if(b)return Object.assign(m,{docValue:[b],isBuildIn:!1})}}}_getOverloadsFuncIndex(s,a,l,u){if(s.length>1){const p=this._overloadsFuncs.find(m=>m.name===l&&m.line===u&&m.startColumn<=a&&m.endColumn>=a);if(p)return p.index}return 0}_getUserFuncsDocVal(s){const a=this._userFunctions.get(s);if(a)return a[0].title=Ie.userDefinedFunction,a}_getUserMethodsDocVal(s){const a=this._userMethods.get(s);if(a)return a[0].title=Ie.userDefinedMethod,a}_getUserVarFuncsDocVal(s,a,l,u){var p;if(a.includes(".")){const m=a.split("."),v=this._getTypesAndFileds(s,a,l,u);if(typeof v=="string"){const b=`${this._arrayTypeTransform(v).replace(/<[^<>]+>/,"").replace(/(series|simple|const|input)\s+([\w\d.]+)/,"$2")}.${m.pop()}`,w=this._getBuildInMethod(b);if(w){const k=this._getOverloadsFuncIndex(w,l,b,u);return{...w[0],name:b,index:k}}return(p=this._getUserMethodsDocVal(b))==null?void 0:p[0]}else return v}}_arrayTypeTransform(s=""){return s.includes("[]")?`array<${s.replace("[]","")}>`:s}_matchContent(s,a,l){let u=0;for(const p of s){u=l-p.length;const m=a.indexOf(p,u);if(u=m+p.length,this._judgeVal(a,m,u)&&m+1<=l&&u>=l)return{name:p,endIndex:u}}}_judgeVal(s,a,l){const u=s.charAt(a-1),p=/[\w\d."']/;if(p.test(u))return!1;const m=s.charAt(l);return!p.test(m)}}const oa=new Yu;var Wa={exports:{}};/**
106
+ * @license
107
+ * Lodash <https://lodash.com/>
108
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
109
+ * Released under MIT license <https://lodash.com/license>
110
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
111
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
112
+ */Wa.exports,function(n,s){(function(){var a,l="4.17.21",u=200,p="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",m="Expected a function",v="Invalid `variable` option passed into `_.template`",g="__lodash_hash_undefined__",b=500,w="__lodash_placeholder__",k=1,z=2,E=4,R=1,L=2,J=1,de=2,ee=4,De=8,ne=16,Y=32,le=64,K=128,Ne=256,_e=512,re=30,yt="...",kt=800,Pe=16,we=1,W=2,ye=3,Re=1/0,Me=9007199254740991,Ot=17976931348623157e292,jt=NaN,V=4294967295,ge=V-1,Le=V>>>1,Ut=[["ary",K],["bind",J],["bindKey",de],["curry",De],["curryRight",ne],["flip",_e],["partial",Y],["partialRight",le],["rearg",Ne]],$e="[object Arguments]",sr="[object Array]",da="[object AsyncFunction]",Et="[object Boolean]",Wt="[object Date]",Nr="[object DOMException]",Pr="[object Error]",_r="[object Function]",Qa="[object GeneratorFunction]",st="[object Map]",Mt="[object Number]",Rr="[object Null]",ht="[object Object]",pa="[object Promise]",Or="[object Proxy]",gr="[object RegExp]",it="[object Set]",Ht="[object String]",Er="[object Symbol]",ii="[object Undefined]",ir="[object WeakMap]",Za="[object WeakSet]",At="[object ArrayBuffer]",nr="[object DataView]",Mr="[object Float32Array]",Lr="[object Float64Array]",br="[object Int8Array]",ma="[object Int16Array]",fa="[object Int32Array]",ya="[object Uint8Array]",ha="[object Uint8ClampedArray]",_a="[object Uint16Array]",ga="[object Uint32Array]",ni=/\b__p \+= '';/g,ba=/\b(__p \+=) '' \+/g,Ja=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Vt=/&(?:amp|lt|gt|quot|#39);/g,Fr=/[&<>"']/g,xa=RegExp(Vt.source),es=RegExp(Fr.source),oi=/<%-([\s\S]+?)%>/g,ts=/<%([\s\S]+?)%>/g,rs=/<%=([\s\S]+?)%>/g,as=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ss=/^\w*$/,li=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,va=/[\\^$.*+?()[\]{}|]/g,is=RegExp(va.source),wa=/^\s+/,ci=/\s/,ui=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,di=/\{\n\/\* \[wrapped with (.+)\] \*/,y=/,? & /,S=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,N=/[()=,{}\[\]\/\s]/,H=/\\(\\)?/g,ce=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,se=/^[-+]0x[0-9a-f]+$/i,te=/^0b[01]+$/i,Be=/^\[object .+?Constructor\]$/,ke=/^0o[0-7]+$/i,qe=/^(?:0|[1-9]\d*)$/,Qe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qt=/($^)/,ns=/['\n\r\u2028\u2029\\]/g,Ze="\\ud800-\\udfff",Fd="\\u0300-\\u036f",Bd="\\ufe20-\\ufe2f",jd="\\u20d0-\\u20ff",no=Fd+Bd+jd,oo="\\u2700-\\u27bf",lo="a-z\\xdf-\\xf6\\xf8-\\xff",Ud="\\xac\\xb1\\xd7\\xf7",Wd="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Hd="\\u2000-\\u206f",Vd=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",co="A-Z\\xc0-\\xd6\\xd8-\\xde",uo="\\ufe0e\\ufe0f",po=Ud+Wd+Hd+Vd,pi="['’]",$d="["+Ze+"]",mo="["+po+"]",os="["+no+"]",fo="\\d+",Gd="["+oo+"]",yo="["+lo+"]",ho="[^"+Ze+po+fo+oo+lo+co+"]",mi="\\ud83c[\\udffb-\\udfff]",Xd="(?:"+os+"|"+mi+")",_o="[^"+Ze+"]",fi="(?:\\ud83c[\\udde6-\\uddff]){2}",yi="[\\ud800-\\udbff][\\udc00-\\udfff]",Br="["+co+"]",go="\\u200d",bo="(?:"+yo+"|"+ho+")",Yd="(?:"+Br+"|"+ho+")",xo="(?:"+pi+"(?:d|ll|m|re|s|t|ve))?",vo="(?:"+pi+"(?:D|LL|M|RE|S|T|VE))?",wo=Xd+"?",To="["+uo+"]?",Kd="(?:"+go+"(?:"+[_o,fi,yi].join("|")+")"+To+wo+")*",Qd="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Io=To+wo+Kd,Jd="(?:"+[Gd,fi,yi].join("|")+")"+Io,ep="(?:"+[_o+os+"?",os,fi,yi,$d].join("|")+")",tp=RegExp(pi,"g"),rp=RegExp(os,"g"),hi=RegExp(mi+"(?="+mi+")|"+ep+Io,"g"),ap=RegExp([Br+"?"+yo+"+"+xo+"(?="+[mo,Br,"$"].join("|")+")",Yd+"+"+vo+"(?="+[mo,Br+bo,"$"].join("|")+")",Br+"?"+bo+"+"+xo,Br+"+"+vo,Zd,Qd,fo,Jd].join("|"),"g"),sp=RegExp("["+go+Ze+no+uo+"]"),ip=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,np=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],op=-1,ve={};ve[Mr]=ve[Lr]=ve[br]=ve[ma]=ve[fa]=ve[ya]=ve[ha]=ve[_a]=ve[ga]=!0,ve[$e]=ve[sr]=ve[At]=ve[Et]=ve[nr]=ve[Wt]=ve[Pr]=ve[_r]=ve[st]=ve[Mt]=ve[ht]=ve[gr]=ve[it]=ve[Ht]=ve[ir]=!1;var xe={};xe[$e]=xe[sr]=xe[At]=xe[nr]=xe[Et]=xe[Wt]=xe[Mr]=xe[Lr]=xe[br]=xe[ma]=xe[fa]=xe[st]=xe[Mt]=xe[ht]=xe[gr]=xe[it]=xe[Ht]=xe[Er]=xe[ya]=xe[ha]=xe[_a]=xe[ga]=!0,xe[Pr]=xe[_r]=xe[ir]=!1;var lp={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},cp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},up={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},dp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},pp=parseFloat,mp=parseInt,Do=typeof ea=="object"&&ea&&ea.Object===Object&&ea,fp=typeof self=="object"&&self&&self.Object===Object&&self,je=Do||fp||Function("return this")(),_i=s&&!s.nodeType&&s,xr=_i&&!0&&n&&!n.nodeType&&n,ko=xr&&xr.exports===_i,gi=ko&&Do.process,_t=function(){try{var _=xr&&xr.require&&xr.require("util").types;return _||gi&&gi.binding&&gi.binding("util")}catch{}}(),Ao=_t&&_t.isArrayBuffer,qo=_t&&_t.isDate,Co=_t&&_t.isMap,So=_t&&_t.isRegExp,zo=_t&&_t.isSet,No=_t&&_t.isTypedArray;function nt(_,D,T){switch(T.length){case 0:return _.call(D);case 1:return _.call(D,T[0]);case 2:return _.call(D,T[0],T[1]);case 3:return _.call(D,T[0],T[1],T[2])}return _.apply(D,T)}function yp(_,D,T,O){for(var $=-1,ue=_==null?0:_.length;++$<ue;){var Oe=_[$];D(O,Oe,T(Oe),_)}return O}function gt(_,D){for(var T=-1,O=_==null?0:_.length;++T<O&&D(_[T],T,_)!==!1;);return _}function hp(_,D){for(var T=_==null?0:_.length;T--&&D(_[T],T,_)!==!1;);return _}function Po(_,D){for(var T=-1,O=_==null?0:_.length;++T<O;)if(!D(_[T],T,_))return!1;return!0}function or(_,D){for(var T=-1,O=_==null?0:_.length,$=0,ue=[];++T<O;){var Oe=_[T];D(Oe,T,_)&&(ue[$++]=Oe)}return ue}function ls(_,D){var T=_==null?0:_.length;return!!T&&jr(_,D,0)>-1}function bi(_,D,T){for(var O=-1,$=_==null?0:_.length;++O<$;)if(T(D,_[O]))return!0;return!1}function Te(_,D){for(var T=-1,O=_==null?0:_.length,$=Array(O);++T<O;)$[T]=D(_[T],T,_);return $}function lr(_,D){for(var T=-1,O=D.length,$=_.length;++T<O;)_[$+T]=D[T];return _}function xi(_,D,T,O){var $=-1,ue=_==null?0:_.length;for(O&&ue&&(T=_[++$]);++$<ue;)T=D(T,_[$],$,_);return T}function _p(_,D,T,O){var $=_==null?0:_.length;for(O&&$&&(T=_[--$]);$--;)T=D(T,_[$],$,_);return T}function vi(_,D){for(var T=-1,O=_==null?0:_.length;++T<O;)if(D(_[T],T,_))return!0;return!1}var gp=wi("length");function bp(_){return _.split("")}function xp(_){return _.match(S)||[]}function Ro(_,D,T){var O;return T(_,function($,ue,Oe){if(D($,ue,Oe))return O=ue,!1}),O}function cs(_,D,T,O){for(var $=_.length,ue=T+(O?1:-1);O?ue--:++ue<$;)if(D(_[ue],ue,_))return ue;return-1}function jr(_,D,T){return D===D?Np(_,D,T):cs(_,Oo,T)}function vp(_,D,T,O){for(var $=T-1,ue=_.length;++$<ue;)if(O(_[$],D))return $;return-1}function Oo(_){return _!==_}function Eo(_,D){var T=_==null?0:_.length;return T?Ii(_,D)/T:jt}function wi(_){return function(D){return D==null?a:D[_]}}function Ti(_){return function(D){return _==null?a:_[D]}}function Mo(_,D,T,O,$){return $(_,function(ue,Oe,be){T=O?(O=!1,ue):D(T,ue,Oe,be)}),T}function wp(_,D){var T=_.length;for(_.sort(D);T--;)_[T]=_[T].value;return _}function Ii(_,D){for(var T,O=-1,$=_.length;++O<$;){var ue=D(_[O]);ue!==a&&(T=T===a?ue:T+ue)}return T}function Di(_,D){for(var T=-1,O=Array(_);++T<_;)O[T]=D(T);return O}function Tp(_,D){return Te(D,function(T){return[T,_[T]]})}function Lo(_){return _&&_.slice(0,Uo(_)+1).replace(wa,"")}function ot(_){return function(D){return _(D)}}function ki(_,D){return Te(D,function(T){return _[T]})}function Ta(_,D){return _.has(D)}function Fo(_,D){for(var T=-1,O=_.length;++T<O&&jr(D,_[T],0)>-1;);return T}function Bo(_,D){for(var T=_.length;T--&&jr(D,_[T],0)>-1;);return T}function Ip(_,D){for(var T=_.length,O=0;T--;)_[T]===D&&++O;return O}var Dp=Ti(lp),kp=Ti(cp);function Ap(_){return"\\"+dp[_]}function qp(_,D){return _==null?a:_[D]}function Ur(_){return sp.test(_)}function Cp(_){return ip.test(_)}function Sp(_){for(var D,T=[];!(D=_.next()).done;)T.push(D.value);return T}function Ai(_){var D=-1,T=Array(_.size);return _.forEach(function(O,$){T[++D]=[$,O]}),T}function jo(_,D){return function(T){return _(D(T))}}function cr(_,D){for(var T=-1,O=_.length,$=0,ue=[];++T<O;){var Oe=_[T];(Oe===D||Oe===w)&&(_[T]=w,ue[$++]=T)}return ue}function us(_){var D=-1,T=Array(_.size);return _.forEach(function(O){T[++D]=O}),T}function zp(_){var D=-1,T=Array(_.size);return _.forEach(function(O){T[++D]=[O,O]}),T}function Np(_,D,T){for(var O=T-1,$=_.length;++O<$;)if(_[O]===D)return O;return-1}function Pp(_,D,T){for(var O=T+1;O--;)if(_[O]===D)return O;return O}function Wr(_){return Ur(_)?Op(_):gp(_)}function Ct(_){return Ur(_)?Ep(_):bp(_)}function Uo(_){for(var D=_.length;D--&&ci.test(_.charAt(D)););return D}var Rp=Ti(up);function Op(_){for(var D=hi.lastIndex=0;hi.test(_);)++D;return D}function Ep(_){return _.match(hi)||[]}function Mp(_){return _.match(ap)||[]}var Lp=function _(D){D=D==null?je:Hr.defaults(je.Object(),D,Hr.pick(je,np));var T=D.Array,O=D.Date,$=D.Error,ue=D.Function,Oe=D.Math,be=D.Object,qi=D.RegExp,Fp=D.String,bt=D.TypeError,ds=T.prototype,Bp=ue.prototype,Vr=be.prototype,ps=D["__core-js_shared__"],ms=Bp.toString,he=Vr.hasOwnProperty,jp=0,Wo=function(){var e=/[^.]+$/.exec(ps&&ps.keys&&ps.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),fs=Vr.toString,Up=ms.call(be),Wp=je._,Hp=qi("^"+ms.call(he).replace(va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ys=ko?D.Buffer:a,ur=D.Symbol,hs=D.Uint8Array,Ho=ys?ys.allocUnsafe:a,_s=jo(be.getPrototypeOf,be),Vo=be.create,$o=Vr.propertyIsEnumerable,gs=ds.splice,Go=ur?ur.isConcatSpreadable:a,Ia=ur?ur.iterator:a,vr=ur?ur.toStringTag:a,bs=function(){try{var e=kr(be,"defineProperty");return e({},"",{}),e}catch{}}(),Vp=D.clearTimeout!==je.clearTimeout&&D.clearTimeout,$p=O&&O.now!==je.Date.now&&O.now,Gp=D.setTimeout!==je.setTimeout&&D.setTimeout,xs=Oe.ceil,vs=Oe.floor,Ci=be.getOwnPropertySymbols,Xp=ys?ys.isBuffer:a,Xo=D.isFinite,Yp=ds.join,Kp=jo(be.keys,be),Ee=Oe.max,He=Oe.min,Qp=O.now,Zp=D.parseInt,Yo=Oe.random,Jp=ds.reverse,Si=kr(D,"DataView"),Da=kr(D,"Map"),zi=kr(D,"Promise"),$r=kr(D,"Set"),ka=kr(D,"WeakMap"),Aa=kr(be,"create"),ws=ka&&new ka,Gr={},em=Ar(Si),tm=Ar(Da),rm=Ar(zi),am=Ar($r),sm=Ar(ka),Ts=ur?ur.prototype:a,qa=Ts?Ts.valueOf:a,Ko=Ts?Ts.toString:a;function c(e){if(Ce(e)&&!G(e)&&!(e instanceof ie)){if(e instanceof xt)return e;if(he.call(e,"__wrapped__"))return Ql(e)}return new xt(e)}var Xr=function(){function e(){}return function(t){if(!Ae(t))return{};if(Vo)return Vo(t);e.prototype=t;var r=new e;return e.prototype=a,r}}();function Is(){}function xt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=a}c.templateSettings={escape:oi,evaluate:ts,interpolate:rs,variable:"",imports:{_:c}},c.prototype=Is.prototype,c.prototype.constructor=c,xt.prototype=Xr(Is.prototype),xt.prototype.constructor=xt;function ie(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=V,this.__views__=[]}function im(){var e=new ie(this.__wrapped__);return e.__actions__=Je(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Je(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Je(this.__views__),e}function nm(){if(this.__filtered__){var e=new ie(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function om(){var e=this.__wrapped__.value(),t=this.__dir__,r=G(e),i=t<0,o=r?e.length:0,d=xf(0,o,this.__views__),f=d.start,h=d.end,x=h-f,A=i?h:f-1,q=this.__iteratees__,C=q.length,P=0,M=He(x,this.__takeCount__);if(!r||!i&&o==x&&M==x)return xl(e,this.__actions__);var j=[];e:for(;x--&&P<M;){A+=t;for(var Q=-1,U=e[A];++Q<C;){var ae=q[Q],oe=ae.iteratee,ut=ae.type,Ye=oe(U);if(ut==W)U=Ye;else if(!Ye){if(ut==we)continue e;break e}}j[P++]=U}return j}ie.prototype=Xr(Is.prototype),ie.prototype.constructor=ie;function wr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function lm(){this.__data__=Aa?Aa(null):{},this.size=0}function cm(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function um(e){var t=this.__data__;if(Aa){var r=t[e];return r===g?a:r}return he.call(t,e)?t[e]:a}function dm(e){var t=this.__data__;return Aa?t[e]!==a:he.call(t,e)}function pm(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Aa&&t===a?g:t,this}wr.prototype.clear=lm,wr.prototype.delete=cm,wr.prototype.get=um,wr.prototype.has=dm,wr.prototype.set=pm;function $t(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function mm(){this.__data__=[],this.size=0}function fm(e){var t=this.__data__,r=Ds(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():gs.call(t,r,1),--this.size,!0}function ym(e){var t=this.__data__,r=Ds(t,e);return r<0?a:t[r][1]}function hm(e){return Ds(this.__data__,e)>-1}function _m(e,t){var r=this.__data__,i=Ds(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}$t.prototype.clear=mm,$t.prototype.delete=fm,$t.prototype.get=ym,$t.prototype.has=hm,$t.prototype.set=_m;function Gt(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function gm(){this.size=0,this.__data__={hash:new wr,map:new(Da||$t),string:new wr}}function bm(e){var t=Ms(this,e).delete(e);return this.size-=t?1:0,t}function xm(e){return Ms(this,e).get(e)}function vm(e){return Ms(this,e).has(e)}function wm(e,t){var r=Ms(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}Gt.prototype.clear=gm,Gt.prototype.delete=bm,Gt.prototype.get=xm,Gt.prototype.has=vm,Gt.prototype.set=wm;function Tr(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Gt;++t<r;)this.add(e[t])}function Tm(e){return this.__data__.set(e,g),this}function Im(e){return this.__data__.has(e)}Tr.prototype.add=Tr.prototype.push=Tm,Tr.prototype.has=Im;function St(e){var t=this.__data__=new $t(e);this.size=t.size}function Dm(){this.__data__=new $t,this.size=0}function km(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Am(e){return this.__data__.get(e)}function qm(e){return this.__data__.has(e)}function Cm(e,t){var r=this.__data__;if(r instanceof $t){var i=r.__data__;if(!Da||i.length<u-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gt(i)}return r.set(e,t),this.size=r.size,this}St.prototype.clear=Dm,St.prototype.delete=km,St.prototype.get=Am,St.prototype.has=qm,St.prototype.set=Cm;function Qo(e,t){var r=G(e),i=!r&&qr(e),o=!r&&!i&&yr(e),d=!r&&!i&&!o&&Zr(e),f=r||i||o||d,h=f?Di(e.length,Fp):[],x=h.length;for(var A in e)(t||he.call(e,A))&&!(f&&(A=="length"||o&&(A=="offset"||A=="parent")||d&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||Qt(A,x)))&&h.push(A);return h}function Zo(e){var t=e.length;return t?e[Ui(0,t-1)]:a}function Sm(e,t){return Ls(Je(e),Ir(t,0,e.length))}function zm(e){return Ls(Je(e))}function Ni(e,t,r){(r!==a&&!zt(e[t],r)||r===a&&!(t in e))&&Xt(e,t,r)}function Ca(e,t,r){var i=e[t];(!(he.call(e,t)&&zt(i,r))||r===a&&!(t in e))&&Xt(e,t,r)}function Ds(e,t){for(var r=e.length;r--;)if(zt(e[r][0],t))return r;return-1}function Nm(e,t,r,i){return dr(e,function(o,d,f){t(i,o,r(o),f)}),i}function Jo(e,t){return e&&Ft(t,Fe(t),e)}function Pm(e,t){return e&&Ft(t,tt(t),e)}function Xt(e,t,r){t=="__proto__"&&bs?bs(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Pi(e,t){for(var r=-1,i=t.length,o=T(i),d=e==null;++r<i;)o[r]=d?a:fn(e,t[r]);return o}function Ir(e,t,r){return e===e&&(r!==a&&(e=e<=r?e:r),t!==a&&(e=e>=t?e:t)),e}function vt(e,t,r,i,o,d){var f,h=t&k,x=t&z,A=t&E;if(r&&(f=o?r(e,i,o,d):r(e)),f!==a)return f;if(!Ae(e))return e;var q=G(e);if(q){if(f=wf(e),!h)return Je(e,f)}else{var C=Ve(e),P=C==_r||C==Qa;if(yr(e))return Tl(e,h);if(C==ht||C==$e||P&&!o){if(f=x||P?{}:Ul(e),!h)return x?df(e,Pm(f,e)):uf(e,Jo(f,e))}else{if(!xe[C])return o?e:{};f=Tf(e,C,h)}}d||(d=new St);var M=d.get(e);if(M)return M;d.set(e,f),_c(e)?e.forEach(function(U){f.add(vt(U,t,r,U,e,d))}):yc(e)&&e.forEach(function(U,ae){f.set(ae,vt(U,t,r,ae,e,d))});var j=A?x?Ji:Zi:x?tt:Fe,Q=q?a:j(e);return gt(Q||e,function(U,ae){Q&&(ae=U,U=e[ae]),Ca(f,ae,vt(U,t,r,ae,e,d))}),f}function Rm(e){var t=Fe(e);return function(r){return el(r,e,t)}}function el(e,t,r){var i=r.length;if(e==null)return!i;for(e=be(e);i--;){var o=r[i],d=t[o],f=e[o];if(f===a&&!(o in e)||!d(f))return!1}return!0}function tl(e,t,r){if(typeof e!="function")throw new bt(m);return Ea(function(){e.apply(a,r)},t)}function Sa(e,t,r,i){var o=-1,d=ls,f=!0,h=e.length,x=[],A=t.length;if(!h)return x;r&&(t=Te(t,ot(r))),i?(d=bi,f=!1):t.length>=u&&(d=Ta,f=!1,t=new Tr(t));e:for(;++o<h;){var q=e[o],C=r==null?q:r(q);if(q=i||q!==0?q:0,f&&C===C){for(var P=A;P--;)if(t[P]===C)continue e;x.push(q)}else d(t,C,i)||x.push(q)}return x}var dr=ql(Lt),rl=ql(Oi,!0);function Om(e,t){var r=!0;return dr(e,function(i,o,d){return r=!!t(i,o,d),r}),r}function ks(e,t,r){for(var i=-1,o=e.length;++i<o;){var d=e[i],f=t(d);if(f!=null&&(h===a?f===f&&!ct(f):r(f,h)))var h=f,x=d}return x}function Em(e,t,r,i){var o=e.length;for(r=X(r),r<0&&(r=-r>o?0:o+r),i=i===a||i>o?o:X(i),i<0&&(i+=o),i=r>i?0:bc(i);r<i;)e[r++]=t;return e}function al(e,t){var r=[];return dr(e,function(i,o,d){t(i,o,d)&&r.push(i)}),r}function Ue(e,t,r,i,o){var d=-1,f=e.length;for(r||(r=Df),o||(o=[]);++d<f;){var h=e[d];t>0&&r(h)?t>1?Ue(h,t-1,r,i,o):lr(o,h):i||(o[o.length]=h)}return o}var Ri=Cl(),sl=Cl(!0);function Lt(e,t){return e&&Ri(e,t,Fe)}function Oi(e,t){return e&&sl(e,t,Fe)}function As(e,t){return or(t,function(r){return Zt(e[r])})}function Dr(e,t){t=mr(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[Bt(t[r++])];return r&&r==i?e:a}function il(e,t,r){var i=t(e);return G(e)?i:lr(i,r(e))}function Ge(e){return e==null?e===a?ii:Rr:vr&&vr in be(e)?bf(e):Nf(e)}function Ei(e,t){return e>t}function Mm(e,t){return e!=null&&he.call(e,t)}function Lm(e,t){return e!=null&&t in be(e)}function Fm(e,t,r){return e>=He(t,r)&&e<Ee(t,r)}function Mi(e,t,r){for(var i=r?bi:ls,o=e[0].length,d=e.length,f=d,h=T(d),x=1/0,A=[];f--;){var q=e[f];f&&t&&(q=Te(q,ot(t))),x=He(q.length,x),h[f]=!r&&(t||o>=120&&q.length>=120)?new Tr(f&&q):a}q=e[0];var C=-1,P=h[0];e:for(;++C<o&&A.length<x;){var M=q[C],j=t?t(M):M;if(M=r||M!==0?M:0,!(P?Ta(P,j):i(A,j,r))){for(f=d;--f;){var Q=h[f];if(!(Q?Ta(Q,j):i(e[f],j,r)))continue e}P&&P.push(j),A.push(M)}}return A}function Bm(e,t,r,i){return Lt(e,function(o,d,f){t(i,r(o),d,f)}),i}function za(e,t,r){t=mr(t,e),e=$l(e,t);var i=e==null?e:e[Bt(Tt(t))];return i==null?a:nt(i,e,r)}function nl(e){return Ce(e)&&Ge(e)==$e}function jm(e){return Ce(e)&&Ge(e)==At}function Um(e){return Ce(e)&&Ge(e)==Wt}function Na(e,t,r,i,o){return e===t?!0:e==null||t==null||!Ce(e)&&!Ce(t)?e!==e&&t!==t:Wm(e,t,r,i,Na,o)}function Wm(e,t,r,i,o,d){var f=G(e),h=G(t),x=f?sr:Ve(e),A=h?sr:Ve(t);x=x==$e?ht:x,A=A==$e?ht:A;var q=x==ht,C=A==ht,P=x==A;if(P&&yr(e)){if(!yr(t))return!1;f=!0,q=!1}if(P&&!q)return d||(d=new St),f||Zr(e)?Fl(e,t,r,i,o,d):_f(e,t,x,r,i,o,d);if(!(r&R)){var M=q&&he.call(e,"__wrapped__"),j=C&&he.call(t,"__wrapped__");if(M||j){var Q=M?e.value():e,U=j?t.value():t;return d||(d=new St),o(Q,U,r,i,d)}}return P?(d||(d=new St),gf(e,t,r,i,o,d)):!1}function Hm(e){return Ce(e)&&Ve(e)==st}function Li(e,t,r,i){var o=r.length,d=o,f=!i;if(e==null)return!d;for(e=be(e);o--;){var h=r[o];if(f&&h[2]?h[1]!==e[h[0]]:!(h[0]in e))return!1}for(;++o<d;){h=r[o];var x=h[0],A=e[x],q=h[1];if(f&&h[2]){if(A===a&&!(x in e))return!1}else{var C=new St;if(i)var P=i(A,q,x,e,t,C);if(!(P===a?Na(q,A,R|L,i,C):P))return!1}}return!0}function ol(e){if(!Ae(e)||Af(e))return!1;var t=Zt(e)?Hp:Be;return t.test(Ar(e))}function Vm(e){return Ce(e)&&Ge(e)==gr}function $m(e){return Ce(e)&&Ve(e)==it}function Gm(e){return Ce(e)&&Hs(e.length)&&!!ve[Ge(e)]}function ll(e){return typeof e=="function"?e:e==null?rt:typeof e=="object"?G(e)?dl(e[0],e[1]):ul(e):Sc(e)}function Fi(e){if(!Oa(e))return Kp(e);var t=[];for(var r in be(e))he.call(e,r)&&r!="constructor"&&t.push(r);return t}function Xm(e){if(!Ae(e))return zf(e);var t=Oa(e),r=[];for(var i in e)i=="constructor"&&(t||!he.call(e,i))||r.push(i);return r}function Bi(e,t){return e<t}function cl(e,t){var r=-1,i=et(e)?T(e.length):[];return dr(e,function(o,d,f){i[++r]=t(o,d,f)}),i}function ul(e){var t=tn(e);return t.length==1&&t[0][2]?Hl(t[0][0],t[0][1]):function(r){return r===e||Li(r,e,t)}}function dl(e,t){return an(e)&&Wl(t)?Hl(Bt(e),t):function(r){var i=fn(r,e);return i===a&&i===t?yn(r,e):Na(t,i,R|L)}}function qs(e,t,r,i,o){e!==t&&Ri(t,function(d,f){if(o||(o=new St),Ae(d))Ym(e,t,f,r,qs,i,o);else{var h=i?i(nn(e,f),d,f+"",e,t,o):a;h===a&&(h=d),Ni(e,f,h)}},tt)}function Ym(e,t,r,i,o,d,f){var h=nn(e,r),x=nn(t,r),A=f.get(x);if(A){Ni(e,r,A);return}var q=d?d(h,x,r+"",e,t,f):a,C=q===a;if(C){var P=G(x),M=!P&&yr(x),j=!P&&!M&&Zr(x);q=x,P||M||j?G(h)?q=h:Se(h)?q=Je(h):M?(C=!1,q=Tl(x,!0)):j?(C=!1,q=Il(x,!0)):q=[]:Ma(x)||qr(x)?(q=h,qr(h)?q=xc(h):(!Ae(h)||Zt(h))&&(q=Ul(x))):C=!1}C&&(f.set(x,q),o(q,x,i,d,f),f.delete(x)),Ni(e,r,q)}function pl(e,t){var r=e.length;if(r)return t+=t<0?r:0,Qt(t,r)?e[t]:a}function ml(e,t,r){t.length?t=Te(t,function(d){return G(d)?function(f){return Dr(f,d.length===1?d[0]:d)}:d}):t=[rt];var i=-1;t=Te(t,ot(B()));var o=cl(e,function(d,f,h){var x=Te(t,function(A){return A(d)});return{criteria:x,index:++i,value:d}});return wp(o,function(d,f){return cf(d,f,r)})}function Km(e,t){return fl(e,t,function(r,i){return yn(e,i)})}function fl(e,t,r){for(var i=-1,o=t.length,d={};++i<o;){var f=t[i],h=Dr(e,f);r(h,f)&&Pa(d,mr(f,e),h)}return d}function Qm(e){return function(t){return Dr(t,e)}}function ji(e,t,r,i){var o=i?vp:jr,d=-1,f=t.length,h=e;for(e===t&&(t=Je(t)),r&&(h=Te(e,ot(r)));++d<f;)for(var x=0,A=t[d],q=r?r(A):A;(x=o(h,q,x,i))>-1;)h!==e&&gs.call(h,x,1),gs.call(e,x,1);return e}function yl(e,t){for(var r=e?t.length:0,i=r-1;r--;){var o=t[r];if(r==i||o!==d){var d=o;Qt(o)?gs.call(e,o,1):Vi(e,o)}}return e}function Ui(e,t){return e+vs(Yo()*(t-e+1))}function Zm(e,t,r,i){for(var o=-1,d=Ee(xs((t-e)/(r||1)),0),f=T(d);d--;)f[i?d:++o]=e,e+=r;return f}function Wi(e,t){var r="";if(!e||t<1||t>Me)return r;do t%2&&(r+=e),t=vs(t/2),t&&(e+=e);while(t);return r}function Z(e,t){return on(Vl(e,t,rt),e+"")}function Jm(e){return Zo(Jr(e))}function ef(e,t){var r=Jr(e);return Ls(r,Ir(t,0,r.length))}function Pa(e,t,r,i){if(!Ae(e))return e;t=mr(t,e);for(var o=-1,d=t.length,f=d-1,h=e;h!=null&&++o<d;){var x=Bt(t[o]),A=r;if(x==="__proto__"||x==="constructor"||x==="prototype")return e;if(o!=f){var q=h[x];A=i?i(q,x,h):a,A===a&&(A=Ae(q)?q:Qt(t[o+1])?[]:{})}Ca(h,x,A),h=h[x]}return e}var hl=ws?function(e,t){return ws.set(e,t),e}:rt,tf=bs?function(e,t){return bs(e,"toString",{configurable:!0,enumerable:!1,value:_n(t),writable:!0})}:rt;function rf(e){return Ls(Jr(e))}function wt(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var d=T(o);++i<o;)d[i]=e[i+t];return d}function af(e,t){var r;return dr(e,function(i,o,d){return r=t(i,o,d),!r}),!!r}function Cs(e,t,r){var i=0,o=e==null?i:e.length;if(typeof t=="number"&&t===t&&o<=Le){for(;i<o;){var d=i+o>>>1,f=e[d];f!==null&&!ct(f)&&(r?f<=t:f<t)?i=d+1:o=d}return o}return Hi(e,t,rt,r)}function Hi(e,t,r,i){var o=0,d=e==null?0:e.length;if(d===0)return 0;t=r(t);for(var f=t!==t,h=t===null,x=ct(t),A=t===a;o<d;){var q=vs((o+d)/2),C=r(e[q]),P=C!==a,M=C===null,j=C===C,Q=ct(C);if(f)var U=i||j;else A?U=j&&(i||P):h?U=j&&P&&(i||!M):x?U=j&&P&&!M&&(i||!Q):M||Q?U=!1:U=i?C<=t:C<t;U?o=q+1:d=q}return He(d,ge)}function _l(e,t){for(var r=-1,i=e.length,o=0,d=[];++r<i;){var f=e[r],h=t?t(f):f;if(!r||!zt(h,x)){var x=h;d[o++]=f===0?0:f}}return d}function gl(e){return typeof e=="number"?e:ct(e)?jt:+e}function lt(e){if(typeof e=="string")return e;if(G(e))return Te(e,lt)+"";if(ct(e))return Ko?Ko.call(e):"";var t=e+"";return t=="0"&&1/e==-Re?"-0":t}function pr(e,t,r){var i=-1,o=ls,d=e.length,f=!0,h=[],x=h;if(r)f=!1,o=bi;else if(d>=u){var A=t?null:yf(e);if(A)return us(A);f=!1,o=Ta,x=new Tr}else x=t?[]:h;e:for(;++i<d;){var q=e[i],C=t?t(q):q;if(q=r||q!==0?q:0,f&&C===C){for(var P=x.length;P--;)if(x[P]===C)continue e;t&&x.push(C),h.push(q)}else o(x,C,r)||(x!==h&&x.push(C),h.push(q))}return h}function Vi(e,t){return t=mr(t,e),e=$l(e,t),e==null||delete e[Bt(Tt(t))]}function bl(e,t,r,i){return Pa(e,t,r(Dr(e,t)),i)}function Ss(e,t,r,i){for(var o=e.length,d=i?o:-1;(i?d--:++d<o)&&t(e[d],d,e););return r?wt(e,i?0:d,i?d+1:o):wt(e,i?d+1:0,i?o:d)}function xl(e,t){var r=e;return r instanceof ie&&(r=r.value()),xi(t,function(i,o){return o.func.apply(o.thisArg,lr([i],o.args))},r)}function $i(e,t,r){var i=e.length;if(i<2)return i?pr(e[0]):[];for(var o=-1,d=T(i);++o<i;)for(var f=e[o],h=-1;++h<i;)h!=o&&(d[o]=Sa(d[o]||f,e[h],t,r));return pr(Ue(d,1),t,r)}function vl(e,t,r){for(var i=-1,o=e.length,d=t.length,f={};++i<o;){var h=i<d?t[i]:a;r(f,e[i],h)}return f}function Gi(e){return Se(e)?e:[]}function Xi(e){return typeof e=="function"?e:rt}function mr(e,t){return G(e)?e:an(e,t)?[e]:Kl(me(e))}var sf=Z;function fr(e,t,r){var i=e.length;return r=r===a?i:r,!t&&r>=i?e:wt(e,t,r)}var wl=Vp||function(e){return je.clearTimeout(e)};function Tl(e,t){if(t)return e.slice();var r=e.length,i=Ho?Ho(r):new e.constructor(r);return e.copy(i),i}function Yi(e){var t=new e.constructor(e.byteLength);return new hs(t).set(new hs(e)),t}function nf(e,t){var r=t?Yi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function of(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}function lf(e){return qa?be(qa.call(e)):{}}function Il(e,t){var r=t?Yi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Dl(e,t){if(e!==t){var r=e!==a,i=e===null,o=e===e,d=ct(e),f=t!==a,h=t===null,x=t===t,A=ct(t);if(!h&&!A&&!d&&e>t||d&&f&&x&&!h&&!A||i&&f&&x||!r&&x||!o)return 1;if(!i&&!d&&!A&&e<t||A&&r&&o&&!i&&!d||h&&r&&o||!f&&o||!x)return-1}return 0}function cf(e,t,r){for(var i=-1,o=e.criteria,d=t.criteria,f=o.length,h=r.length;++i<f;){var x=Dl(o[i],d[i]);if(x){if(i>=h)return x;var A=r[i];return x*(A=="desc"?-1:1)}}return e.index-t.index}function kl(e,t,r,i){for(var o=-1,d=e.length,f=r.length,h=-1,x=t.length,A=Ee(d-f,0),q=T(x+A),C=!i;++h<x;)q[h]=t[h];for(;++o<f;)(C||o<d)&&(q[r[o]]=e[o]);for(;A--;)q[h++]=e[o++];return q}function Al(e,t,r,i){for(var o=-1,d=e.length,f=-1,h=r.length,x=-1,A=t.length,q=Ee(d-h,0),C=T(q+A),P=!i;++o<q;)C[o]=e[o];for(var M=o;++x<A;)C[M+x]=t[x];for(;++f<h;)(P||o<d)&&(C[M+r[f]]=e[o++]);return C}function Je(e,t){var r=-1,i=e.length;for(t||(t=T(i));++r<i;)t[r]=e[r];return t}function Ft(e,t,r,i){var o=!r;r||(r={});for(var d=-1,f=t.length;++d<f;){var h=t[d],x=i?i(r[h],e[h],h,r,e):a;x===a&&(x=e[h]),o?Xt(r,h,x):Ca(r,h,x)}return r}function uf(e,t){return Ft(e,rn(e),t)}function df(e,t){return Ft(e,Bl(e),t)}function zs(e,t){return function(r,i){var o=G(r)?yp:Nm,d=t?t():{};return o(r,e,B(i,2),d)}}function Yr(e){return Z(function(t,r){var i=-1,o=r.length,d=o>1?r[o-1]:a,f=o>2?r[2]:a;for(d=e.length>3&&typeof d=="function"?(o--,d):a,f&&Xe(r[0],r[1],f)&&(d=o<3?a:d,o=1),t=be(t);++i<o;){var h=r[i];h&&e(t,h,i,d)}return t})}function ql(e,t){return function(r,i){if(r==null)return r;if(!et(r))return e(r,i);for(var o=r.length,d=t?o:-1,f=be(r);(t?d--:++d<o)&&i(f[d],d,f)!==!1;);return r}}function Cl(e){return function(t,r,i){for(var o=-1,d=be(t),f=i(t),h=f.length;h--;){var x=f[e?h:++o];if(r(d[x],x,d)===!1)break}return t}}function pf(e,t,r){var i=t&J,o=Ra(e);function d(){var f=this&&this!==je&&this instanceof d?o:e;return f.apply(i?r:this,arguments)}return d}function Sl(e){return function(t){t=me(t);var r=Ur(t)?Ct(t):a,i=r?r[0]:t.charAt(0),o=r?fr(r,1).join(""):t.slice(1);return i[e]()+o}}function Kr(e){return function(t){return xi(qc(Ac(t).replace(tp,"")),e,"")}}function Ra(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Xr(e.prototype),i=e.apply(r,t);return Ae(i)?i:r}}function mf(e,t,r){var i=Ra(e);function o(){for(var d=arguments.length,f=T(d),h=d,x=Qr(o);h--;)f[h]=arguments[h];var A=d<3&&f[0]!==x&&f[d-1]!==x?[]:cr(f,x);if(d-=A.length,d<r)return Ol(e,t,Ns,o.placeholder,a,f,A,a,a,r-d);var q=this&&this!==je&&this instanceof o?i:e;return nt(q,this,f)}return o}function zl(e){return function(t,r,i){var o=be(t);if(!et(t)){var d=B(r,3);t=Fe(t),r=function(h){return d(o[h],h,o)}}var f=e(t,r,i);return f>-1?o[d?t[f]:f]:a}}function Nl(e){return Kt(function(t){var r=t.length,i=r,o=xt.prototype.thru;for(e&&t.reverse();i--;){var d=t[i];if(typeof d!="function")throw new bt(m);if(o&&!f&&Es(d)=="wrapper")var f=new xt([],!0)}for(i=f?i:r;++i<r;){d=t[i];var h=Es(d),x=h=="wrapper"?en(d):a;x&&sn(x[0])&&x[1]==(K|De|Y|Ne)&&!x[4].length&&x[9]==1?f=f[Es(x[0])].apply(f,x[3]):f=d.length==1&&sn(d)?f[h]():f.thru(d)}return function(){var A=arguments,q=A[0];if(f&&A.length==1&&G(q))return f.plant(q).value();for(var C=0,P=r?t[C].apply(this,A):q;++C<r;)P=t[C].call(this,P);return P}})}function Ns(e,t,r,i,o,d,f,h,x,A){var q=t&K,C=t&J,P=t&de,M=t&(De|ne),j=t&_e,Q=P?a:Ra(e);function U(){for(var ae=arguments.length,oe=T(ae),ut=ae;ut--;)oe[ut]=arguments[ut];if(M)var Ye=Qr(U),dt=Ip(oe,Ye);if(i&&(oe=kl(oe,i,o,M)),d&&(oe=Al(oe,d,f,M)),ae-=dt,M&&ae<A){var ze=cr(oe,Ye);return Ol(e,t,Ns,U.placeholder,r,oe,ze,h,x,A-ae)}var Nt=C?r:this,er=P?Nt[e]:e;return ae=oe.length,h?oe=Pf(oe,h):j&&ae>1&&oe.reverse(),q&&x<ae&&(oe.length=x),this&&this!==je&&this instanceof U&&(er=Q||Ra(er)),er.apply(Nt,oe)}return U}function Pl(e,t){return function(r,i){return Bm(r,e,t(i),{})}}function Ps(e,t){return function(r,i){var o;if(r===a&&i===a)return t;if(r!==a&&(o=r),i!==a){if(o===a)return i;typeof r=="string"||typeof i=="string"?(r=lt(r),i=lt(i)):(r=gl(r),i=gl(i)),o=e(r,i)}return o}}function Ki(e){return Kt(function(t){return t=Te(t,ot(B())),Z(function(r){var i=this;return e(t,function(o){return nt(o,i,r)})})})}function Rs(e,t){t=t===a?" ":lt(t);var r=t.length;if(r<2)return r?Wi(t,e):t;var i=Wi(t,xs(e/Wr(t)));return Ur(t)?fr(Ct(i),0,e).join(""):i.slice(0,e)}function ff(e,t,r,i){var o=t&J,d=Ra(e);function f(){for(var h=-1,x=arguments.length,A=-1,q=i.length,C=T(q+x),P=this&&this!==je&&this instanceof f?d:e;++A<q;)C[A]=i[A];for(;x--;)C[A++]=arguments[++h];return nt(P,o?r:this,C)}return f}function Rl(e){return function(t,r,i){return i&&typeof i!="number"&&Xe(t,r,i)&&(r=i=a),t=Jt(t),r===a?(r=t,t=0):r=Jt(r),i=i===a?t<r?1:-1:Jt(i),Zm(t,r,i,e)}}function Os(e){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=It(t),r=It(r)),e(t,r)}}function Ol(e,t,r,i,o,d,f,h,x,A){var q=t&De,C=q?f:a,P=q?a:f,M=q?d:a,j=q?a:d;t|=q?Y:le,t&=~(q?le:Y),t&ee||(t&=~(J|de));var Q=[e,t,o,M,C,j,P,h,x,A],U=r.apply(a,Q);return sn(e)&&Gl(U,Q),U.placeholder=i,Xl(U,e,t)}function Qi(e){var t=Oe[e];return function(r,i){if(r=It(r),i=i==null?0:He(X(i),292),i&&Xo(r)){var o=(me(r)+"e").split("e"),d=t(o[0]+"e"+(+o[1]+i));return o=(me(d)+"e").split("e"),+(o[0]+"e"+(+o[1]-i))}return t(r)}}var yf=$r&&1/us(new $r([,-0]))[1]==Re?function(e){return new $r(e)}:xn;function El(e){return function(t){var r=Ve(t);return r==st?Ai(t):r==it?zp(t):Tp(t,e(t))}}function Yt(e,t,r,i,o,d,f,h){var x=t&de;if(!x&&typeof e!="function")throw new bt(m);var A=i?i.length:0;if(A||(t&=~(Y|le),i=o=a),f=f===a?f:Ee(X(f),0),h=h===a?h:X(h),A-=o?o.length:0,t&le){var q=i,C=o;i=o=a}var P=x?a:en(e),M=[e,t,r,i,o,q,C,d,f,h];if(P&&Sf(M,P),e=M[0],t=M[1],r=M[2],i=M[3],o=M[4],h=M[9]=M[9]===a?x?0:e.length:Ee(M[9]-A,0),!h&&t&(De|ne)&&(t&=~(De|ne)),!t||t==J)var j=pf(e,t,r);else t==De||t==ne?j=mf(e,t,h):(t==Y||t==(J|Y))&&!o.length?j=ff(e,t,r,i):j=Ns.apply(a,M);var Q=P?hl:Gl;return Xl(Q(j,M),e,t)}function Ml(e,t,r,i){return e===a||zt(e,Vr[r])&&!he.call(i,r)?t:e}function Ll(e,t,r,i,o,d){return Ae(e)&&Ae(t)&&(d.set(t,e),qs(e,t,a,Ll,d),d.delete(t)),e}function hf(e){return Ma(e)?a:e}function Fl(e,t,r,i,o,d){var f=r&R,h=e.length,x=t.length;if(h!=x&&!(f&&x>h))return!1;var A=d.get(e),q=d.get(t);if(A&&q)return A==t&&q==e;var C=-1,P=!0,M=r&L?new Tr:a;for(d.set(e,t),d.set(t,e);++C<h;){var j=e[C],Q=t[C];if(i)var U=f?i(Q,j,C,t,e,d):i(j,Q,C,e,t,d);if(U!==a){if(U)continue;P=!1;break}if(M){if(!vi(t,function(ae,oe){if(!Ta(M,oe)&&(j===ae||o(j,ae,r,i,d)))return M.push(oe)})){P=!1;break}}else if(!(j===Q||o(j,Q,r,i,d))){P=!1;break}}return d.delete(e),d.delete(t),P}function _f(e,t,r,i,o,d,f){switch(r){case nr:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case At:return!(e.byteLength!=t.byteLength||!d(new hs(e),new hs(t)));case Et:case Wt:case Mt:return zt(+e,+t);case Pr:return e.name==t.name&&e.message==t.message;case gr:case Ht:return e==t+"";case st:var h=Ai;case it:var x=i&R;if(h||(h=us),e.size!=t.size&&!x)return!1;var A=f.get(e);if(A)return A==t;i|=L,f.set(e,t);var q=Fl(h(e),h(t),i,o,d,f);return f.delete(e),q;case Er:if(qa)return qa.call(e)==qa.call(t)}return!1}function gf(e,t,r,i,o,d){var f=r&R,h=Zi(e),x=h.length,A=Zi(t),q=A.length;if(x!=q&&!f)return!1;for(var C=x;C--;){var P=h[C];if(!(f?P in t:he.call(t,P)))return!1}var M=d.get(e),j=d.get(t);if(M&&j)return M==t&&j==e;var Q=!0;d.set(e,t),d.set(t,e);for(var U=f;++C<x;){P=h[C];var ae=e[P],oe=t[P];if(i)var ut=f?i(oe,ae,P,t,e,d):i(ae,oe,P,e,t,d);if(!(ut===a?ae===oe||o(ae,oe,r,i,d):ut)){Q=!1;break}U||(U=P=="constructor")}if(Q&&!U){var Ye=e.constructor,dt=t.constructor;Ye!=dt&&"constructor"in e&&"constructor"in t&&!(typeof Ye=="function"&&Ye instanceof Ye&&typeof dt=="function"&&dt instanceof dt)&&(Q=!1)}return d.delete(e),d.delete(t),Q}function Kt(e){return on(Vl(e,a,ec),e+"")}function Zi(e){return il(e,Fe,rn)}function Ji(e){return il(e,tt,Bl)}var en=ws?function(e){return ws.get(e)}:xn;function Es(e){for(var t=e.name+"",r=Gr[t],i=he.call(Gr,t)?r.length:0;i--;){var o=r[i],d=o.func;if(d==null||d==e)return o.name}return t}function Qr(e){var t=he.call(c,"placeholder")?c:e;return t.placeholder}function B(){var e=c.iteratee||gn;return e=e===gn?ll:e,arguments.length?e(arguments[0],arguments[1]):e}function Ms(e,t){var r=e.__data__;return kf(t)?r[typeof t=="string"?"string":"hash"]:r.map}function tn(e){for(var t=Fe(e),r=t.length;r--;){var i=t[r],o=e[i];t[r]=[i,o,Wl(o)]}return t}function kr(e,t){var r=qp(e,t);return ol(r)?r:a}function bf(e){var t=he.call(e,vr),r=e[vr];try{e[vr]=a;var i=!0}catch{}var o=fs.call(e);return i&&(t?e[vr]=r:delete e[vr]),o}var rn=Ci?function(e){return e==null?[]:(e=be(e),or(Ci(e),function(t){return $o.call(e,t)}))}:vn,Bl=Ci?function(e){for(var t=[];e;)lr(t,rn(e)),e=_s(e);return t}:vn,Ve=Ge;(Si&&Ve(new Si(new ArrayBuffer(1)))!=nr||Da&&Ve(new Da)!=st||zi&&Ve(zi.resolve())!=pa||$r&&Ve(new $r)!=it||ka&&Ve(new ka)!=ir)&&(Ve=function(e){var t=Ge(e),r=t==ht?e.constructor:a,i=r?Ar(r):"";if(i)switch(i){case em:return nr;case tm:return st;case rm:return pa;case am:return it;case sm:return ir}return t});function xf(e,t,r){for(var i=-1,o=r.length;++i<o;){var d=r[i],f=d.size;switch(d.type){case"drop":e+=f;break;case"dropRight":t-=f;break;case"take":t=He(t,e+f);break;case"takeRight":e=Ee(e,t-f);break}}return{start:e,end:t}}function vf(e){var t=e.match(di);return t?t[1].split(y):[]}function jl(e,t,r){t=mr(t,e);for(var i=-1,o=t.length,d=!1;++i<o;){var f=Bt(t[i]);if(!(d=e!=null&&r(e,f)))break;e=e[f]}return d||++i!=o?d:(o=e==null?0:e.length,!!o&&Hs(o)&&Qt(f,o)&&(G(e)||qr(e)))}function wf(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&he.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Ul(e){return typeof e.constructor=="function"&&!Oa(e)?Xr(_s(e)):{}}function Tf(e,t,r){var i=e.constructor;switch(t){case At:return Yi(e);case Et:case Wt:return new i(+e);case nr:return nf(e,r);case Mr:case Lr:case br:case ma:case fa:case ya:case ha:case _a:case ga:return Il(e,r);case st:return new i;case Mt:case Ht:return new i(e);case gr:return of(e);case it:return new i;case Er:return lf(e)}}function If(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?"& ":"")+t[i],t=t.join(r>2?", ":" "),e.replace(ui,`{
113
+ /* [wrapped with `+t+`] */
114
+ `)}function Df(e){return G(e)||qr(e)||!!(Go&&e&&e[Go])}function Qt(e,t){var r=typeof e;return t=t??Me,!!t&&(r=="number"||r!="symbol"&&qe.test(e))&&e>-1&&e%1==0&&e<t}function Xe(e,t,r){if(!Ae(r))return!1;var i=typeof t;return(i=="number"?et(r)&&Qt(t,r.length):i=="string"&&t in r)?zt(r[t],e):!1}function an(e,t){if(G(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ct(e)?!0:ss.test(e)||!as.test(e)||t!=null&&e in be(t)}function kf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function sn(e){var t=Es(e),r=c[t];if(typeof r!="function"||!(t in ie.prototype))return!1;if(e===r)return!0;var i=en(r);return!!i&&e===i[0]}function Af(e){return!!Wo&&Wo in e}var qf=ps?Zt:wn;function Oa(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Vr;return e===r}function Wl(e){return e===e&&!Ae(e)}function Hl(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==a||e in be(r))}}function Cf(e){var t=Us(e,function(i){return r.size===b&&r.clear(),i}),r=t.cache;return t}function Sf(e,t){var r=e[1],i=t[1],o=r|i,d=o<(J|de|K),f=i==K&&r==De||i==K&&r==Ne&&e[7].length<=t[8]||i==(K|Ne)&&t[7].length<=t[8]&&r==De;if(!(d||f))return e;i&J&&(e[2]=t[2],o|=r&J?0:ee);var h=t[3];if(h){var x=e[3];e[3]=x?kl(x,h,t[4]):h,e[4]=x?cr(e[3],w):t[4]}return h=t[5],h&&(x=e[5],e[5]=x?Al(x,h,t[6]):h,e[6]=x?cr(e[5],w):t[6]),h=t[7],h&&(e[7]=h),i&K&&(e[8]=e[8]==null?t[8]:He(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=o,e}function zf(e){var t=[];if(e!=null)for(var r in be(e))t.push(r);return t}function Nf(e){return fs.call(e)}function Vl(e,t,r){return t=Ee(t===a?e.length-1:t,0),function(){for(var i=arguments,o=-1,d=Ee(i.length-t,0),f=T(d);++o<d;)f[o]=i[t+o];o=-1;for(var h=T(t+1);++o<t;)h[o]=i[o];return h[t]=r(f),nt(e,this,h)}}function $l(e,t){return t.length<2?e:Dr(e,wt(t,0,-1))}function Pf(e,t){for(var r=e.length,i=He(t.length,r),o=Je(e);i--;){var d=t[i];e[i]=Qt(d,r)?o[d]:a}return e}function nn(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Gl=Yl(hl),Ea=Gp||function(e,t){return je.setTimeout(e,t)},on=Yl(tf);function Xl(e,t,r){var i=t+"";return on(e,If(i,Rf(vf(i),r)))}function Yl(e){var t=0,r=0;return function(){var i=Qp(),o=Pe-(i-r);if(r=i,o>0){if(++t>=kt)return arguments[0]}else t=0;return e.apply(a,arguments)}}function Ls(e,t){var r=-1,i=e.length,o=i-1;for(t=t===a?i:t;++r<t;){var d=Ui(r,o),f=e[d];e[d]=e[r],e[r]=f}return e.length=t,e}var Kl=Cf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(li,function(r,i,o,d){t.push(o?d.replace(H,"$1"):i||r)}),t});function Bt(e){if(typeof e=="string"||ct(e))return e;var t=e+"";return t=="0"&&1/e==-Re?"-0":t}function Ar(e){if(e!=null){try{return ms.call(e)}catch{}try{return e+""}catch{}}return""}function Rf(e,t){return gt(Ut,function(r){var i="_."+r[0];t&r[1]&&!ls(e,i)&&e.push(i)}),e.sort()}function Ql(e){if(e instanceof ie)return e.clone();var t=new xt(e.__wrapped__,e.__chain__);return t.__actions__=Je(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Of(e,t,r){(r?Xe(e,t,r):t===a)?t=1:t=Ee(X(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var o=0,d=0,f=T(xs(i/t));o<i;)f[d++]=wt(e,o,o+=t);return f}function Ef(e){for(var t=-1,r=e==null?0:e.length,i=0,o=[];++t<r;){var d=e[t];d&&(o[i++]=d)}return o}function Mf(){var e=arguments.length;if(!e)return[];for(var t=T(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return lr(G(r)?Je(r):[r],Ue(t,1))}var Lf=Z(function(e,t){return Se(e)?Sa(e,Ue(t,1,Se,!0)):[]}),Ff=Z(function(e,t){var r=Tt(t);return Se(r)&&(r=a),Se(e)?Sa(e,Ue(t,1,Se,!0),B(r,2)):[]}),Bf=Z(function(e,t){var r=Tt(t);return Se(r)&&(r=a),Se(e)?Sa(e,Ue(t,1,Se,!0),a,r):[]});function jf(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===a?1:X(t),wt(e,t<0?0:t,i)):[]}function Uf(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===a?1:X(t),t=i-t,wt(e,0,t<0?0:t)):[]}function Wf(e,t){return e&&e.length?Ss(e,B(t,3),!0,!0):[]}function Hf(e,t){return e&&e.length?Ss(e,B(t,3),!0):[]}function Vf(e,t,r,i){var o=e==null?0:e.length;return o?(r&&typeof r!="number"&&Xe(e,t,r)&&(r=0,i=o),Em(e,t,r,i)):[]}function Zl(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var o=r==null?0:X(r);return o<0&&(o=Ee(i+o,0)),cs(e,B(t,3),o)}function Jl(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var o=i-1;return r!==a&&(o=X(r),o=r<0?Ee(i+o,0):He(o,i-1)),cs(e,B(t,3),o,!0)}function ec(e){var t=e==null?0:e.length;return t?Ue(e,1):[]}function $f(e){var t=e==null?0:e.length;return t?Ue(e,Re):[]}function Gf(e,t){var r=e==null?0:e.length;return r?(t=t===a?1:X(t),Ue(e,t)):[]}function Xf(e){for(var t=-1,r=e==null?0:e.length,i={};++t<r;){var o=e[t];i[o[0]]=o[1]}return i}function tc(e){return e&&e.length?e[0]:a}function Yf(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var o=r==null?0:X(r);return o<0&&(o=Ee(i+o,0)),jr(e,t,o)}function Kf(e){var t=e==null?0:e.length;return t?wt(e,0,-1):[]}var Qf=Z(function(e){var t=Te(e,Gi);return t.length&&t[0]===e[0]?Mi(t):[]}),Zf=Z(function(e){var t=Tt(e),r=Te(e,Gi);return t===Tt(r)?t=a:r.pop(),r.length&&r[0]===e[0]?Mi(r,B(t,2)):[]}),Jf=Z(function(e){var t=Tt(e),r=Te(e,Gi);return t=typeof t=="function"?t:a,t&&r.pop(),r.length&&r[0]===e[0]?Mi(r,a,t):[]});function ey(e,t){return e==null?"":Yp.call(e,t)}function Tt(e){var t=e==null?0:e.length;return t?e[t-1]:a}function ty(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var o=i;return r!==a&&(o=X(r),o=o<0?Ee(i+o,0):He(o,i-1)),t===t?Pp(e,t,o):cs(e,Oo,o,!0)}function ry(e,t){return e&&e.length?pl(e,X(t)):a}var ay=Z(rc);function rc(e,t){return e&&e.length&&t&&t.length?ji(e,t):e}function sy(e,t,r){return e&&e.length&&t&&t.length?ji(e,t,B(r,2)):e}function iy(e,t,r){return e&&e.length&&t&&t.length?ji(e,t,a,r):e}var ny=Kt(function(e,t){var r=e==null?0:e.length,i=Pi(e,t);return yl(e,Te(t,function(o){return Qt(o,r)?+o:o}).sort(Dl)),i});function oy(e,t){var r=[];if(!(e&&e.length))return r;var i=-1,o=[],d=e.length;for(t=B(t,3);++i<d;){var f=e[i];t(f,i,e)&&(r.push(f),o.push(i))}return yl(e,o),r}function ln(e){return e==null?e:Jp.call(e)}function ly(e,t,r){var i=e==null?0:e.length;return i?(r&&typeof r!="number"&&Xe(e,t,r)?(t=0,r=i):(t=t==null?0:X(t),r=r===a?i:X(r)),wt(e,t,r)):[]}function cy(e,t){return Cs(e,t)}function uy(e,t,r){return Hi(e,t,B(r,2))}function dy(e,t){var r=e==null?0:e.length;if(r){var i=Cs(e,t);if(i<r&&zt(e[i],t))return i}return-1}function py(e,t){return Cs(e,t,!0)}function my(e,t,r){return Hi(e,t,B(r,2),!0)}function fy(e,t){var r=e==null?0:e.length;if(r){var i=Cs(e,t,!0)-1;if(zt(e[i],t))return i}return-1}function yy(e){return e&&e.length?_l(e):[]}function hy(e,t){return e&&e.length?_l(e,B(t,2)):[]}function _y(e){var t=e==null?0:e.length;return t?wt(e,1,t):[]}function gy(e,t,r){return e&&e.length?(t=r||t===a?1:X(t),wt(e,0,t<0?0:t)):[]}function by(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===a?1:X(t),t=i-t,wt(e,t<0?0:t,i)):[]}function xy(e,t){return e&&e.length?Ss(e,B(t,3),!1,!0):[]}function vy(e,t){return e&&e.length?Ss(e,B(t,3)):[]}var wy=Z(function(e){return pr(Ue(e,1,Se,!0))}),Ty=Z(function(e){var t=Tt(e);return Se(t)&&(t=a),pr(Ue(e,1,Se,!0),B(t,2))}),Iy=Z(function(e){var t=Tt(e);return t=typeof t=="function"?t:a,pr(Ue(e,1,Se,!0),a,t)});function Dy(e){return e&&e.length?pr(e):[]}function ky(e,t){return e&&e.length?pr(e,B(t,2)):[]}function Ay(e,t){return t=typeof t=="function"?t:a,e&&e.length?pr(e,a,t):[]}function cn(e){if(!(e&&e.length))return[];var t=0;return e=or(e,function(r){if(Se(r))return t=Ee(r.length,t),!0}),Di(t,function(r){return Te(e,wi(r))})}function ac(e,t){if(!(e&&e.length))return[];var r=cn(e);return t==null?r:Te(r,function(i){return nt(t,a,i)})}var qy=Z(function(e,t){return Se(e)?Sa(e,t):[]}),Cy=Z(function(e){return $i(or(e,Se))}),Sy=Z(function(e){var t=Tt(e);return Se(t)&&(t=a),$i(or(e,Se),B(t,2))}),zy=Z(function(e){var t=Tt(e);return t=typeof t=="function"?t:a,$i(or(e,Se),a,t)}),Ny=Z(cn);function Py(e,t){return vl(e||[],t||[],Ca)}function Ry(e,t){return vl(e||[],t||[],Pa)}var Oy=Z(function(e){var t=e.length,r=t>1?e[t-1]:a;return r=typeof r=="function"?(e.pop(),r):a,ac(e,r)});function sc(e){var t=c(e);return t.__chain__=!0,t}function Ey(e,t){return t(e),e}function Fs(e,t){return t(e)}var My=Kt(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(d){return Pi(d,e)};return t>1||this.__actions__.length||!(i instanceof ie)||!Qt(r)?this.thru(o):(i=i.slice(r,+r+(t?1:0)),i.__actions__.push({func:Fs,args:[o],thisArg:a}),new xt(i,this.__chain__).thru(function(d){return t&&!d.length&&d.push(a),d}))});function Ly(){return sc(this)}function Fy(){return new xt(this.value(),this.__chain__)}function By(){this.__values__===a&&(this.__values__=gc(this.value()));var e=this.__index__>=this.__values__.length,t=e?a:this.__values__[this.__index__++];return{done:e,value:t}}function jy(){return this}function Uy(e){for(var t,r=this;r instanceof Is;){var i=Ql(r);i.__index__=0,i.__values__=a,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t}function Wy(){var e=this.__wrapped__;if(e instanceof ie){var t=e;return this.__actions__.length&&(t=new ie(this)),t=t.reverse(),t.__actions__.push({func:Fs,args:[ln],thisArg:a}),new xt(t,this.__chain__)}return this.thru(ln)}function Hy(){return xl(this.__wrapped__,this.__actions__)}var Vy=zs(function(e,t,r){he.call(e,r)?++e[r]:Xt(e,r,1)});function $y(e,t,r){var i=G(e)?Po:Om;return r&&Xe(e,t,r)&&(t=a),i(e,B(t,3))}function Gy(e,t){var r=G(e)?or:al;return r(e,B(t,3))}var Xy=zl(Zl),Yy=zl(Jl);function Ky(e,t){return Ue(Bs(e,t),1)}function Qy(e,t){return Ue(Bs(e,t),Re)}function Zy(e,t,r){return r=r===a?1:X(r),Ue(Bs(e,t),r)}function ic(e,t){var r=G(e)?gt:dr;return r(e,B(t,3))}function nc(e,t){var r=G(e)?hp:rl;return r(e,B(t,3))}var Jy=zs(function(e,t,r){he.call(e,r)?e[r].push(t):Xt(e,r,[t])});function eh(e,t,r,i){e=et(e)?e:Jr(e),r=r&&!i?X(r):0;var o=e.length;return r<0&&(r=Ee(o+r,0)),Vs(e)?r<=o&&e.indexOf(t,r)>-1:!!o&&jr(e,t,r)>-1}var th=Z(function(e,t,r){var i=-1,o=typeof t=="function",d=et(e)?T(e.length):[];return dr(e,function(f){d[++i]=o?nt(t,f,r):za(f,t,r)}),d}),rh=zs(function(e,t,r){Xt(e,r,t)});function Bs(e,t){var r=G(e)?Te:cl;return r(e,B(t,3))}function ah(e,t,r,i){return e==null?[]:(G(t)||(t=t==null?[]:[t]),r=i?a:r,G(r)||(r=r==null?[]:[r]),ml(e,t,r))}var sh=zs(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function ih(e,t,r){var i=G(e)?xi:Mo,o=arguments.length<3;return i(e,B(t,4),r,o,dr)}function nh(e,t,r){var i=G(e)?_p:Mo,o=arguments.length<3;return i(e,B(t,4),r,o,rl)}function oh(e,t){var r=G(e)?or:al;return r(e,Ws(B(t,3)))}function lh(e){var t=G(e)?Zo:Jm;return t(e)}function ch(e,t,r){(r?Xe(e,t,r):t===a)?t=1:t=X(t);var i=G(e)?Sm:ef;return i(e,t)}function uh(e){var t=G(e)?zm:rf;return t(e)}function dh(e){if(e==null)return 0;if(et(e))return Vs(e)?Wr(e):e.length;var t=Ve(e);return t==st||t==it?e.size:Fi(e).length}function ph(e,t,r){var i=G(e)?vi:af;return r&&Xe(e,t,r)&&(t=a),i(e,B(t,3))}var mh=Z(function(e,t){if(e==null)return[];var r=t.length;return r>1&&Xe(e,t[0],t[1])?t=[]:r>2&&Xe(t[0],t[1],t[2])&&(t=[t[0]]),ml(e,Ue(t,1),[])}),js=$p||function(){return je.Date.now()};function fh(e,t){if(typeof t!="function")throw new bt(m);return e=X(e),function(){if(--e<1)return t.apply(this,arguments)}}function oc(e,t,r){return t=r?a:t,t=e&&t==null?e.length:t,Yt(e,K,a,a,a,a,t)}function lc(e,t){var r;if(typeof t!="function")throw new bt(m);return e=X(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=a),r}}var un=Z(function(e,t,r){var i=J;if(r.length){var o=cr(r,Qr(un));i|=Y}return Yt(e,i,t,r,o)}),cc=Z(function(e,t,r){var i=J|de;if(r.length){var o=cr(r,Qr(cc));i|=Y}return Yt(t,i,e,r,o)});function uc(e,t,r){t=r?a:t;var i=Yt(e,De,a,a,a,a,a,t);return i.placeholder=uc.placeholder,i}function dc(e,t,r){t=r?a:t;var i=Yt(e,ne,a,a,a,a,a,t);return i.placeholder=dc.placeholder,i}function pc(e,t,r){var i,o,d,f,h,x,A=0,q=!1,C=!1,P=!0;if(typeof e!="function")throw new bt(m);t=It(t)||0,Ae(r)&&(q=!!r.leading,C="maxWait"in r,d=C?Ee(It(r.maxWait)||0,t):d,P="trailing"in r?!!r.trailing:P);function M(ze){var Nt=i,er=o;return i=o=a,A=ze,f=e.apply(er,Nt),f}function j(ze){return A=ze,h=Ea(ae,t),q?M(ze):f}function Q(ze){var Nt=ze-x,er=ze-A,zc=t-Nt;return C?He(zc,d-er):zc}function U(ze){var Nt=ze-x,er=ze-A;return x===a||Nt>=t||Nt<0||C&&er>=d}function ae(){var ze=js();if(U(ze))return oe(ze);h=Ea(ae,Q(ze))}function oe(ze){return h=a,P&&i?M(ze):(i=o=a,f)}function ut(){h!==a&&wl(h),A=0,i=x=o=h=a}function Ye(){return h===a?f:oe(js())}function dt(){var ze=js(),Nt=U(ze);if(i=arguments,o=this,x=ze,Nt){if(h===a)return j(x);if(C)return wl(h),h=Ea(ae,t),M(x)}return h===a&&(h=Ea(ae,t)),f}return dt.cancel=ut,dt.flush=Ye,dt}var yh=Z(function(e,t){return tl(e,1,t)}),hh=Z(function(e,t,r){return tl(e,It(t)||0,r)});function _h(e){return Yt(e,_e)}function Us(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new bt(m);var r=function(){var i=arguments,o=t?t.apply(this,i):i[0],d=r.cache;if(d.has(o))return d.get(o);var f=e.apply(this,i);return r.cache=d.set(o,f)||d,f};return r.cache=new(Us.Cache||Gt),r}Us.Cache=Gt;function Ws(e){if(typeof e!="function")throw new bt(m);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function gh(e){return lc(2,e)}var bh=sf(function(e,t){t=t.length==1&&G(t[0])?Te(t[0],ot(B())):Te(Ue(t,1),ot(B()));var r=t.length;return Z(function(i){for(var o=-1,d=He(i.length,r);++o<d;)i[o]=t[o].call(this,i[o]);return nt(e,this,i)})}),dn=Z(function(e,t){var r=cr(t,Qr(dn));return Yt(e,Y,a,t,r)}),mc=Z(function(e,t){var r=cr(t,Qr(mc));return Yt(e,le,a,t,r)}),xh=Kt(function(e,t){return Yt(e,Ne,a,a,a,t)});function vh(e,t){if(typeof e!="function")throw new bt(m);return t=t===a?t:X(t),Z(e,t)}function wh(e,t){if(typeof e!="function")throw new bt(m);return t=t==null?0:Ee(X(t),0),Z(function(r){var i=r[t],o=fr(r,0,t);return i&&lr(o,i),nt(e,this,o)})}function Th(e,t,r){var i=!0,o=!0;if(typeof e!="function")throw new bt(m);return Ae(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),pc(e,t,{leading:i,maxWait:t,trailing:o})}function Ih(e){return oc(e,1)}function Dh(e,t){return dn(Xi(t),e)}function kh(){if(!arguments.length)return[];var e=arguments[0];return G(e)?e:[e]}function Ah(e){return vt(e,E)}function qh(e,t){return t=typeof t=="function"?t:a,vt(e,E,t)}function Ch(e){return vt(e,k|E)}function Sh(e,t){return t=typeof t=="function"?t:a,vt(e,k|E,t)}function zh(e,t){return t==null||el(e,t,Fe(t))}function zt(e,t){return e===t||e!==e&&t!==t}var Nh=Os(Ei),Ph=Os(function(e,t){return e>=t}),qr=nl(function(){return arguments}())?nl:function(e){return Ce(e)&&he.call(e,"callee")&&!$o.call(e,"callee")},G=T.isArray,Rh=Ao?ot(Ao):jm;function et(e){return e!=null&&Hs(e.length)&&!Zt(e)}function Se(e){return Ce(e)&&et(e)}function Oh(e){return e===!0||e===!1||Ce(e)&&Ge(e)==Et}var yr=Xp||wn,Eh=qo?ot(qo):Um;function Mh(e){return Ce(e)&&e.nodeType===1&&!Ma(e)}function Lh(e){if(e==null)return!0;if(et(e)&&(G(e)||typeof e=="string"||typeof e.splice=="function"||yr(e)||Zr(e)||qr(e)))return!e.length;var t=Ve(e);if(t==st||t==it)return!e.size;if(Oa(e))return!Fi(e).length;for(var r in e)if(he.call(e,r))return!1;return!0}function Fh(e,t){return Na(e,t)}function Bh(e,t,r){r=typeof r=="function"?r:a;var i=r?r(e,t):a;return i===a?Na(e,t,a,r):!!i}function pn(e){if(!Ce(e))return!1;var t=Ge(e);return t==Pr||t==Nr||typeof e.message=="string"&&typeof e.name=="string"&&!Ma(e)}function jh(e){return typeof e=="number"&&Xo(e)}function Zt(e){if(!Ae(e))return!1;var t=Ge(e);return t==_r||t==Qa||t==da||t==Or}function fc(e){return typeof e=="number"&&e==X(e)}function Hs(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Me}function Ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ce(e){return e!=null&&typeof e=="object"}var yc=Co?ot(Co):Hm;function Uh(e,t){return e===t||Li(e,t,tn(t))}function Wh(e,t,r){return r=typeof r=="function"?r:a,Li(e,t,tn(t),r)}function Hh(e){return hc(e)&&e!=+e}function Vh(e){if(qf(e))throw new $(p);return ol(e)}function $h(e){return e===null}function Gh(e){return e==null}function hc(e){return typeof e=="number"||Ce(e)&&Ge(e)==Mt}function Ma(e){if(!Ce(e)||Ge(e)!=ht)return!1;var t=_s(e);if(t===null)return!0;var r=he.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ms.call(r)==Up}var mn=So?ot(So):Vm;function Xh(e){return fc(e)&&e>=-Me&&e<=Me}var _c=zo?ot(zo):$m;function Vs(e){return typeof e=="string"||!G(e)&&Ce(e)&&Ge(e)==Ht}function ct(e){return typeof e=="symbol"||Ce(e)&&Ge(e)==Er}var Zr=No?ot(No):Gm;function Yh(e){return e===a}function Kh(e){return Ce(e)&&Ve(e)==ir}function Qh(e){return Ce(e)&&Ge(e)==Za}var Zh=Os(Bi),Jh=Os(function(e,t){return e<=t});function gc(e){if(!e)return[];if(et(e))return Vs(e)?Ct(e):Je(e);if(Ia&&e[Ia])return Sp(e[Ia]());var t=Ve(e),r=t==st?Ai:t==it?us:Jr;return r(e)}function Jt(e){if(!e)return e===0?e:0;if(e=It(e),e===Re||e===-Re){var t=e<0?-1:1;return t*Ot}return e===e?e:0}function X(e){var t=Jt(e),r=t%1;return t===t?r?t-r:t:0}function bc(e){return e?Ir(X(e),0,V):0}function It(e){if(typeof e=="number")return e;if(ct(e))return jt;if(Ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Lo(e);var r=te.test(e);return r||ke.test(e)?mp(e.slice(2),r?2:8):se.test(e)?jt:+e}function xc(e){return Ft(e,tt(e))}function e_(e){return e?Ir(X(e),-Me,Me):e===0?e:0}function me(e){return e==null?"":lt(e)}var t_=Yr(function(e,t){if(Oa(t)||et(t)){Ft(t,Fe(t),e);return}for(var r in t)he.call(t,r)&&Ca(e,r,t[r])}),vc=Yr(function(e,t){Ft(t,tt(t),e)}),$s=Yr(function(e,t,r,i){Ft(t,tt(t),e,i)}),r_=Yr(function(e,t,r,i){Ft(t,Fe(t),e,i)}),a_=Kt(Pi);function s_(e,t){var r=Xr(e);return t==null?r:Jo(r,t)}var i_=Z(function(e,t){e=be(e);var r=-1,i=t.length,o=i>2?t[2]:a;for(o&&Xe(t[0],t[1],o)&&(i=1);++r<i;)for(var d=t[r],f=tt(d),h=-1,x=f.length;++h<x;){var A=f[h],q=e[A];(q===a||zt(q,Vr[A])&&!he.call(e,A))&&(e[A]=d[A])}return e}),n_=Z(function(e){return e.push(a,Ll),nt(wc,a,e)});function o_(e,t){return Ro(e,B(t,3),Lt)}function l_(e,t){return Ro(e,B(t,3),Oi)}function c_(e,t){return e==null?e:Ri(e,B(t,3),tt)}function u_(e,t){return e==null?e:sl(e,B(t,3),tt)}function d_(e,t){return e&&Lt(e,B(t,3))}function p_(e,t){return e&&Oi(e,B(t,3))}function m_(e){return e==null?[]:As(e,Fe(e))}function f_(e){return e==null?[]:As(e,tt(e))}function fn(e,t,r){var i=e==null?a:Dr(e,t);return i===a?r:i}function y_(e,t){return e!=null&&jl(e,t,Mm)}function yn(e,t){return e!=null&&jl(e,t,Lm)}var h_=Pl(function(e,t,r){t!=null&&typeof t.toString!="function"&&(t=fs.call(t)),e[t]=r},_n(rt)),__=Pl(function(e,t,r){t!=null&&typeof t.toString!="function"&&(t=fs.call(t)),he.call(e,t)?e[t].push(r):e[t]=[r]},B),g_=Z(za);function Fe(e){return et(e)?Qo(e):Fi(e)}function tt(e){return et(e)?Qo(e,!0):Xm(e)}function b_(e,t){var r={};return t=B(t,3),Lt(e,function(i,o,d){Xt(r,t(i,o,d),i)}),r}function x_(e,t){var r={};return t=B(t,3),Lt(e,function(i,o,d){Xt(r,o,t(i,o,d))}),r}var v_=Yr(function(e,t,r){qs(e,t,r)}),wc=Yr(function(e,t,r,i){qs(e,t,r,i)}),w_=Kt(function(e,t){var r={};if(e==null)return r;var i=!1;t=Te(t,function(d){return d=mr(d,e),i||(i=d.length>1),d}),Ft(e,Ji(e),r),i&&(r=vt(r,k|z|E,hf));for(var o=t.length;o--;)Vi(r,t[o]);return r});function T_(e,t){return Tc(e,Ws(B(t)))}var I_=Kt(function(e,t){return e==null?{}:Km(e,t)});function Tc(e,t){if(e==null)return{};var r=Te(Ji(e),function(i){return[i]});return t=B(t),fl(e,r,function(i,o){return t(i,o[0])})}function D_(e,t,r){t=mr(t,e);var i=-1,o=t.length;for(o||(o=1,e=a);++i<o;){var d=e==null?a:e[Bt(t[i])];d===a&&(i=o,d=r),e=Zt(d)?d.call(e):d}return e}function k_(e,t,r){return e==null?e:Pa(e,t,r)}function A_(e,t,r,i){return i=typeof i=="function"?i:a,e==null?e:Pa(e,t,r,i)}var Ic=El(Fe),Dc=El(tt);function q_(e,t,r){var i=G(e),o=i||yr(e)||Zr(e);if(t=B(t,4),r==null){var d=e&&e.constructor;o?r=i?new d:[]:Ae(e)?r=Zt(d)?Xr(_s(e)):{}:r={}}return(o?gt:Lt)(e,function(f,h,x){return t(r,f,h,x)}),r}function C_(e,t){return e==null?!0:Vi(e,t)}function S_(e,t,r){return e==null?e:bl(e,t,Xi(r))}function z_(e,t,r,i){return i=typeof i=="function"?i:a,e==null?e:bl(e,t,Xi(r),i)}function Jr(e){return e==null?[]:ki(e,Fe(e))}function N_(e){return e==null?[]:ki(e,tt(e))}function P_(e,t,r){return r===a&&(r=t,t=a),r!==a&&(r=It(r),r=r===r?r:0),t!==a&&(t=It(t),t=t===t?t:0),Ir(It(e),t,r)}function R_(e,t,r){return t=Jt(t),r===a?(r=t,t=0):r=Jt(r),e=It(e),Fm(e,t,r)}function O_(e,t,r){if(r&&typeof r!="boolean"&&Xe(e,t,r)&&(t=r=a),r===a&&(typeof t=="boolean"?(r=t,t=a):typeof e=="boolean"&&(r=e,e=a)),e===a&&t===a?(e=0,t=1):(e=Jt(e),t===a?(t=e,e=0):t=Jt(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=Yo();return He(e+o*(t-e+pp("1e-"+((o+"").length-1))),t)}return Ui(e,t)}var E_=Kr(function(e,t,r){return t=t.toLowerCase(),e+(r?kc(t):t)});function kc(e){return hn(me(e).toLowerCase())}function Ac(e){return e=me(e),e&&e.replace(Qe,Dp).replace(rp,"")}function M_(e,t,r){e=me(e),t=lt(t);var i=e.length;r=r===a?i:Ir(X(r),0,i);var o=r;return r-=t.length,r>=0&&e.slice(r,o)==t}function L_(e){return e=me(e),e&&es.test(e)?e.replace(Fr,kp):e}function F_(e){return e=me(e),e&&is.test(e)?e.replace(va,"\\$&"):e}var B_=Kr(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),j_=Kr(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),U_=Sl("toLowerCase");function W_(e,t,r){e=me(e),t=X(t);var i=t?Wr(e):0;if(!t||i>=t)return e;var o=(t-i)/2;return Rs(vs(o),r)+e+Rs(xs(o),r)}function H_(e,t,r){e=me(e),t=X(t);var i=t?Wr(e):0;return t&&i<t?e+Rs(t-i,r):e}function V_(e,t,r){e=me(e),t=X(t);var i=t?Wr(e):0;return t&&i<t?Rs(t-i,r)+e:e}function $_(e,t,r){return r||t==null?t=0:t&&(t=+t),Zp(me(e).replace(wa,""),t||0)}function G_(e,t,r){return(r?Xe(e,t,r):t===a)?t=1:t=X(t),Wi(me(e),t)}function X_(){var e=arguments,t=me(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Y_=Kr(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()});function K_(e,t,r){return r&&typeof r!="number"&&Xe(e,t,r)&&(t=r=a),r=r===a?V:r>>>0,r?(e=me(e),e&&(typeof t=="string"||t!=null&&!mn(t))&&(t=lt(t),!t&&Ur(e))?fr(Ct(e),0,r):e.split(t,r)):[]}var Q_=Kr(function(e,t,r){return e+(r?" ":"")+hn(t)});function Z_(e,t,r){return e=me(e),r=r==null?0:Ir(X(r),0,e.length),t=lt(t),e.slice(r,r+t.length)==t}function J_(e,t,r){var i=c.templateSettings;r&&Xe(e,t,r)&&(t=a),e=me(e),t=$s({},t,i,Ml);var o=$s({},t.imports,i.imports,Ml),d=Fe(o),f=ki(o,d),h,x,A=0,q=t.interpolate||qt,C="__p += '",P=qi((t.escape||qt).source+"|"+q.source+"|"+(q===rs?ce:qt).source+"|"+(t.evaluate||qt).source+"|$","g"),M="//# sourceURL="+(he.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++op+"]")+`
115
+ `;e.replace(P,function(U,ae,oe,ut,Ye,dt){return oe||(oe=ut),C+=e.slice(A,dt).replace(ns,Ap),ae&&(h=!0,C+=`' +
116
+ __e(`+ae+`) +
117
+ '`),Ye&&(x=!0,C+=`';
118
+ `+Ye+`;
119
+ __p += '`),oe&&(C+=`' +
120
+ ((__t = (`+oe+`)) == null ? '' : __t) +
121
+ '`),A=dt+U.length,U}),C+=`';
122
+ `;var j=he.call(t,"variable")&&t.variable;if(!j)C=`with (obj) {
123
+ `+C+`
124
+ }
125
+ `;else if(N.test(j))throw new $(v);C=(x?C.replace(ni,""):C).replace(ba,"$1").replace(Ja,"$1;"),C="function("+(j||"obj")+`) {
126
+ `+(j?"":`obj || (obj = {});
127
+ `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(x?`, __j = Array.prototype.join;
128
+ function print() { __p += __j.call(arguments, '') }
129
+ `:`;
130
+ `)+C+`return __p
131
+ }`;var Q=Cc(function(){return ue(d,M+"return "+C).apply(a,f)});if(Q.source=C,pn(Q))throw Q;return Q}function eg(e){return me(e).toLowerCase()}function tg(e){return me(e).toUpperCase()}function rg(e,t,r){if(e=me(e),e&&(r||t===a))return Lo(e);if(!e||!(t=lt(t)))return e;var i=Ct(e),o=Ct(t),d=Fo(i,o),f=Bo(i,o)+1;return fr(i,d,f).join("")}function ag(e,t,r){if(e=me(e),e&&(r||t===a))return e.slice(0,Uo(e)+1);if(!e||!(t=lt(t)))return e;var i=Ct(e),o=Bo(i,Ct(t))+1;return fr(i,0,o).join("")}function sg(e,t,r){if(e=me(e),e&&(r||t===a))return e.replace(wa,"");if(!e||!(t=lt(t)))return e;var i=Ct(e),o=Fo(i,Ct(t));return fr(i,o).join("")}function ig(e,t){var r=re,i=yt;if(Ae(t)){var o="separator"in t?t.separator:o;r="length"in t?X(t.length):r,i="omission"in t?lt(t.omission):i}e=me(e);var d=e.length;if(Ur(e)){var f=Ct(e);d=f.length}if(r>=d)return e;var h=r-Wr(i);if(h<1)return i;var x=f?fr(f,0,h).join(""):e.slice(0,h);if(o===a)return x+i;if(f&&(h+=x.length-h),mn(o)){if(e.slice(h).search(o)){var A,q=x;for(o.global||(o=qi(o.source,me(pe.exec(o))+"g")),o.lastIndex=0;A=o.exec(q);)var C=A.index;x=x.slice(0,C===a?h:C)}}else if(e.indexOf(lt(o),h)!=h){var P=x.lastIndexOf(o);P>-1&&(x=x.slice(0,P))}return x+i}function ng(e){return e=me(e),e&&xa.test(e)?e.replace(Vt,Rp):e}var og=Kr(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),hn=Sl("toUpperCase");function qc(e,t,r){return e=me(e),t=r?a:t,t===a?Cp(e)?Mp(e):xp(e):e.match(t)||[]}var Cc=Z(function(e,t){try{return nt(e,a,t)}catch(r){return pn(r)?r:new $(r)}}),lg=Kt(function(e,t){return gt(t,function(r){r=Bt(r),Xt(e,r,un(e[r],e))}),e});function cg(e){var t=e==null?0:e.length,r=B();return e=t?Te(e,function(i){if(typeof i[1]!="function")throw new bt(m);return[r(i[0]),i[1]]}):[],Z(function(i){for(var o=-1;++o<t;){var d=e[o];if(nt(d[0],this,i))return nt(d[1],this,i)}})}function ug(e){return Rm(vt(e,k))}function _n(e){return function(){return e}}function dg(e,t){return e==null||e!==e?t:e}var pg=Nl(),mg=Nl(!0);function rt(e){return e}function gn(e){return ll(typeof e=="function"?e:vt(e,k))}function fg(e){return ul(vt(e,k))}function yg(e,t){return dl(e,vt(t,k))}var hg=Z(function(e,t){return function(r){return za(r,e,t)}}),_g=Z(function(e,t){return function(r){return za(e,r,t)}});function bn(e,t,r){var i=Fe(t),o=As(t,i);r==null&&!(Ae(t)&&(o.length||!i.length))&&(r=t,t=e,e=this,o=As(t,Fe(t)));var d=!(Ae(r)&&"chain"in r)||!!r.chain,f=Zt(e);return gt(o,function(h){var x=t[h];e[h]=x,f&&(e.prototype[h]=function(){var A=this.__chain__;if(d||A){var q=e(this.__wrapped__),C=q.__actions__=Je(this.__actions__);return C.push({func:x,args:arguments,thisArg:e}),q.__chain__=A,q}return x.apply(e,lr([this.value()],arguments))})}),e}function gg(){return je._===this&&(je._=Wp),this}function xn(){}function bg(e){return e=X(e),Z(function(t){return pl(t,e)})}var xg=Ki(Te),vg=Ki(Po),wg=Ki(vi);function Sc(e){return an(e)?wi(Bt(e)):Qm(e)}function Tg(e){return function(t){return e==null?a:Dr(e,t)}}var Ig=Rl(),Dg=Rl(!0);function vn(){return[]}function wn(){return!1}function kg(){return{}}function Ag(){return""}function qg(){return!0}function Cg(e,t){if(e=X(e),e<1||e>Me)return[];var r=V,i=He(e,V);t=B(t),e-=V;for(var o=Di(i,t);++r<e;)t(r);return o}function Sg(e){return G(e)?Te(e,Bt):ct(e)?[e]:Je(Kl(me(e)))}function zg(e){var t=++jp;return me(e)+t}var Ng=Ps(function(e,t){return e+t},0),Pg=Qi("ceil"),Rg=Ps(function(e,t){return e/t},1),Og=Qi("floor");function Eg(e){return e&&e.length?ks(e,rt,Ei):a}function Mg(e,t){return e&&e.length?ks(e,B(t,2),Ei):a}function Lg(e){return Eo(e,rt)}function Fg(e,t){return Eo(e,B(t,2))}function Bg(e){return e&&e.length?ks(e,rt,Bi):a}function jg(e,t){return e&&e.length?ks(e,B(t,2),Bi):a}var Ug=Ps(function(e,t){return e*t},1),Wg=Qi("round"),Hg=Ps(function(e,t){return e-t},0);function Vg(e){return e&&e.length?Ii(e,rt):0}function $g(e,t){return e&&e.length?Ii(e,B(t,2)):0}return c.after=fh,c.ary=oc,c.assign=t_,c.assignIn=vc,c.assignInWith=$s,c.assignWith=r_,c.at=a_,c.before=lc,c.bind=un,c.bindAll=lg,c.bindKey=cc,c.castArray=kh,c.chain=sc,c.chunk=Of,c.compact=Ef,c.concat=Mf,c.cond=cg,c.conforms=ug,c.constant=_n,c.countBy=Vy,c.create=s_,c.curry=uc,c.curryRight=dc,c.debounce=pc,c.defaults=i_,c.defaultsDeep=n_,c.defer=yh,c.delay=hh,c.difference=Lf,c.differenceBy=Ff,c.differenceWith=Bf,c.drop=jf,c.dropRight=Uf,c.dropRightWhile=Wf,c.dropWhile=Hf,c.fill=Vf,c.filter=Gy,c.flatMap=Ky,c.flatMapDeep=Qy,c.flatMapDepth=Zy,c.flatten=ec,c.flattenDeep=$f,c.flattenDepth=Gf,c.flip=_h,c.flow=pg,c.flowRight=mg,c.fromPairs=Xf,c.functions=m_,c.functionsIn=f_,c.groupBy=Jy,c.initial=Kf,c.intersection=Qf,c.intersectionBy=Zf,c.intersectionWith=Jf,c.invert=h_,c.invertBy=__,c.invokeMap=th,c.iteratee=gn,c.keyBy=rh,c.keys=Fe,c.keysIn=tt,c.map=Bs,c.mapKeys=b_,c.mapValues=x_,c.matches=fg,c.matchesProperty=yg,c.memoize=Us,c.merge=v_,c.mergeWith=wc,c.method=hg,c.methodOf=_g,c.mixin=bn,c.negate=Ws,c.nthArg=bg,c.omit=w_,c.omitBy=T_,c.once=gh,c.orderBy=ah,c.over=xg,c.overArgs=bh,c.overEvery=vg,c.overSome=wg,c.partial=dn,c.partialRight=mc,c.partition=sh,c.pick=I_,c.pickBy=Tc,c.property=Sc,c.propertyOf=Tg,c.pull=ay,c.pullAll=rc,c.pullAllBy=sy,c.pullAllWith=iy,c.pullAt=ny,c.range=Ig,c.rangeRight=Dg,c.rearg=xh,c.reject=oh,c.remove=oy,c.rest=vh,c.reverse=ln,c.sampleSize=ch,c.set=k_,c.setWith=A_,c.shuffle=uh,c.slice=ly,c.sortBy=mh,c.sortedUniq=yy,c.sortedUniqBy=hy,c.split=K_,c.spread=wh,c.tail=_y,c.take=gy,c.takeRight=by,c.takeRightWhile=xy,c.takeWhile=vy,c.tap=Ey,c.throttle=Th,c.thru=Fs,c.toArray=gc,c.toPairs=Ic,c.toPairsIn=Dc,c.toPath=Sg,c.toPlainObject=xc,c.transform=q_,c.unary=Ih,c.union=wy,c.unionBy=Ty,c.unionWith=Iy,c.uniq=Dy,c.uniqBy=ky,c.uniqWith=Ay,c.unset=C_,c.unzip=cn,c.unzipWith=ac,c.update=S_,c.updateWith=z_,c.values=Jr,c.valuesIn=N_,c.without=qy,c.words=qc,c.wrap=Dh,c.xor=Cy,c.xorBy=Sy,c.xorWith=zy,c.zip=Ny,c.zipObject=Py,c.zipObjectDeep=Ry,c.zipWith=Oy,c.entries=Ic,c.entriesIn=Dc,c.extend=vc,c.extendWith=$s,bn(c,c),c.add=Ng,c.attempt=Cc,c.camelCase=E_,c.capitalize=kc,c.ceil=Pg,c.clamp=P_,c.clone=Ah,c.cloneDeep=Ch,c.cloneDeepWith=Sh,c.cloneWith=qh,c.conformsTo=zh,c.deburr=Ac,c.defaultTo=dg,c.divide=Rg,c.endsWith=M_,c.eq=zt,c.escape=L_,c.escapeRegExp=F_,c.every=$y,c.find=Xy,c.findIndex=Zl,c.findKey=o_,c.findLast=Yy,c.findLastIndex=Jl,c.findLastKey=l_,c.floor=Og,c.forEach=ic,c.forEachRight=nc,c.forIn=c_,c.forInRight=u_,c.forOwn=d_,c.forOwnRight=p_,c.get=fn,c.gt=Nh,c.gte=Ph,c.has=y_,c.hasIn=yn,c.head=tc,c.identity=rt,c.includes=eh,c.indexOf=Yf,c.inRange=R_,c.invoke=g_,c.isArguments=qr,c.isArray=G,c.isArrayBuffer=Rh,c.isArrayLike=et,c.isArrayLikeObject=Se,c.isBoolean=Oh,c.isBuffer=yr,c.isDate=Eh,c.isElement=Mh,c.isEmpty=Lh,c.isEqual=Fh,c.isEqualWith=Bh,c.isError=pn,c.isFinite=jh,c.isFunction=Zt,c.isInteger=fc,c.isLength=Hs,c.isMap=yc,c.isMatch=Uh,c.isMatchWith=Wh,c.isNaN=Hh,c.isNative=Vh,c.isNil=Gh,c.isNull=$h,c.isNumber=hc,c.isObject=Ae,c.isObjectLike=Ce,c.isPlainObject=Ma,c.isRegExp=mn,c.isSafeInteger=Xh,c.isSet=_c,c.isString=Vs,c.isSymbol=ct,c.isTypedArray=Zr,c.isUndefined=Yh,c.isWeakMap=Kh,c.isWeakSet=Qh,c.join=ey,c.kebabCase=B_,c.last=Tt,c.lastIndexOf=ty,c.lowerCase=j_,c.lowerFirst=U_,c.lt=Zh,c.lte=Jh,c.max=Eg,c.maxBy=Mg,c.mean=Lg,c.meanBy=Fg,c.min=Bg,c.minBy=jg,c.stubArray=vn,c.stubFalse=wn,c.stubObject=kg,c.stubString=Ag,c.stubTrue=qg,c.multiply=Ug,c.nth=ry,c.noConflict=gg,c.noop=xn,c.now=js,c.pad=W_,c.padEnd=H_,c.padStart=V_,c.parseInt=$_,c.random=O_,c.reduce=ih,c.reduceRight=nh,c.repeat=G_,c.replace=X_,c.result=D_,c.round=Wg,c.runInContext=_,c.sample=lh,c.size=dh,c.snakeCase=Y_,c.some=ph,c.sortedIndex=cy,c.sortedIndexBy=uy,c.sortedIndexOf=dy,c.sortedLastIndex=py,c.sortedLastIndexBy=my,c.sortedLastIndexOf=fy,c.startCase=Q_,c.startsWith=Z_,c.subtract=Hg,c.sum=Vg,c.sumBy=$g,c.template=J_,c.times=Cg,c.toFinite=Jt,c.toInteger=X,c.toLength=bc,c.toLower=eg,c.toNumber=It,c.toSafeInteger=e_,c.toString=me,c.toUpper=tg,c.trim=rg,c.trimEnd=ag,c.trimStart=sg,c.truncate=ig,c.unescape=ng,c.uniqueId=zg,c.upperCase=og,c.upperFirst=hn,c.each=ic,c.eachRight=nc,c.first=tc,bn(c,function(){var e={};return Lt(c,function(t,r){he.call(c.prototype,r)||(e[r]=t)}),e}(),{chain:!1}),c.VERSION=l,gt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){c[e].placeholder=c}),gt(["drop","take"],function(e,t){ie.prototype[e]=function(r){r=r===a?1:Ee(X(r),0);var i=this.__filtered__&&!t?new ie(this):this.clone();return i.__filtered__?i.__takeCount__=He(r,i.__takeCount__):i.__views__.push({size:He(r,V),type:e+(i.__dir__<0?"Right":"")}),i},ie.prototype[e+"Right"]=function(r){return this.reverse()[e](r).reverse()}}),gt(["filter","map","takeWhile"],function(e,t){var r=t+1,i=r==we||r==ye;ie.prototype[e]=function(o){var d=this.clone();return d.__iteratees__.push({iteratee:B(o,3),type:r}),d.__filtered__=d.__filtered__||i,d}}),gt(["head","last"],function(e,t){var r="take"+(t?"Right":"");ie.prototype[e]=function(){return this[r](1).value()[0]}}),gt(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");ie.prototype[e]=function(){return this.__filtered__?new ie(this):this[r](1)}}),ie.prototype.compact=function(){return this.filter(rt)},ie.prototype.find=function(e){return this.filter(e).head()},ie.prototype.findLast=function(e){return this.reverse().find(e)},ie.prototype.invokeMap=Z(function(e,t){return typeof e=="function"?new ie(this):this.map(function(r){return za(r,e,t)})}),ie.prototype.reject=function(e){return this.filter(Ws(B(e)))},ie.prototype.slice=function(e,t){e=X(e);var r=this;return r.__filtered__&&(e>0||t<0)?new ie(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==a&&(t=X(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},ie.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ie.prototype.toArray=function(){return this.take(V)},Lt(ie.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=c[i?"take"+(t=="last"?"Right":""):t],d=i||/^find/.test(t);o&&(c.prototype[t]=function(){var f=this.__wrapped__,h=i?[1]:arguments,x=f instanceof ie,A=h[0],q=x||G(f),C=function(ae){var oe=o.apply(c,lr([ae],h));return i&&P?oe[0]:oe};q&&r&&typeof A=="function"&&A.length!=1&&(x=q=!1);var P=this.__chain__,M=!!this.__actions__.length,j=d&&!P,Q=x&&!M;if(!d&&q){f=Q?f:new ie(this);var U=e.apply(f,h);return U.__actions__.push({func:Fs,args:[C],thisArg:a}),new xt(U,P)}return j&&Q?e.apply(this,h):(U=this.thru(C),j?i?U.value()[0]:U.value():U)})}),gt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ds[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);c.prototype[e]=function(){var o=arguments;if(i&&!this.__chain__){var d=this.value();return t.apply(G(d)?d:[],o)}return this[r](function(f){return t.apply(G(f)?f:[],o)})}}),Lt(ie.prototype,function(e,t){var r=c[t];if(r){var i=r.name+"";he.call(Gr,i)||(Gr[i]=[]),Gr[i].push({name:t,func:r})}}),Gr[Ns(a,de).name]=[{name:"wrapper",func:a}],ie.prototype.clone=im,ie.prototype.reverse=nm,ie.prototype.value=om,c.prototype.at=My,c.prototype.chain=Ly,c.prototype.commit=Fy,c.prototype.next=By,c.prototype.plant=Uy,c.prototype.reverse=Wy,c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=Hy,c.prototype.first=c.prototype.head,Ia&&(c.prototype[Ia]=jy),c},Hr=Lp();xr?((xr.exports=Hr)._=Hr,_i._=Hr):je._=Hr}).call(ea)}(Wa,Wa.exports);var Ku=Wa.exports;const Pt="tccScript",Qu={builtinFunctions:/strategy\.closedtrades\.max_drawdown_percent|strategy\.opentrades\.max_drawdown_percent|strategy\.risk\.max_intraday_filled_orders|strategy\.closedtrades\.max_runup_percent|array\.percentile_linear_interpolation|strategy\.closedtrades\.entry_bar_index|strategy\.opentrades\.max_runup_percent|strategy\.closedtrades\.exit_bar_index|strategy\.closedtrades\.profit_percent|strategy\.closedtrades\.entry_comment|strategy\.opentrades\.entry_bar_index|strategy\.closedtrades\.exit_comment|strategy\.closedtrades\.max_drawdown|strategy\.opentrades\.profit_percent|ta\.percentile_linear_interpolation|strategy\.closedtrades\.entry_price|strategy\.opentrades\.entry_comment|strategy\.closedtrades\.commission|strategy\.closedtrades\.entry_time|strategy\.closedtrades\.exit_price|strategy\.opentrades\.max_drawdown|strategy\.risk\.max_cons_loss_days|strategy\.closedtrades\.exit_time|strategy\.closedtrades\.max_runup|strategy\.opentrades\.entry_price|strategy\.risk\.max_intraday_loss|strategy\.risk\.max_position_size|table\.cell_set_text_font_family|strategy\.closedtrades\.entry_id|strategy\.opentrades\.commission|strategy\.opentrades\.entry_time|array\.binary_search_rightmost|array\.percentile_nearest_rank|strategy\.closedtrades\.exit_id|strategy\.opentrades\.max_runup|array\.binary_search_leftmost|strategy\.closedtrades\.profit|strategy\.opentrades\.entry_id|strategy\.risk\.allow_entry_in|strategy\.convert_to_account|box\.set_bottom_right_point|label\.set_text_font_family|strategy\.closedtrades\.size|strategy\.convert_to_symbol|strategy\.default_entry_qty|strategy\.opentrades\.profit|strategy\.risk\.max_drawdown|ta\.percentile_nearest_rank|table\.cell_set_text_halign|table\.cell_set_text_valign|request\.security_lower_tf|table\.cell_set_text_color|box\.set_text_font_family|strategy\.opentrades\.size|table\.cell_set_text_size|matrix\.is_antisymmetric|box\.set_top_left_point|chart\.point\.from_index|matrix\.is_antidiagonal|table\.cell_set_bgcolor|table\.cell_set_tooltip|table\.set_border_color|table\.set_border_width|timeframe\.from_seconds|chart\.point\.from_time|line\.set_second_point|math\.round_to_mintick|matrix\.elements_count|request\.currency_rate|ta\.pivot_point_levels|table\.cell_set_height|table\.set_frame_color|table\.set_frame_width|box\.set_border_color|box\.set_border_style|box\.set_border_width|line\.set_first_point|matrix\.is_stochastic|matrix\.is_triangular|table\.cell_set_width|timeframe\.in_seconds|array\.binary_search|box\.set_rightbottom|box\.set_text_halign|box\.set_text_valign|color\.from_gradient|label\.set_textalign|label\.set_textcolor|matrix\.eigenvectors|matrix\.is_symmetric|matrix\.swap_columns|strategy\.cancel_all|table\.cell_set_text|array\.new_linefill|array\.sort_indices|box\.set_text_color|linefill\.get_line1|linefill\.get_line2|linefill\.set_color|matrix\.eigenvalues|matrix\.is_diagonal|matrix\.is_identity|strategy\.close_all|table\.set_position|ticker\.pointfigure|array\.lastindexof|array\.percentrank|array\.standardize|box\.set_text_size|box\.set_text_wrap|label\.set_tooltip|matrix\.remove_col|matrix\.remove_row|request\.dividends|request\.financial|table\.merge_cells|table\.set_bgcolor|ticker\.heikinashi|array\.covariance|array\.new_string|chart\.point\.copy|matrix\.is_binary|matrix\.is_square|matrix\.submatrix|matrix\.swap_rows|matrix\.transpose|request\.earnings|request\.economic|request\.security|ticker\.linebreak|timeframe\.change|array\.new_color|array\.new_float|array\.new_label|array\.new_table|box\.set_bgcolor|box\.set_lefttop|chart\.point\.new|chart\.point\.now|input\.text_area|input\.timeframe|label\.set_color|label\.set_point|label\.set_style|line\.set_extend|linefill\.delete|polyline\.delete|str\.format_time|str\.replace_all|strategy\.cancel|ticker\.standard|alertcondition|array\.includes|array\.new_bool|array\.new_line|array\.variance|box\.get_bottom|box\.set_bottom|box\.set_extend|label\.get_text|label\.set_size|label\.set_text|label\.set_xloc|label\.set_yloc|line\.get_price|line\.set_color|line\.set_style|line\.set_width|math\.todegrees|math\.toradians|matrix\.add_col|matrix\.add_row|matrix\.columns|matrix\.is_zero|matrix\.reshape|matrix\.reverse|request\.quandl|request\.splits|str\.startswith|strategy\.close|strategy\.entry|strategy\.order|syminfo\.prefix|syminfo\.ticker|ta\.correlation|ta\.highestbars|ta\.percentrank|ticker\.inherit|array\.indexof|array\.new_box|array\.new_int|array\.reverse|array\.unshift|box\.get_right|box\.set_right|input\.session|line\.set_xloc|matrix\.concat|matrix\.median|max_bars_back|runtime\.error|str\.substring|strategy\.exit|ta\.crossunder|ta\.lowestbars|ta\.supertrend|ticker\.modify|array\.concat|array\.insert|array\.median|array\.remove|box\.get_left|box\.set_left|box\.set_text|input\.source|input\.string|input\.symbol|label\.delete|label\.set_xy|line\.set_xy1|line\.set_xy2|linefill\.new|map\.contains|matrix\.trace|polyline\.new|request\.seed|str\.contains|str\.endswith|str\.tonumber|str\.tostring|ta\.barssince|ta\.crossover|ta\.pivothigh|ta\.valuewhen|table\.delete|ticker\.renko|array\.clear|array\.every|array\.first|array\.range|array\.shift|array\.slice|array\.stdev|box\.get_top|box\.set_top|input\.color|input\.float|input\.price|label\.get_x|label\.get_y|label\.set_x|label\.set_y|line\.delete|line\.get_x1|line\.get_x2|line\.get_y1|line\.get_y2|line\.set_x1|line\.set_x2|line\.set_y1|line\.set_y2|log\.warning|map\.put_all|math\.random|matrix\.copy|matrix\.diff|matrix\.fill|matrix\.kron|matrix\.mode|matrix\.mult|matrix\.pinv|matrix\.rank|matrix\.rows|matrix\.sort|str\.replace|ta\.pivotlow|ta\.variance|table\.clear|ticker\.kagi|array\.copy|array\.fill|array\.from|array\.join|array\.last|array\.mode|array\.push|array\.size|array\.some|array\.sort|box\.delete|dayofmonth|input\.bool|input\.time|label\.copy|map\.remove|map\.values|math\.floor|math\.log10|math\.round|matrix\.avg|matrix\.col|matrix\.det|matrix\.get|matrix\.inv|matrix\.max|matrix\.min|matrix\.new|matrix\.pow|matrix\.row|matrix\.set|matrix\.sum|plotcandle|str\.format|str\.length|ta\.falling|ta\.highest|table\.cell|ticker\.new|time_close|weekofyear|array\.abs|array\.avg|array\.get|array\.max|array\.min|array\.new|array\.pop|array\.set|array\.sum|color\.new|color\.rgb|dayofweek|indicator|input\.int|label\.new|line\.copy|log\.error|map\.clear|math\.acos|math\.asin|math\.atan|math\.ceil|math\.sign|math\.sqrt|plotarrow|plotshape|str\.lower|str\.match|str\.split|str\.upper|ta\.change|ta\.linreg|ta\.lowest|ta\.median|ta\.rising|table\.new|timestamp|barcolor|box\.copy|line\.new|linefill|log\.info|map\.copy|map\.keys|map\.size|math\.abs|math\.avg|math\.cos|math\.exp|math\.log|math\.max|math\.min|math\.pow|math\.sin|math\.sum|math\.tan|plotchar|strategy|ta\.cross|ta\.range|ta\.stdev|ta\.stoch|bgcolor|box\.new|color\.b|color\.g|color\.r|color\.t|library|map\.get|map\.new|map\.put|plotbar|str\.pos|ta\.alma|ta\.macd|ta\.mode|ta\.swma|ta\.vwap|ta\.vwma|fixnan|minute|second|string|ta\.atr|ta\.bbw|ta\.cci|ta\.cmo|ta\.cog|ta\.cum|ta\.dev|ta\.dmi|ta\.ema|ta\.hma|ta\.kcw|ta\.max|ta\.mfi|ta\.min|ta\.mom|ta\.rma|ta\.roc|ta\.rsi|ta\.sar|ta\.sma|ta\.tsi|ta\.wma|ta\.wpr|alert|color|float|hline|input|label|month|ta\.bb|ta\.kc|ta\.tr|table|bool|fill|hour|line|plot|time|year|box|int|na|nz/,keywords:/continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to/,tokenizer:{root:[[/\/\/\s*(?=@)/,"comment","@comments"],[/\/\/.*(?!@).*/,"comment"],[/\'([^\'\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/\"/,{token:"string",bracket:"@open",next:"@stringDouble"}],[/type\s+[a-zA-Z]\w*/,"entity.name.type"],[/'/,{token:"string",bracket:"@open",next:"@stringSingle"}],[/(@builtinFunctions)(?=\s*\(|\s*<.*>)/,{token:"support.function",next:"@template"}],[/@punctuation/,{token:"punctuation.operator",next:"@property"}],[/(varip|var)\b(\s+)((?!(?:chart\.point|linefill|polyline|matrix|series|simple|string|array|color|const|float|label|table|bool|line|box|int|map|continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to)\b)[\w.\d_$]+)(\[\]|)(\s+)((?!(?:continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to)\b)[\w\d_$]+)/,[{token:"keyword"},{token:"source"},{token:"entity.name.type"},{token:"paren"},{token:"source"},{token:"variable.other"}]],[/\b(?:@builtinTypes)(?=(\s*)[\[|<|(]|(?=\s+(?=[^.=][\w\(]*))|\s*$)/,{token:"support.type",next:"@template"}],[/^(\s*)\b(?!(?:chart\.point|linefill|polyline|matrix|series|simple|string|array|color|const|float|label|table|bool|line|box|int|map|continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to)\b)([\w.\d_$]+)(\[\]|)(\s+)((?!(?:continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to)\b)[\w\d_$]+)(\s+)(\=)/,[{token:"source"},{token:"entity.name.type"},{token:"paren"},{token:"source"},{token:"variable.other"},{token:"source"},{token:"keyword.equals"}]],[/(\((?:\s+))?((?!(?:chart\.point|linefill|polyline|continue|for\.\.\.in|matrix|series|simple|string|export|import|method|switch|array|color|const|float|label|table|break|varip|while|bool|line|else|type|box|int|map|and|for|not|var|as|by|if|in|or|to)\b)\b[\w.\d_$]+(?=[\[\]]*(?:\s+)(?:[\w\d_$]+\s*(?:\,|\))+\s*).+(?:\=\>|\→)))/,"entity.name.type"],[/import(?=\s+@importName)/,{token:"keyword",next:"@import"}],[/import(?=\s+[a-zA-Z\d\$_\-\.\u00a1-\uffff\/]+)/,"keyword"],[/[+-]?\d+\.\d*([eE][\-+]?\d+)?(?!\w+)/,"constant.numeric.float"],[/[+-]?\.\d+([eE][\-+]?\d+)?(?!\w+)/,"constant.numeric.float"],[/([+-]?(\d+))(?!\w+)(?!\w+)/,"constant.numeric.integer"],[/(?:true|false)\b/,"constant.other.boolean"],[/#[0-9a-fA-F]{6,8}\b/,"constant.other.color"],[/\+=|\-=|\*=|\/=|%=|[\/%*+\-]|==|!=|<=|>=|=>|<|>|\?|\:=|\:|\,/,"keyword.operator"],[/\b(?:continue|for\.\.\.in|export|import|method|switch|break|varip|while|else|type|and|for|not|var|as|by|if|in|or|to)\b/,"keyword"],[/^[a-zA-Z_][a-zA-Z_0-9]+(?=\s*\()/,"entity.name.function"],[/[0-9]+\b/,"constant.numeric.integer"],[/=/,"keyword.equals"],[/\b(?:strategy\.commission\.cash_per_contract|syminfo\.recommendations_sell_strong|syminfo\.recommendations_buy_strong|strategy\.commission\.cash_per_order|strategy\.margin_liquidation_price|strategy\.max_contracts_held_short|strategy\.max_contracts_held_long|syminfo\.shares_outstanding_float|syminfo\.shares_outstanding_total|barstate\.islastconfirmedhistory|earnings\.future_period_end_time|strategy\.max_contracts_held_all|syminfo\.target_price_estimates|strategy\.max_drawdown_percent|syminfo\.recommendations_total|alert\.freq_once_per_bar_close|label\.style_label_lower_right|label\.style_label_upper_right|chart\.right_visible_bar_time|strategy\.grossprofit_percent|strategy\.position_entry_name|syminfo\.recommendations_date|syminfo\.recommendations_hold|syminfo\.recommendations_sell|syminfo\.target_price_average|label\.style_label_lower_left|label\.style_label_upper_left|chart\.left_visible_bar_time|strategy\.openprofit_percent|strategy\.position_avg_price|syminfo\.recommendations_buy|syminfo\.target_price_median|plot\.style_stepline_diamond|strategy\.commission\.percent|session\.isfirstbar_regular|strategy\.grossloss_percent|strategy\.max_runup_percent|strategy\.netprofit_percent|strategy\.percent_of_equity|session\.islastbar_regular|strategy\.account_currency|syminfo\.target_price_date|syminfo\.target_price_high|dividends\.future_pay_date|strategy\.initial_capital|syminfo\.target_price_low|dividends\.future_ex_date|label\.style_label_center|label\.style_text_outline|label\.style_triangledown|strategy\.direction\.short|earnings\.future_revenue|alert\.freq_once_per_bar|dividends\.future_amount|label\.style_label_right|strategy\.direction\.long|strategy\.position_size|barmerge\.lookahead_off|label\.style_label_down|label\.style_label_left|label\.style_triangleup|line\.style_arrow_right|position\.bottom_center|position\.middle_center|strategy\.direction\.all|strategy\.closedtrades|strategy\.max_drawdown|barmerge\.lookahead_on|earnings\.standardized|font\.family_monospace|label\.style_arrowdown|line\.style_arrow_both|line\.style_arrow_left|plot\.style_steplinebr|position\.bottom_right|position\.middle_right|barstate\.isconfirmed|earnings\.future_time|session\.ispostmarket|strategy\.grossprofit|syminfo\.basecurrency|syminfo\.shareholders|timeframe\.isintraday|timeframe\.multiplier|adjustment\.dividends|label\.style_label_up|plot\.style_histogram|position\.bottom_left|position\.middle_left|barstate\.isrealtime|chart\.is_heikinashi|earnings\.future_eps|session\.ispremarket|strategy\.eventrades|strategy\.losstrades|strategy\.openprofit|strategy\.opentrades|syminfo\.description|timeframe\.isminutes|timeframe\.ismonthly|timeframe\.isseconds|dayofweek\.wednesday|display\.data_window|display\.price_scale|display\.status_line|font\.family_default|label\.style_arrowup|label\.style_diamond|plot\.style_stepline|position\.top_center|strategy\.oca\.cancel|strategy\.oca\.reduce|barstate\.ishistory|chart\.is_linebreak|session\.isfirstbar|strategy\.grossloss|strategy\.max_runup|strategy\.netprofit|strategy\.wintrades|syminfo\.pointvalue|syminfo\.pricescale|syminfo\.volumetype|timeframe\.isweekly|dayofweek\.saturday|dayofweek\.thursday|hline\.style_dashed|hline\.style_dotted|label\.style_circle|label\.style_square|label\.style_xcross|plot\.style_circles|plot\.style_columns|position\.top_right|shape\.triangledown|splits\.denominator|chart\.is_standard|session\.islastbar|syminfo\.employees|timeframe\.isdaily|adjustment\.splits|barmerge\.gaps_off|dayofweek\.tuesday|earnings\.estimate|hline\.style_solid|label\.style_cross|line\.style_dashed|line\.style_dotted|location\.abovebar|location\.absolute|location\.belowbar|plot\.style_areabr|plot\.style_linebr|position\.top_left|strategy\.oca\.none|text\.align_bottom|text\.align_center|barstate\.isfirst|session\.ismarket|syminfo\.currency|syminfo\.industry|syminfo\.tickerid|syminfo\.timezone|timeframe\.period|barmerge\.gaps_on|dayofweek\.friday|dayofweek\.monday|dayofweek\.sunday|label\.style_flag|label\.style_none|line\.style_solid|order\.descending|plot\.style_cross|session\.extended|shape\.triangleup|splits\.numerator|text\.align_right|barstate\.islast|strategy\.equity|syminfo\.country|syminfo\.minmove|syminfo\.mintick|syminfo\.session|time_tradingday|timeframe\.isdwm|adjustment\.none|dividends\.gross|earnings\.actual|location\.bottom|order\.ascending|plot\.style_area|plot\.style_line|session\.regular|shape\.arrowdown|shape\.labeldown|text\.align_left|barstate\.isnew|chart\.bg_color|chart\.fg_color|chart\.is_range|chart\.is_renko|last_bar_index|strategy\.short|syminfo\.prefix|syminfo\.sector|syminfo\.ticker|alert\.freq_all|format\.inherit|format\.mintick|format\.percent|strategy\.fixed|text\.align_top|text\.wrap_auto|text\.wrap_none|xloc\.bar_index|chart\.is_kagi|last_bar_time|strategy\.long|color\.fuchsia|currency\.NONE|currency\.USDT|dividends\.net|format\.volume|shape\.arrowup|shape\.diamond|shape\.labelup|strategy\.cash|xloc\.bar_time|yloc\.abovebar|yloc\.belowbar|chart\.is_pnf|linefill\.all|polyline\.all|syminfo\.root|syminfo\.type|color\.maroon|color\.orange|color\.purple|color\.silver|color\.yellow|currency\.AUD|currency\.BTC|currency\.CAD|currency\.CHF|currency\.ETH|currency\.EUR|currency\.GBP|currency\.HKD|currency\.INR|currency\.JPY|currency\.KRW|currency\.MYR|currency\.NOK|currency\.NZD|currency\.RUB|currency\.SEK|currency\.SGD|currency\.TRY|currency\.USD|currency\.ZAR|display\.none|display\.pane|extend\.right|format\.price|location\.top|shape\.circle|shape\.square|shape\.xcross|color\.black|color\.green|color\.olive|color\.white|display\.all|extend\.both|extend\.left|extend\.none|scale\.right|shape\.cross|size\.normal|dayofmonth|ta\.accdist|time_close|weekofyear|color\.aqua|color\.blue|color\.gray|color\.lime|color\.navy|color\.teal|scale\.left|scale\.none|shape\.flag|size\.large|size\.small|yloc\.price|bar_index|dayofweek|label\.all|table\.all|color\.red|math\.rphi|size\.auto|size\.huge|size\.tiny|line\.all|math\.phi|box\.all|ta\.vwap|ta\.wvad|timenow|math\.pi|minute|second|ta\.iii|ta\.nvi|ta\.obv|ta\.pvi|ta\.pvt|ta\.wad|volume|math\.e|close|hlcc4|month|ohlc4|ta\.tr|false|high|hlc3|hour|open|time|year|true|hl2|low|na)\b(?!\s*=\s*\w+)/,"support.variable"],[/[(|)|\[|\]]/,"paren"],[/[a-zA-Z_][a-zA-Z_0-9]*(?=\s*\()/,{token:"entity.name.method"}],[/\w+\b/,"variable.other"]],comments:[[/@[A-Za-z]+(\s*=\s*)?$/,{token:"comment.annotation",next:"@pop"}],[/@[A-Za-z]+(\s*=\s*)?/,{token:"comment.annotation"}],[/(?!\s*@[A-Za-z]+).+$/,{token:"comment",next:"@pop"}]],stringDouble:[[/[^\\\"]+/,"string"],[/\\./,"string.invalid"],[/\"/,{token:"string.quote",bracket:"@close",next:"@pop"}]],stringSingle:[[/[^\\']+/,"string"],[/\\./,"string.invalid"],[/'/,{token:"string",bracket:"@close",next:"@pop"}]],template:[[/(@builtinTypes)/,{token:"support.type"}],[/(\((?:\s+))?((?!(?:chart\.point|linefill|polyline|continue|for\.\.\.in|matrix|series|simple|string|export|import|method|switch|array|color|const|float|label|table|break|varip|while|bool|line|else|type|box|int|map|and|for|not|var|as|by|if|in|or|to)\b)\b[\w.\d_$]+(?=[\[\]]*(?:\s+)(?:[\w\d_$]+\s*(?:\,|\))+\s*).+(?:\=\>|\→)))/,"entity.name.type"],[/\(|\)|\[|\]|\=|\>/,{token:"paren",next:"@pop"}],[/(\,)(\s+)/,["keyword.operator","source"]],[/(\,)/,{token:"keyword.operator"}],[/([\w.\d$]+)/,{token:"entity.name.type"}],[/(<|>)/,{token:"paren"}],[/\s(?=\w)|$/,{token:"source",next:"@pop"}]],property:[[/@punctuation/,{token:"punctuation.operator"}],[/(@builtinTypes)(?=\s*[(])/,{token:"support.method",next:"@pop"}],[/[a-zA-Z_][a-zA-Z_0-9]+(?=\s*\()/,{token:"entity.name.method",next:"@pop"}],[/[a-zA-Z0-9_]+/,{token:"variable.other.property",next:"@pop"}],[/@empty/,{token:"source",next:"@pop"}]],import:[[/\s+/,{token:"source"}],[/(@importName)(\s+)(as\b)(\s+)(@importAlias)/,[{token:"entity.name.module"},{token:"source"},{token:"keyword"},{token:"source"},{token:"entity.name.module.name",next:"@pop"}]],[/@importName/,{token:"entity.name.module",next:"@pop"}]]},builtinTypes:/chart\.point|linefill|polyline|matrix|series|simple|string|array|color|const|float|label|table|bool|line|box|int|map/,punctuation:/[.](?![.])/,importName:/[a-zA-Z\d\$_\-\.\u00a1-\uffff\/]+/,importAlias:/[a-zA-Z\d\_\u00a1\uffff\/]+/,empty:/^$/};var Dt;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(Dt||(Dt={}));const Zu={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["(",")"],["[","]"]],folding:{markers:{start:/(\/\/#region)|(\/\/.*{($|\s))/,end:/(\/\/#endregion)|(\/\/.*}($|\s))/}},autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],onEnterRules:[{beforeText:/\)\s*=>\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/if\s+.*\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/else/,action:{indentAction:Dt.Indent}},{beforeText:/for\s+\S+\s*=\s*\S+\s+to\s+\S+(?:\s+by\s+\S+)?\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/for\s+(?:\[\S+\s+\S+]|\S+)\s+in\s+\S+\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/switch\s+.*\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/while\s+.*\s*$/,action:{indentAction:Dt.Indent}},{beforeText:/type\s+\w+/,action:{indentAction:Dt.Indent}},{beforeText:/^\s*$/,action:{indentAction:Dt.Outdent}}]},I={"color-white":"#ffffff","color-black":"#000000","color-transparent":"#00000000","color-cold-gray-50":"#F8F9FD","color-cold-gray-100":"#F0F3FA","color-cold-gray-150":"#E0E3EB","color-cold-gray-200":"#D1D4DC","color-cold-gray-250":"#C1C4CD","color-cold-gray-300":"#B2B5BE","color-cold-gray-350":"#A3A6AF","color-cold-gray-400":"#9598A1","color-cold-gray-450":"#868993","color-cold-gray-500":"#787B86","color-cold-gray-550":"#6A6D78","color-cold-gray-600":"#5D606B","color-cold-gray-650":"#50535E","color-cold-gray-700":"#434651","color-cold-gray-750":"#363A45","color-cold-gray-800":"#2A2E39","color-cold-gray-850":"#1E222D","color-cold-gray-900":"#131722","color-cold-gray-950":"#0C0E15","color-ripe-red-50":"#FFEBEC","color-ripe-red-100":"#FCCBCD","color-ripe-red-200":"#FAA1A4","color-ripe-red-300":"#F77C80","color-ripe-red-400":"#F7525F","color-ripe-red-500":"#F23645","color-ripe-red-600":"#CC2F3C","color-ripe-red-700":"#B22833","color-ripe-red-800":"#991F29","color-ripe-red-900":"#801922","color-ripe-red-a100":"#FF8080","color-ripe-red-a200":"#FF5252","color-ripe-red-a400":"#FF3333","color-ripe-red-a600":"#CC2929","color-ripe-red-a700":"#802028","color-ripe-red-a800":"#4D191D","color-ripe-red-a900":"#331F20","color-tan-orange-50":"#FFF3E0","color-tan-orange-100":"#FFE0B2","color-tan-orange-200":"#FFCC80","color-tan-orange-300":"#ffb74d","color-tan-orange-400":"#FFA726","color-tan-orange-500":"#FF9800","color-tan-orange-600":"#FB8C00","color-tan-orange-700":"#F57C00","color-tan-orange-800":"#EF6C00","color-tan-orange-900":"#e65100","color-tan-orange-a200":"#ffab40","color-tan-orange-a400":"#FF9100","color-tan-orange-a600":"#CC7014","color-tan-orange-a700":"#8C541C","color-tan-orange-a800":"#593A1B","color-tan-orange-a900":"#33261A","color-iguana-green-100":"#C8E6C9","color-iguana-green-200":"#A5D6A7","color-iguana-green-300":"#81c784","color-iguana-green-400":"#66BB6A","color-iguana-green-500":"#4caf50","color-iguana-green-600":"#43a047","color-iguana-green-700":"#388e3c","color-iguana-green-800":"#2E7D32","color-iguana-green-900":"#1B5E20","color-iguana-green-a700":"#00c853","color-banana-yellow-100":"#FFF9C4","color-banana-yellow-200":"#FFF59D","color-banana-yellow-300":"#FFF176","color-banana-yellow-400":"#ffee58","color-banana-yellow-500":"#ffeb3b","color-banana-yellow-600":"#fdd835","color-banana-yellow-700":"#fbc02d","color-banana-yellow-800":"#f9a825","color-banana-yellow-900":"#F57F17","color-banana-yellow-a400":"#ffea00","color-banana-yellow-a700":"#EEDA01","color-tv-blue-50":"#E3EFFD","color-tv-blue-100":"#BBD9FB","color-tv-blue-200":"#90BFF9","color-tv-blue-300":"#5B9CF6","color-tv-blue-400":"#3179F5","color-tv-blue-500":"#2962FF","color-tv-blue-600":"#1E53E5","color-tv-blue-700":"#1848CC","color-tv-blue-800":"#143EB3","color-tv-blue-900":"#0C3299","color-tv-blue-a100":"#82b1ff","color-tv-blue-a200":"#448aff","color-tv-blue-a400":"#2979ff","color-tv-blue-a600":"#2962FF","color-tv-blue-a700":"#143A87","color-tv-blue-a800":"#142E61","color-tv-blue-a900":"#132042","color-deep-blue-50":"#EDE7F6","color-deep-blue-100":"#D1C4E9","color-deep-blue-200":"#B39DDB","color-deep-blue-300":"#9575cd","color-deep-blue-400":"#7e57c2","color-deep-blue-500":"#673ab7","color-deep-blue-700":"#512da8","color-deep-blue-800":"#4527A0","color-deep-blue-900":"#311B92","color-deep-blue-a100":"#b388ff","color-deep-blue-a200":"#7C4DFF","color-deep-blue-a400":"#651FFF","color-deep-blue-a700":"#6200EA","color-minty-green-50":"#DAF2EE","color-minty-green-100":"#ACE5DC","color-minty-green-200":"#70CCBD","color-minty-green-300":"#42BDA8","color-minty-green-400":"#22AB94","color-minty-green-500":"#089981","color-minty-green-600":"#06806B","color-minty-green-700":"#056656","color-minty-green-800":"#004D40","color-minty-green-900":"#00332A","color-minty-green-a400":"#2BD9BC","color-minty-green-a600":"#24B29B","color-minty-green-a700":"#1B7667","color-minty-green-a800":"#10443B","color-minty-green-a900":"#082621","color-grapes-purple-50":"#F3E5F5","color-grapes-purple-100":"#E1BEE7","color-grapes-purple-200":"#CE93D8","color-grapes-purple-300":"#ba68c8","color-grapes-purple-400":"#ab47bc","color-grapes-purple-500":"#9c27b0","color-grapes-purple-600":"#8e24aa","color-grapes-purple-700":"#7b1fa2","color-grapes-purple-800":"#6A1B9A","color-grapes-purple-900":"#4A148C","color-grapes-purple-a100":"#EA80FC","color-grapes-purple-a200":"#E040FB","color-grapes-purple-a400":"#D500F9","color-grapes-purple-a700":"#aa00ff","color-berry-pink-100":"#F8BBD0","color-berry-pink-200":"#f48fb1","color-berry-pink-300":"#f06292","color-berry-pink-400":"#ec407a","color-berry-pink-500":"#e91e63","color-berry-pink-600":"#D81B60","color-berry-pink-700":"#C2185B","color-berry-pink-800":"#AD1457","color-berry-pink-900":"#880E4F","color-berry-pink-a100":"#ff80ab","color-berry-pink-a200":"#ff4081","color-berry-pink-a400":"#f50057","color-sky-blue-100":"#B2EBF2","color-sky-blue-200":"#80DEEA","color-sky-blue-300":"#4dd0e1","color-sky-blue-400":"#26c6da","color-sky-blue-500":"#00bcd4","color-sky-blue-600":"#00acc1","color-sky-blue-700":"#0097A7","color-sky-blue-800":"#00838F","color-sky-blue-900":"#006064","color-sky-blue-a400":"#00e5ff","color-sky-blue-a700":"#00B8D4","color-deep-blue-600":"#5E35B1","color-forest-green-50":"#DAF2E6","color-forest-green-100":"#ACE5C9","color-forest-green-200":"#70CC9E","color-forest-green-300":"#42BD7F","color-forest-green-400":"#22AB67","color-forest-green-500":"#089950","color-forest-green-600":"#068043","color-forest-green-700":"#056636","color-forest-green-800":"#004D27","color-forest-green-900":"#1A3326","color-facebook":"#1877F2","color-deep-facebook":"#1564CA","color-twitter":"#1DA1F2","color-deep-twitter":"#188CD3","color-youtube":"#FF0000","color-linkedin":"#007BB5","color-seeking-alpha-brand":"#ff7200"};function Rt(n,s=1){return n+Math.round(255*Math.min(Math.max(s,0),1)).toString(16).toUpperCase().padStart(2,"0")}const Ju={base:"vs",inherit:!0,rules:[{token:"comment",foreground:I["color-cold-gray-400"]},{token:"comment.annotation",fontStyle:"bold"},{token:"text",foreground:I["color-cold-gray-900"]},{token:"string",foreground:I["color-iguana-green-700"]},{token:"constant.numeric",foreground:I["color-banana-yellow-900"]},{token:"constant.language",foreground:I["color-ripe-red-a600"]},{token:"constant.other.color",foreground:I["color-ripe-red-a600"]},{token:"constant.other",foreground:I["color-ripe-red-a600"]},{token:"support.variable",foreground:I["color-ripe-red-a600"]},{token:"support.function",foreground:I["color-tv-blue-a600"]},{token:"support.type",foreground:I["color-minty-green-400"],fontStyle:"bold"},{token:"entity.name.type",foreground:I["color-minty-green-400"],fontStyle:"bold"},{token:"support.method",foreground:I["color-tv-blue-a600"]},{token:"keyword.equals",foreground:I["color-minty-green-400"]},{token:"keyword.operator",foreground:I["color-minty-green-400"]},{token:"keyword.other",foreground:I["color-minty-green-400"]},{token:"keyword",foreground:I["color-minty-green-400"]},{token:"variable.other",foreground:I["color-cold-gray-800"]},{token:"variable.other.property",foreground:I["color-cold-gray-800"]},{token:"paren",foreground:I["color-black"]},{token:"entity.name.function",foreground:I["color-tv-blue-900"]},{token:"entity.name.method",foreground:I["color-tv-blue-900"]},{token:"meta.function-call",foreground:I["color-grapes-purple-600"]},{token:"entity.name.module.name",foreground:I["color-grapes-purple-600"]},{token:"entity.name.module",foreground:I["color-tv-blue-a600"]},{token:"",background:I["color-white"]}],colors:{"editor.foreground":I["color-cold-gray-900"],"editor.background":"#00000000","editorLineNumber.foreground":I["color-cold-gray-400"],"editorLineNumber.activeForeground":I["color-cold-gray-700"],"editorHoverWidget.background":I["color-white"],"editorHoverWidget.statusBarBackground":I["color-cold-gray-150"],"editorHoverWidget.foreground":I["color-cold-gray-900"],"editorWidget.background":I["color-white"],"editorWidget.foreground":I["color-cold-gray-900"],"editorGutter.background":"#00000000","editor.foldBackground":Rt(I["color-cold-gray-200"],.5),"editor.lineHighlightBackground":I["color-tv-blue-50"],"editor.lineHighlightBorder":I["color-tv-blue-50"],"editor.rangeHighlightBackground":I["color-tv-blue-a800"],"editorBracketMatch.background":I["color-cold-gray-150"],"editor.selectionBackground":I["color-tv-blue-100"],"editor.selectionHighlightBackground":I["color-tv-blue-50"],"editor.findMatchBackground":I["color-tan-orange-100"],"editor.findMatchHighlightBackground":I["color-tan-orange-100"],"editor.findMatchBorder":I["color-tan-orange-500"],"list.foreground":I["color-cold-gray-900"],"list.hoverForeground":I["color-cold-gray-900"],"list.activeSelectionBackground":I["color-tv-blue-500"],"list.hoverBackground":I["color-tv-blue-50"],"list.focusHighlightForeground":I["color-tv-blue-100"],"list.inactiveSelectionBackground":I["color-tv-blue-500"],"keybindingLabel.background":I["color-white"],"keybindingLabel.foreground":I["color-cold-gray-900"],"keybindingLabel.border":I["color-cold-gray-150"],"input.foreground":I["color-cold-gray-900"],"textLink.foreground":I["color-tv-blue-500"],"textLink.activeForeground":I["color-tv-blue-600"],"peekViewEditor.matchHighlightBackground":I["color-tan-orange-100"],"peekViewResult.lineForeground":I["color-cold-gray-900"],"editorMarkerNavigationWarning.background":I["color-banana-yellow-800"],"inputValidation.warningBackground":I["color-banana-yellow-800"],"diffEditor.insertedTextBackground":Rt(I["color-forest-green-500"],.3),"diffEditor.insertedLineBackground":Rt(I["color-forest-green-500"],.15),"diffEditor.removedTextBackground":Rt(I["color-ripe-red-500"],.3),"diffEditor.removedLineBackground":Rt(I["color-ripe-red-500"],.15),"editorInlayHint.background":I["color-cold-gray-150"],"editorInlayHint.foreground":I["color-cold-gray-550"],"editorError.foreground":I["color-ripe-red-500"],"editorWarning.foreground":I["color-tan-orange-500"]}},ed={base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:I["color-cold-gray-500"]},{token:"comment.annotation",fontStyle:"bold"},{token:"text",foreground:I["color-white"]},{token:"string",foreground:I["color-iguana-green-700"]},{token:"constant.numeric",foreground:I["color-banana-yellow-900"]},{token:"constant.language",foreground:I["color-ripe-red-300"]},{token:"constant.other.color",foreground:I["color-ripe-red-300"]},{token:"constant.other",foreground:I["color-ripe-red-300"]},{token:"support.variable",foreground:I["color-ripe-red-300"]},{token:"support.function",foreground:I["color-tv-blue-300"]},{token:"support.method",foreground:I["color-tv-blue-300"]},{token:"support.type",foreground:I["color-minty-green-300"],fontStyle:"bold"},{token:"entity.name.type",foreground:I["color-minty-green-300"],fontStyle:"bold"},{token:"keyword.equals",foreground:I["color-minty-green-300"]},{token:"keyword.operator",foreground:I["color-minty-green-300"]},{token:"keyword.other",foreground:I["color-minty-green-300"]},{token:"keyword",foreground:I["color-minty-green-300"]},{token:"variable.other",foreground:I["color-cold-gray-200"]},{token:"variable.other.property",foreground:I["color-cold-gray-200"]},{token:"paren",foreground:I["color-white"]},{token:"entity.name.function",foreground:I["color-tv-blue-400"]},{token:"entity.name.method",foreground:I["color-tv-blue-400"]},{token:"meta.function-call",foreground:I["color-grapes-purple-300"]},{token:"entity.name.module.name",foreground:I["color-grapes-purple-300"]},{token:"entity.name.module",foreground:I["color-tv-blue-300"]},{token:"",background:I["color-cold-gray-900"]}],colors:{"editor.foreground":I["color-white"],"editor.background":I["color-cold-gray-900"],"editorLineNumber.foreground":I["color-cold-gray-500"],"editorLineNumber.activeForeground":I["color-cold-gray-300"],"editorWidget.background":I["color-cold-gray-850"],"editorHoverWidget.background":I["color-cold-gray-850"],"editorHoverWidget.foreground":I["color-cold-gray-300"],"editorHoverWidget.statusBarBackground":I["color-cold-gray-900"],"editorWidget.foreground":I["color-cold-gray-300"],"editorGutter.background":I["color-cold-gray-900"],"editor.foldBackground":Rt(I["color-cold-gray-700"],.5),"editor.lineHighlightBackground":I["color-tv-blue-a900"],"editor.lineHighlightBorder":I["color-tv-blue-a900"],"editor.rangeHighlightBackground":I["color-tv-blue-a800"],"editorBracketMatch.background":I["color-cold-gray-750"],"editor.selectionBackground":I["color-tv-blue-a800"],"editor.selectionHighlightBackground":I["color-cold-gray-800"],"list.foreground":I["color-cold-gray-350"],"list.hoverForeground":I["color-cold-gray-350"],"list.activeSelectionBackground":I["color-tv-blue-500"],"list.hoverBackground":I["color-tv-blue-900"],"list.focusHighlightForeground":I["color-tv-blue-300"],"list.inactiveSelectionBackground":I["color-tv-blue-500"],"keybindingLabel.background":I["color-cold-gray-800"],"keybindingLabel.foreground":I["color-cold-gray-300"],"keybindingLabel.border":I["color-cold-gray-700"],"input.foreground":I["color-cold-gray-350"],"textLink.foreground":I["color-tv-blue-500"],"textLink.activeForeground":I["color-tv-blue-600"],"peekViewEditor.matchHighlightBackground":I["color-tan-orange-a800"],"peekViewResult.lineForeground":I["color-cold-gray-350"],"diffEditor.insertedTextBackground":Rt(I["color-iguana-green-a700"],.3),"diffEditor.insertedLineBackground":Rt(I["color-iguana-green-a700"],.15),"diffEditor.removedTextBackground":Rt(I["color-ripe-red-a400"],.3),"diffEditor.removedLineBackground":Rt(I["color-ripe-red-a400"],.15),"editorInlayHint.background":I["color-cold-gray-800"],"editorInlayHint.foreground":I["color-cold-gray-400"],"editorError.foreground":I["color-ripe-red-500"],"editorWarning.foreground":I["color-tan-orange-700"]}},td=/(\\(?:[\\'"]))|(\\$)|("|$)|($)/g,rd=/(\\(?:[\\'"]))|(\\$)|('|$)|($)/g,Un={"color.aqua":"#00BCD4","color.black":"#363A45","color.blue":"#2196F3","color.fuchsia":"#E040FB","color.gray":"#787B86","color.green":"#4CAF50","color.lime":"#00E676","color.maroon":"#880E4F","color.navy":"#311B92","color.olive":"#808000","color.orange":"#FF9800","color.purple":"#9C27B0","color.red":"#FF5252","color.silver":"#B2B5BE","color.teal":"#00897B","color.white":"#FFFFFF","color.yellow":"#FFEB3B"};class ad{constructor(s){Object.defineProperty(this,"_formatter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isMac",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getSignatureParams",{enumerable:!0,configurable:!0,writable:!0,value:(a=[],l)=>{const u=new Map,p=l.indexOf("(");for(let m=p+1,v=p;m<l.length;m++)l[m]!==","&&l[m]!==")"||(v++,u.set(l.slice(v,m),v),v=m+1);return a.map(({name:m,displayType:v,desc:g})=>{const b=[],w=u.get(m),k=w+m.length;return b.push(this._formatter.paragraph(this._formatter.bold(m),this._formatter.italic(v||""))),g&&b.push(Array.isArray(g)?g.join(this._formatter.lineBreak):g),{label:[w,k],documentation:{value:b.join(this._formatter.lineBreak)}}})}}),this._formatter=fe,this._isMac=/(Mac|iPhone|iPod|iPad)/i.test(s)}getSignatureHelpValues(s,a){const l=this._getFuncItems(s);if(!(l!=null&&l.length))return null;const u=this._getSequentialSignatures(s,l),p=this._getActiveIndex(l,a);return{signatures:u,...p}}_getActiveIndex(s,a=[]){let l=0,u=-1;a.some(m=>!!m)||(u=a.length-1);const p=a.pop();if(p)for(const[m,v]of s.entries()){const{args:g}=v;if(g&&g.length){const b=g.findIndex(w=>w.name===p);if(b!=-1){u=b,l=m;break}}}return{activeParameter:u,activeSignature:l}}_getFuncItems(s){return rr.functions.get(s)||Sr.userFuncs.get(s)||Sr.methodFuncs.get(s)}_getSequentialSignatures(s,a){return a.map(l=>{const u=this._getSignatureLabel(s,l);return{label:u,documentation:this._getFormattedSignatureDocumentation(l),parameters:this._getSignatureParams(l.args,u)}})}_getSignatureLabel(s,a,l=!1){const u=[s];return l&&u.push("<type>"),a.args&&(u.push("("),u.push(a.args.map(({name:p})=>p).join(", ")),u.push(")")),u.join("")}_getFormattedSignatureDocumentation(s){const{desc:a}=s,l=[];a&&l.push(Array.isArray(a)?a.join(this._formatter.lineBreak):a);const u=`${this._formatter.code(this._isMac?"⌘":"Ctrl")} +
132
+ ${this._formatter.code("Shift")} +
133
+ ${this._formatter.code("Space")}`;return l.push(this._formatter.lineBreak),l.push(this._formatter.italic(`${u} ${Ie.toTriggerParameterHints}`)),{value:this._formatter.paragraph(...l)}}}const sd=new ad(window.navigator.userAgent);class id{constructor(){Object.defineProperty(this,"_colors",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._colors=Un}getDocumentColors(s){const a=[];return s.forEach(l=>{const{range:u}=l;let{matches:p}=l;p=p||[];const m=p[0]||"";let v=null;this._isHexToken(m)?v=this._hexToColor(m):this._isRgbColor(m)?v=this._rgbToColor(m):this._colors[m]?v=this._hexToColor(this._colors[m]):this._isColorExpression(m)&&p[1]&&p[6]&&(v=this._extractNewExpression(p[1],Number(p[6]))),v&&a.push({color:v,range:u})}),a}get _defultColorsRegStr(){return Object.keys(Un).reduce((s,a)=>`${s}|${a}`,"")}get colorMatchesRegStr(){const s=`#[0-9a-fA-F]{6,8}|(\\b(color.rgb\\s*\\((\\s*\\d+\\s*,\\s*){2}(\\s*\\d+\\s*,{0,1}){1,2}\\s*\\)${this._defultColorsRegStr}))`;return`color.new\\s*\\(\\s*(${s})\\s*,\\s*(\\d+)\\s*\\)|${s}`}getDocumentColorPresentations(s,{color:a,range:l}){const u=s.getValueInRange(l);if(this._isHexToken(u)||this._colors[u])return[{label:this._colorRgbRepresentation(a)},{label:this._colorHexRepresentation(a)}];if(this._isColorExpression(u)||this._isRgbColor(u)){const p=this._isColorExpression(u)?this._colorNewRepresentation(a):this._colorRgbRepresentation(a);if(!p)return[];const m=this._colorHexRepresentation(a);return[{label:p,textEdit:{text:p,range:l}},{label:m,textEdit:{text:m,range:l}}]}return null}_hexFromNumber(s){const a=this._denormalize(s).toString(16);return a.length===1?`0${a}`:a}_normalize(s){return s/255}_denormalize(s){return Math.round(255*s)}_normalizeAlpha(s){return(100-s)/100}_denormalizeAlpha(s){return 100-Math.round(100*s)}_extractNewExpression(s,a){let l=null;return this._isHexToken(s)?l=this._hexToColor(s):this._isRgbColor(s)?l=this._rgbToColor(s):this._colors[s]&&(l=this._hexToColor(this._colors[s])),l&&!Number.isNaN(a)?{...l,alpha:this._normalizeAlpha(a)}:null}_colorHexRepresentation(s){const a=this._hexFromNumber(s.red),l=this._hexFromNumber(s.green),u=this._hexFromNumber(s.blue),p=this._hexFromNumber(s.alpha);return`#${a}${l}${u}${s.alpha===1?"":p}`}_colorRgbRepresentation(s){const a=this._denormalize(s.red),l=this._denormalize(s.green),u=this._denormalize(s.blue),p=this._denormalizeAlpha(s.alpha),m=[a,l,u];return p>0&&m.push(p),`color.rgb(${m.join(", ")})`}_colorNewRepresentation(s){const a={...s,alpha:1};return`color.new(${this._colorHexRepresentation(a)}, ${this._denormalizeAlpha(s.alpha)})`}_hexToColor(s){const a=(s=this._isHexToken(s)?s.slice(1):s).length===3||s.length===4,l=a?`${s.slice(0,1)}${s.slice(0,1)}`:s.slice(0,2),u=a?`${s.slice(1,2)}${s.slice(1,2)}`:s.slice(2,4),p=a?`${s.slice(2,3)}${s.slice(2,3)}`:s.slice(4,6),m=(a?`${s.slice(3,4)}${s.slice(3,4)}`:s.slice(6,8))||"ff";return{red:this._normalize(parseInt(l,16)),green:this._normalize(parseInt(u,16)),blue:this._normalize(parseInt(p,16)),alpha:this._normalize(parseInt(m,16))}}_rgbToColor(s){const a=s.replace(/[^\d,]/g,"").split(","),l=this._normalize(Number(a[0])),u=this._normalize(Number(a[1])),p=this._normalize(Number(a[2])),m=this._normalizeAlpha(Number(a[3]))||1;return isNaN(l)||isNaN(u)||isNaN(p)?null:{red:l,green:u,blue:p,alpha:m}}_isHexToken(s){return s.charAt(0)==="#"}_isRgbColor(s){return s.startsWith("color.rgb")}_isColorExpression(s){return s.startsWith("color.new")}}const Qs=new id;function nd(n,s){var k;const a={startLineNumber:s.lineNumber,startColumn:1,endLineNumber:s.lineNumber,endColumn:s.column},l=n.getValueInRange(a),u=l.match(/([\w.]+)$/)||[],p=(k=u[0])==null?void 0:k.match(/.*[^\w.]+([\w.]+)(?=\.)|([\w.]+)(?=\.)/),m=p?p[1]?p[1]:p[2]?p[2]:void 0:void 0,v=n.getWordUntilPosition(s),g=oa.parseCurrentInputFunc(l),b={startLineNumber:s.lineNumber,endLineNumber:s.lineNumber,startColumn:v.startColumn,endColumn:v.endColumn};let w=Wn(Sr.getSuggestions(m)||[],b);if(u[0]==="."&&(w=[]),g&&!m&&!/=\s*\w+$/.test(l)){const z=Wn(Sr.getArgSuggestions(g.funcName)||[],b);w=w.concat(z)}return{suggestions:w||[]}}function od(n,s){const a=n.getLineContent(s.lineNumber),l=oa.parseLineContentFuncVar(a,s.column,s.lineNumber);if(l&&l.docValue.length){const u=$u(l.docValue,l.index,l.isBuildIn);if(u)return{contents:[{value:u}]}}return{contents:[]}}function ld(n,s){var k,z;const a={startLineNumber:s.lineNumber,endLineNumber:s.lineNumber,startColumn:1,endColumn:s.column},l=n.getValueInRange(a),u=n.findMatches(String(td),a,!0,!1,null,!0),p=n.findMatches(String(rd),a,!0,!1,null,!0),m=(k=u.pop())==null?void 0:k.matches,v=(z=p.pop())==null?void 0:z.matches;let g=!1;u.length%2===0?m&&m[0]==='"'&&(g=!0):m&&!m[0]&&(g=!0);let b=!1;p.length%2===0?v&&v[0]==="'"&&(b=!0):v&&!v[0]&&(b=!0);const w=oa.parseCurrentInputFuncAndArg(l,b,g);if(w){const{funcName:E,args:R}=w,L=sd.getSignatureHelpValues(E,R);if(L)return{value:L,dispose:()=>{console.log("dispose")}}}return null}function cd(n){let s=n.findMatches(Qs.colorMatchesRegStr,!0,!0,!1,null,!0);return s=s.filter(l=>{const u=n.getValueInRange({...l.range,startColumn:0});return u.indexOf("//")===-1||u.indexOf("//")>l.range.endColumn}),Qs.getDocumentColors(s)}function ud(n,s){return Qs.getDocumentColorPresentations(n,s)||[]}function dd(n,s,a){const l=n.getModel(),u=l==null?void 0:l.getLineContent(a.startLineNumber),p=oa.parseLineContentFuncVar(u||"",a.startColumn+1,a.startLineNumber);if(!p||p.isBuildIn||!p.docValue||!p.docValue[0].pos)return!0;const{lineNumber:m,column:v}=p.docValue[0].pos,g={startLineNumber:m,endLineNumber:m,startColumn:v,endColumn:v};return n.revealRangeInCenterIfOutsideViewport(g),n.setSelection(g),!0}function pd(n,s){return{uri:n.uri,range:{startLineNumber:s.lineNumber,endLineNumber:s.lineNumber,startColumn:s.column-1,endColumn:s.column-1}}}function Wn(n,s){return n.map(a=>(a.range=s,a))}const Hn="tcc_last_edited_script",Vn="tcc_original_script",Zs="tcc_cursor_position";var la={},ca=Nc;if(process.env.NODE_ENV==="production")la.createRoot=ca.createRoot,la.hydrateRoot=ca.hydrateRoot;else{var Ha=ca.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;la.createRoot=function(n,s){Ha.usingClientEntryPoint=!0;try{return ca.createRoot(n,s)}finally{Ha.usingClientEntryPoint=!1}},la.hydrateRoot=function(n,s,a){Ha.usingClientEntryPoint=!0;try{return ca.hydrateRoot(n,s,a)}finally{Ha.usingClientEntryPoint=!1}}}var We;(function(n){n.added="added",n.removed="removed",n.modified="modified"})(We||(We={}));const md=(n,s)=>{const{close:a,retracement:l}=n,[u,p]=F.useState("modified");return F.useImperativeHandle(s,()=>({updateType(m){p(m)}})),mt.jsxs("div",{className:`content-popup content-${u}-popup`,children:[mt.jsx("div",{className:`triangle-popup triangle-${u}-popup`}),mt.jsxs("div",{className:`header-popup header-${u}-popup`,children:[mt.jsx("div",{className:"title-popup",children:"Local working changes"}),mt.jsx("div",{className:"actions-popup",children:mt.jsx("div",{onClick:a,"data-role":"button",className:"button-popup","data-name":"button-close-diff",children:mt.jsx("span",{className:"icon-popup",role:"img",children:mt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12",children:mt.jsx("path",{stroke:"currentColor",strokeWidth:"1.2",d:"m1.5 1.5 9 9m0-9-9 9"})})})})})]}),mt.jsx("div",{id:"diffEditorContainer",style:{height:"100%"}})]})},fd=F.forwardRef(md);class yd{constructor(s,a,l=!0){Object.defineProperty(this,"_domNode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_top",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._id=s,this._domNode=document.createElement("div"),this._domNode.style.display="none",this._domNode.style.width=l?"calc(100% - 134px)":"calc(100% - 14px)",this._domNode.style.height="200px",a==null||a.onDidScrollChange(this.scrollChangeHandler.bind(this)),la.createRoot(this._domNode).render(mt.jsx(fd,{ref:u=>this._content=u,close:()=>this._close(),retracement:this._retracement})),this._top=0}_close(){this._domNode.style.display="none"}_retracement(){}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}show(s,a,l){var u;this._top=a,(u=this._content)==null||u.updateType(l),this._domNode.style.top=`${s}px`,this._domNode.style.display="block"}hide(){this._domNode.style.display="none"}scrollChangeHandler(s){const a=s.scrollTop;this._domNode.style.top=`${this._top-a}px`}}function ar(){}ar.prototype={diff:function(s,a){var l,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p=u.callback;typeof u=="function"&&(p=u,u={}),this.options=u;var m=this;function v(ne){return p?(setTimeout(function(){p(void 0,ne)},0),!0):ne}s=this.castInput(s),a=this.castInput(a),s=this.removeEmpty(this.tokenize(s)),a=this.removeEmpty(this.tokenize(a));var g=a.length,b=s.length,w=1,k=g+b;u.maxEditLength&&(k=Math.min(k,u.maxEditLength));var z=(l=u.timeout)!==null&&l!==void 0?l:1/0,E=Date.now()+z,R=[{oldPos:-1,lastComponent:void 0}],L=this.extractCommon(R[0],a,s,0);if(R[0].oldPos+1>=b&&L+1>=g)return v([{value:this.join(a),count:a.length}]);var J=-1/0,de=1/0;function ee(){for(var ne=Math.max(J,-w);ne<=Math.min(de,w);ne+=2){var Y=void 0,le=R[ne-1],K=R[ne+1];le&&(R[ne-1]=void 0);var Ne=!1;if(K){var _e=K.oldPos-ne;Ne=K&&0<=_e&&_e<g}var re=le&&le.oldPos+1<b;if(!Ne&&!re){R[ne]=void 0;continue}if(!re||Ne&&le.oldPos+1<K.oldPos?Y=m.addToPath(K,!0,void 0,0):Y=m.addToPath(le,void 0,!0,1),L=m.extractCommon(Y,a,s,ne),Y.oldPos+1>=b&&L+1>=g)return v(hd(m,Y.lastComponent,a,s,m.useLongestToken));R[ne]=Y,Y.oldPos+1>=b&&(de=Math.min(de,ne-1)),L+1>=g&&(J=Math.max(J,ne+1))}w++}if(p)(function ne(){setTimeout(function(){if(w>k||Date.now()>E)return p();ee()||ne()},0)})();else for(;w<=k&&Date.now()<=E;){var De=ee();if(De)return De}},addToPath:function(s,a,l,u){var p=s.lastComponent;return p&&p.added===a&&p.removed===l?{oldPos:s.oldPos+u,lastComponent:{count:p.count+1,added:a,removed:l,previousComponent:p.previousComponent}}:{oldPos:s.oldPos+u,lastComponent:{count:1,added:a,removed:l,previousComponent:p}}},extractCommon:function(s,a,l,u){for(var p=a.length,m=l.length,v=s.oldPos,g=v-u,b=0;g+1<p&&v+1<m&&this.equals(a[g+1],l[v+1]);)g++,v++,b++;return b&&(s.lastComponent={count:b,previousComponent:s.lastComponent}),s.oldPos=v,g},equals:function(s,a){return this.options.comparator?this.options.comparator(s,a):s===a||this.options.ignoreCase&&s.toLowerCase()===a.toLowerCase()},removeEmpty:function(s){for(var a=[],l=0;l<s.length;l++)s[l]&&a.push(s[l]);return a},castInput:function(s){return s},tokenize:function(s){return s.split("")},join:function(s){return s.join("")}};function hd(n,s,a,l,u){for(var p=[],m;s;)p.push(s),m=s.previousComponent,delete s.previousComponent,s=m;p.reverse();for(var v=0,g=p.length,b=0,w=0;v<g;v++){var k=p[v];if(k.removed){if(k.value=n.join(l.slice(w,w+k.count)),w+=k.count,v&&p[v-1].added){var E=p[v-1];p[v-1]=p[v],p[v]=E}}else{if(!k.added&&u){var z=a.slice(b,b+k.count);z=z.map(function(L,J){var de=l[w+J];return de.length>L.length?de:L}),k.value=n.join(z)}else k.value=n.join(a.slice(b,b+k.count));b+=k.count,k.added||(w+=k.count)}}var R=p[g-1];return g>1&&typeof R.value=="string"&&(R.added||R.removed)&&n.equals("",R.value)&&(p[g-2].value+=R.value,p.pop()),p}var $n=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Gn=/\S/,Xn=new ar;Xn.equals=function(n,s){return this.options.ignoreCase&&(n=n.toLowerCase(),s=s.toLowerCase()),n===s||this.options.ignoreWhitespace&&!Gn.test(n)&&!Gn.test(s)},Xn.tokenize=function(n){for(var s=n.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),a=0;a<s.length-1;a++)!s[a+1]&&s[a+2]&&$n.test(s[a])&&$n.test(s[a+2])&&(s[a]+=s[a+2],s.splice(a+1,2),a--);return s};var Js=new ar;Js.tokenize=function(n){this.options.stripTrailingCr&&(n=n.replace(/\r\n/g,`
134
+ `));var s=[],a=n.split(/(\n|\r\n)/);a[a.length-1]||a.pop();for(var l=0;l<a.length;l++){var u=a[l];l%2&&!this.options.newlineIsToken?s[s.length-1]+=u:(this.options.ignoreWhitespace&&(u=u.trim()),s.push(u))}return s};function _d(n,s,a){return Js.diff(n,s,a)}var gd=new ar;gd.tokenize=function(n){return n.split(/(\S.+?[.!?])(?=\s+|$)/)};var bd=new ar;bd.tokenize=function(n){return n.split(/([{}:;,]|\s+)/)};function Va(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Va=function(s){return typeof s}:Va=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Va(n)}var xd=Object.prototype.toString,ua=new ar;ua.useLongestToken=!0,ua.tokenize=Js.tokenize,ua.castInput=function(n){var s=this.options,a=s.undefinedReplacement,l=s.stringifyReplacer,u=l===void 0?function(p,m){return typeof m>"u"?a:m}:l;return typeof n=="string"?n:JSON.stringify(ei(n,null,null,u),u," ")},ua.equals=function(n,s){return ar.prototype.equals.call(ua,n.replace(/,([\r\n])/g,"$1"),s.replace(/,([\r\n])/g,"$1"))};function ei(n,s,a,l,u){s=s||[],a=a||[],l&&(n=l(u,n));var p;for(p=0;p<s.length;p+=1)if(s[p]===n)return a[p];var m;if(xd.call(n)==="[object Array]"){for(s.push(n),m=new Array(n.length),a.push(m),p=0;p<n.length;p+=1)m[p]=ei(n[p],s,a,l,u);return s.pop(),a.pop(),m}if(n&&n.toJSON&&(n=n.toJSON()),Va(n)==="object"&&n!==null){s.push(n),m={},a.push(m);var v=[],g;for(g in n)n.hasOwnProperty(g)&&v.push(g);for(v.sort(),p=0;p<v.length;p+=1)g=v[p],m[g]=ei(n[g],s,a,l,g);s.pop(),a.pop()}else m=n;return m}var ti=new ar;ti.tokenize=function(n){return n.slice()},ti.join=ti.removeEmpty=function(n){return n};class vd{constructor(s,a,l){Object.defineProperty(this,"_editor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_monaco",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_originalModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_oldDecorations",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_diffEditor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_diffPopupWidget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_didChangeListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onMouseDownListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._editor=s,this._monaco=a,this._originalModel=this._monaco.editor.createModel(localStorage.getItem(Vn)||"",Pt),this._oldDecorations=[],this._init(),this._eventListening(l)}_init(){var s;this._changeEvent(),this._didChangeListener=(s=this._editor.getModel())==null?void 0:s.onDidChangeContent(()=>this._changeEvent())}update(s){var a;this._originalModel=this._monaco.editor.createModel(s,Pt),(a=this._editor.getModel())==null||a.deltaDecorations(this._oldDecorations,[]),this._oldDecorations=[]}dispose(){var s,a,l,u;this._diffPopupWidget&&(this._diffPopupWidget.hide(),this._editor.removeOverlayWidget(this._diffPopupWidget)),(s=this._didChangeListener)==null||s.dispose(),(a=this._onMouseDownListener)==null||a.dispose(),(l=this._editor.getModel())==null||l.deltaDecorations(this._oldDecorations,[]),this._oldDecorations=[],(u=this._diffEditor)==null||u.dispose(),this._diffEditor=void 0}_changesHandle(s){let a=0,l;const u=[];let p=0;for(const m of s){const{added:v,removed:g,count:b=1,value:w}=m;v?l&&l.removed?(a=this._changeHandle(u,a,p,b,We.modified),p=0,l=void 0):(l&&l.added&&(a=this._changeHandle(u,a,p,l.count||1,We.added),p=0),l=m):g?l&&l.added?(a=this._changeHandle(u,a,p,l.count||1,We.modified),p=0,l=void 0):(l&&l.removed&&this._addDecorationList(u,a,We.removed),l=m):/^\n+$/.test(w)?l&&(l.added||l.removed)?p=b:a+=b:(l&&l.added?(a=this._changeHandle(u,a,p,l.count||1,We.added),p=0,l=void 0):l&&l.removed&&(this._addDecorationList(u,a,We.removed),l=void 0),a+=b)}return l&&l.added?a=this._changeHandle(u,a,p,l.count||1,We.added):l&&l.removed&&this._addDecorationList(u,a,We.removed),u}_changeHandle(s,a,l,u,p){for(let m=1;m<=u;m++)this._addDecorationList(s,a+m,p);return a+=u+l,a}_addDecorationList(s,a,l){s.push({range:new this._monaco.Range(a,1,a,1),options:{isWholeLine:!0,linesDecorationsClassName:`line-${l} line-decoration_${l}`}})}_changeEvent(){var u,p;const s=_d(this._originalModel.getValue(),((u=this._editor.getModel())==null?void 0:u.getValue())||""),a=this._changesHandle(s),l=((p=this._editor.getModel())==null?void 0:p.deltaDecorations(this._oldDecorations,a))||[];this._oldDecorations=l}_eventListening(s){const a=new yd("diff.popup.widget",this._editor);this._editor.addOverlayWidget(a),this._onMouseDownListener=this._editor.onMouseDown(l=>this._onMouseDownHandle(l,s)),this._diffPopupWidget=a}_onMouseDownHandle(s,a){var v,g,b,w,k,z;const l=(v=s.target.element)==null?void 0:v.classList,u=l==null?void 0:l.contains(`line-${We.added}`),p=l==null?void 0:l.contains(`line-${We.modified}`),m=l==null?void 0:l.contains(`line-${We.removed}`);if(u||p||m){const E=((b=(g=s==null?void 0:s.target)==null?void 0:g.position)==null?void 0:b.lineNumber)||0,R=((w=this._editor)==null?void 0:w.getTopForLineNumber(E+1))||0,L=((k=this._editor)==null?void 0:k.getScrollTop())||0,J=u?We.added:p?We.modified:We.removed;(z=this._diffPopupWidget)==null||z.show(R-L,R,J),this._diffEditor||(this._diffEditor=this._createDiffEditor(a)),this._diffEditor.setModel({original:this._originalModel,modified:this._editor.getModel()}),this._diffEditor.revealLineInCenter(E+1)}}_createDiffEditor(s="vs-dark"){return this._monaco.editor.createDiffEditor(document.getElementById("diffEditorContainer"),{theme:s,renderSideBySide:!1,quickSuggestions:!1,suggestOnTriggerCharacters:!1,hover:{enabled:!1},parameterHints:{enabled:!1}})}}class wd{constructor(s,a){Object.defineProperty(this,"_editor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_monaco",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_decorations",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_changPositionListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._editor=s,this._monaco=a,this._init()}setModelMarkers(s){this._monaco.editor.setModelMarkers(this._editor.getModel(),"owner",s)}addDiffDecorations(){this._decorations||(this._decorations=new vd(this._editor,this._monaco))}removeDiffDecorations(){var s;(s=this._decorations)==null||s.dispose(),this._decorations=void 0}setValue(s){this._editor.setValue(s)}saveScripts(){var a;const s=this._editor.getValue();localStorage.setItem(Vn,s||""),(a=this._decorations)==null||a.update(s),console.log("保存成功")}_init(){this._register(),this._setOptions(),this._addCommands(),this._addActions(),this._addListening(),this._setCursorPosition()}_setCursorPosition(){const s=localStorage.getItem(Zs);this._editor.setPosition(s?JSON.parse(s):{lineNumber:1,column:1}),this._editor.focus()}_register(){this._monaco.languages.register({id:Pt}),this._monaco.languages.registerCompletionItemProvider(Pt,{triggerCharacters:["."],provideCompletionItems:nd}),this._monaco.languages.registerHoverProvider(Pt,{provideHover:od}),this._monaco.languages.registerSignatureHelpProvider(Pt,{signatureHelpTriggerCharacters:["(",","],provideSignatureHelp:ld}),this._monaco.languages.registerColorProvider(Pt,{provideColorPresentations:ud,provideDocumentColors:cd}),this._monaco.editor.registerEditorOpener({openCodeEditor:dd}),this._monaco.languages.registerDefinitionProvider(Pt,{provideDefinition:pd})}_setOptions(){this._monaco.editor.defineTheme("vs-dark",ed),this._monaco.editor.defineTheme("vs",Ju),this._monaco.languages.setMonarchTokensProvider(Pt,Qu),this._monaco.languages.setLanguageConfiguration(Pt,Zu)}_addCommands(){this._monaco.editor.addCommand({id:"tcc.editor.function",run:(s,a)=>{var l;(l=this._editor.getAction(a))==null||l.run()}})}_addActions(){this._editor.addAction({id:"tcc-save-script",label:"保存脚本",keybindings:[this._monaco.KeyMod.CtrlCmd|this._monaco.KeyCode.KeyS],contextMenuGroupId:"9_modification",contextMenuOrder:2,run:()=>{this.saveScripts()}})}gotoLine(){this._editor.trigger("click","editor.action.gotoLine",null)}onChangeCursorPosition(s){this._changPositionListener&&this._changPositionListener.dispose();const a=localStorage.getItem(Zs);s&&s(a?JSON.parse(a):{lineNumber:1,column:1}),this._changPositionListener=this._editor.onDidChangeCursorPosition(l=>{localStorage.setItem(Zs,JSON.stringify(l.position)),s&&s(l.position)})}_addListening(){const s=this._editor;document.addEventListener("keydown",function(a){(a.ctrlKey||a.metaKey)&&a.key==="f"&&(a.preventDefault(),s.trigger("keyboard","actions.find",null))},!1)}}/**
135
+ * @license
136
+ * Copyright 2019 Google LLC
137
+ * SPDX-License-Identifier: Apache-2.0
138
+ */const Yn=Symbol("Comlink.proxy"),Td=Symbol("Comlink.endpoint"),Id=Symbol("Comlink.releaseProxy"),ri=Symbol("Comlink.finalizer"),$a=Symbol("Comlink.thrown"),Kn=n=>typeof n=="object"&&n!==null||typeof n=="function",Dd={canHandle:n=>Kn(n)&&n[Yn],serialize(n){const{port1:s,port2:a}=new MessageChannel;return Zn(n,s),[a,[a]]},deserialize(n){return n.start(),ai(n)}},kd={canHandle:n=>Kn(n)&&$a in n,serialize({value:n}){let s;return n instanceof Error?s={isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:s={isError:!1,value:n},[s,[]]},deserialize(n){throw n.isError?Object.assign(new Error(n.value.message),n.value):n.value}},Qn=new Map([["proxy",Dd],["throw",kd]]);function Ad(n,s){for(const a of n)if(s===a||a==="*"||a instanceof RegExp&&a.test(s))return!0;return!1}function Zn(n,s=globalThis,a=["*"]){s.addEventListener("message",function l(u){if(!u||!u.data)return;if(!Ad(a,u.origin)){console.warn(`Invalid origin '${u.origin}' for comlink proxy`);return}const{id:p,type:m,path:v}=Object.assign({path:[]},u.data),g=(u.data.argumentList||[]).map(hr);let b;try{const w=v.slice(0,-1).reduce((z,E)=>z[E],n),k=v.reduce((z,E)=>z[E],n);switch(m){case"GET":b=k;break;case"SET":w[v.slice(-1)[0]]=hr(u.data.value),b=!0;break;case"APPLY":b=k.apply(w,g);break;case"CONSTRUCT":{const z=new k(...g);b=Pd(z)}break;case"ENDPOINT":{const{port1:z,port2:E}=new MessageChannel;Zn(n,E),b=Nd(z,[z])}break;case"RELEASE":b=void 0;break;default:return}}catch(w){b={value:w,[$a]:0}}Promise.resolve(b).catch(w=>({value:w,[$a]:0})).then(w=>{const[k,z]=Ka(w);s.postMessage(Object.assign(Object.assign({},k),{id:p}),z),m==="RELEASE"&&(s.removeEventListener("message",l),Jn(s),ri in n&&typeof n[ri]=="function"&&n[ri]())}).catch(w=>{const[k,z]=Ka({value:new TypeError("Unserializable return value"),[$a]:0});s.postMessage(Object.assign(Object.assign({},k),{id:p}),z)})}),s.start&&s.start()}function qd(n){return n.constructor.name==="MessagePort"}function Jn(n){qd(n)&&n.close()}function ai(n,s){return si(n,[],s)}function Ga(n){if(n)throw new Error("Proxy has been released and is not useable")}function eo(n){return zr(n,{type:"RELEASE"}).then(()=>{Jn(n)})}const Xa=new WeakMap,Ya="FinalizationRegistry"in globalThis&&new FinalizationRegistry(n=>{const s=(Xa.get(n)||0)-1;Xa.set(n,s),s===0&&eo(n)});function Cd(n,s){const a=(Xa.get(s)||0)+1;Xa.set(s,a),Ya&&Ya.register(n,s,n)}function Sd(n){Ya&&Ya.unregister(n)}function si(n,s=[],a=function(){}){let l=!1;const u=new Proxy(a,{get(p,m){if(Ga(l),m===Id)return()=>{Sd(u),eo(n),l=!0};if(m==="then"){if(s.length===0)return{then:()=>u};const v=zr(n,{type:"GET",path:s.map(g=>g.toString())}).then(hr);return v.then.bind(v)}return si(n,[...s,m])},set(p,m,v){Ga(l);const[g,b]=Ka(v);return zr(n,{type:"SET",path:[...s,m].map(w=>w.toString()),value:g},b).then(hr)},apply(p,m,v){Ga(l);const g=s[s.length-1];if(g===Td)return zr(n,{type:"ENDPOINT"}).then(hr);if(g==="bind")return si(n,s.slice(0,-1));const[b,w]=to(v);return zr(n,{type:"APPLY",path:s.map(k=>k.toString()),argumentList:b},w).then(hr)},construct(p,m){Ga(l);const[v,g]=to(m);return zr(n,{type:"CONSTRUCT",path:s.map(b=>b.toString()),argumentList:v},g).then(hr)}});return Cd(u,n),u}function zd(n){return Array.prototype.concat.apply([],n)}function to(n){const s=n.map(Ka);return[s.map(a=>a[0]),zd(s.map(a=>a[1]))]}const ro=new WeakMap;function Nd(n,s){return ro.set(n,s),n}function Pd(n){return Object.assign(n,{[Yn]:!0})}function Ka(n){for(const[s,a]of Qn)if(a.canHandle(n)){const[l,u]=a.serialize(n);return[{type:"HANDLER",name:s,value:l},u]}return[{type:"RAW",value:n},ro.get(n)||[]]}function hr(n){switch(n.type){case"HANDLER":return Qn.get(n.name).deserialize(n.value);case"RAW":return n.value}}function zr(n,s,a){return new Promise(l=>{const u=Rd();n.addEventListener("message",function p(m){!m.data||!m.data.id||m.data.id!==u||(n.removeEventListener("message",p),l(m.data))}),n.start&&n.start(),n.postMessage(Object.assign({id:u},s),a)})}function Rd(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const ao=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CSDMAOri.js").href:new URL("assets/scriptsRunWorker-CSDMAOri.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:La&&La.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});ao.onerror=n=>{console.error(n)};const Od=ai(ao),Ed=ai(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-CFBnUzVu.js").href:new URL("assets/parserTccWorker-CFBnUzVu.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:La&&La.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function so(n,s=!1){const{functions:a,types:l,constants:u,variables:p,methods:m}=rr;return await Ed(n,s,{functions:Object.fromEntries(a),methods:Object.fromEntries(m),types:Object.fromEntries(l),constants:Object.fromEntries(u),variables:Object.fromEntries(p)})}async function io(n,s,a=!0){return await Od(n,s,a)}const Md=({height:n,width:s,theme:a,options:l,hasDiff:u,onChange:p,onDeclareConfigChange:m,onCursorPositionChange:v},g)=>{const b=F.useRef(null);F.useImperativeHandle(g,()=>({saveScript(){var R;(R=b.current)==null||R.saveScripts()},setScript(R){var L;(L=b.current)==null||L.setValue(R)},gotoLine(){var R;(R=b.current)==null||R.gotoLine()}})),F.useEffect(()=>{var R,L;u?(L=b.current)==null||L.addDiffDecorations():(R=b.current)==null||R.removeDiffDecorations()},[u]);function w(R,L){var de;Sr.initBuiltinsTrees(),b.current=new wd(R,L),u&&((de=b.current)==null||de.addDiffDecorations());const J=R.getValue()+`
139
+
140
+ `;b.current.onChangeCursorPosition(v),p&&p(J),k(J)}const k=F.useCallback(async R=>{var Pe;const L=Date.now(),{errors:J,functions:de,methods:ee,types:De,variables:ne,overloadsFuncs:Y,preParserCode:le}=await so(R,!0);try{const we=await io(le,{isPreParser:!0,data:[{time:1473811200,open:.7459,high:.7496,low:.7447,close:.747}]});console.log(we),m&&m(we)}catch(we){console.log(we,"==================error- Run TccScript Server")}const K=new Map(Object.entries(de)),Ne=new Map(Object.entries(ee)),_e=new Map(Object.entries(De)),re=new Map(Object.entries(ne));oa.setUserDefined({functions:K,methods:Ne,types:_e,variables:re},Y),Sr.setUserDefind(K,_e,re,Ne);const yt=J.map(we=>({...we,severity:we.type||pt.MarkerSeverity.Error}));(Pe=b.current)==null||Pe.setModelMarkers(yt);const kt=Date.now();console.log((kt-L)/1e3)},[m]),z=F.useMemo(()=>Ku.debounce(k,1e3),[k]);function E(R){var L;(L=b.current)==null||L.setModelMarkers([]),localStorage.setItem(Hn,R||""),R!==void 0&&(R=R+`
141
+
142
+ `,p&&p(R),z(R))}return mt.jsx(Fu,{height:n||"90vh",width:s||"100%",defaultLanguage:"tccScript",defaultValue:localStorage.getItem(Hn)||`indicator("我的脚本")
143
+ plot(close)
144
+ `,theme:a||"vs-dark",options:{colorDecorators:!0,matchOnWordStartOnly:!0,suggest:{matchOnWordStartOnly:!0},fontSize:13,...l},onMount:w,onChange:E})},Ld=F.forwardRef(Md);Ke.VMarkerSeverity=void 0,function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"}(Ke.VMarkerSeverity||(Ke.VMarkerSeverity={})),Ke.TradingVueEditor=Ld,Ke.parseTcc=so,Ke.scriptsRun=io,Object.defineProperty(Ke,Symbol.toStringTag,{value:"Module"})});