{"id":2290,"date":"2023-01-01T09:23:25","date_gmt":"2023-01-01T09:23:25","guid":{"rendered":"https:\/\/www.overcharts.com\/en\/helpcenter\/?post_type=docs&#038;p=2290"},"modified":"2023-07-14T08:39:45","modified_gmt":"2023-07-14T08:39:45","password":"","slug":"create-an-indicator-with-overbasic","status":"publish","type":"docs","link":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/","title":{"rendered":"Create an Indicator with Overbasic"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">With Overbasic programming language you can create custom indicators (User-Indicators) to add to your charts and\/or use within Overcharts where permitted. Once <strong>created<\/strong> and <strong>compiled<\/strong>, these indicators can also be used within other indicators or trading-systems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In charts, indicators are drawn in the form of a continuous line (curve), histograms, or in the various forms provided for <strong>standard<\/strong> indicators. A standard indicator is represented by a data series (array). The number of items contained in the data series is equal to the number of periods\/bars in the chart. In other words, for each bar of the chart there will be the corresponding value of the indicator.<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create a New Indicator<\/strong><\/h2>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#fff36b\">Before starting the development of an indicator, we recommend you <strong>carefully read<\/strong> the <strong>Overbasic language syntax documentation, keywords and available built-in functions<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create a new indicator:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Access <strong>Developer<\/strong> (the Overcharts development app):\n<ul class=\"wp-block-list\">\n<li>from <em>Overcharts main window<\/em> &gt; <strong>Tools<\/strong> menu &gt; Developer<\/li>\n\n\n\n<li>or from <em>Workspace window<\/em> &gt; <strong>Tools<\/strong> menu &gt; Developer<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create the indicator from: \n<ul class=\"wp-block-list\">\n<li><em>File<\/em> menu &gt; <strong>New<\/strong> &gt; <em>Indicator &#8211; Overbasic<\/em>  <\/li>\n\n\n\n<li>or press <strong>New<\/strong> button on the top toolbar<\/li>\n\n\n\n<li>or from <em>Indicators<\/em> Tab &gt; press &#8216;<strong>+<\/strong>&#8216; button on the left vertical toolbar<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Define the indicator name. The name must comply with the following rules::\n<ul class=\"wp-block-list\">\n<li><em>can<\/em> consist of <strong>letters<\/strong> (both Uppercase and lowercase) or <strong>numbers<\/strong><\/li>\n\n\n\n<li><em>cannot<\/em> contain spaces. The only separator character allowed is <strong>underscore<\/strong>: &#8220;<strong>_<\/strong>&#8220;<\/li>\n\n\n\n<li><em>cannot<\/em> contain special characters such as !&#8221;\u00a3$%&amp;\/()=?^|<\/li>\n\n\n\n<li><em>cannot<\/em> contain special letters (typical of some languages)<\/li>\n\n\n\n<li><em>cannot<\/em> be a number or start with a number<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Press OK to confirm the name and create the indicator.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Once the indicator is created, the editor opens automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Afterwards, you will be able to access the editor to edit the indicator from indicator list on the left:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>by double clicking<\/em> the indicator name<\/li>\n\n\n\n<li>or by pressing the corresponding <strong>Open<\/strong> button next to the indicator name<\/li>\n\n\n\n<li>or by right clicking the indicator name &gt; <strong>Edit<\/strong><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>MAIN function<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The main component of an indicator (the only really mandatory) is the <a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-function\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Main<\/strong> function<\/a>, i.e. the function containing indicator formula. <strong>The result returned by Main function MUST be numeric.<\/strong><\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#fff36b\">Main function is always run automatically by Overcharts. In particular:<br>&#8211; in calculating indicator <strong>historical<\/strong> values, Main function is called for each single bar of the chart and its result will be the value that the indicator will assume on that bar.<br>&#8211; in <strong>real time<\/strong> calculation, Main function is called for each new data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The indicator below calculates the midpoint between High and Low for each bar. It will be drawn on chart as a curve passing through the midpoint of each bar.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> (High + Low) \/ 2\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The Main function will be called for each bar of the chart and will return, using <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-return\/\" target=\"_blank\" rel=\"noreferrer noopener\">RETURN<\/a><\/strong> keyword, the indicator value for that bar.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#fff36b\">In an indicator, the <strong>Main function can return up to 10 results<\/strong> which will correspond to 10 different curves on chart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In an indicator, the Main function can return up to 10 results which will correspond to 10 different curves on chart. For example, it may be useful to return multiple values (and therefore multiple curves) in the same indicator instead of creating x different indicators, when formulas are very similar to each other or have a large part of the script in common. All curves will have the same Y-axis scale.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s add a second result to the Main function from the previous example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> (High + Low) \/ 2 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As<\/mark><\/strong> HL2, (High + 0.1 * High) <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As<\/mark><\/strong> SuperHigh\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: When there are multiple results, it is mandatory to define a unique name for each result using <strong>AS<\/strong> keyword. For more information, refer to <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-return\/#1-toc-title\" target=\"_blank\" rel=\"noreferrer noopener\">RETURN<\/a><\/strong> keyword documentation.<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>PROPERTYs<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By defining one or more <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-property\/\" target=\"_blank\" rel=\"noreferrer noopener\">PROPERTY<\/a><\/strong>s, you can externally influence the indicator calculation. <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-property\/\" target=\"_blank\" rel=\"noreferrer noopener\">PROPERTY<\/a><\/strong>s are properties you can set in the indicator configuration on chart, or you can pass as an argument to the indicator function in case you use the indicator in the script of another indicator or trading-system.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#cce9f5\">We recommend you read <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-property\/\" target=\"_blank\" rel=\"noreferrer noopener\">PROPERTY<\/a><\/strong> documentation to learn more about PROPERTYs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The indicator below represents the difference between two moving averages calculated over two different periods. Periods can be set externally using Period1 and Period2 properties.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> Period1 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Numeric<\/mark><\/strong>\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Range<\/mark><\/strong> (5, 100)\n    <mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Default<\/strong><\/mark> (20)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> Period2 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Numeric<\/mark><\/strong>\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Range<\/mark><\/strong> (5, 100)\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Default<\/mark><\/strong> (50)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> Mov(Close, Period1) - Mov(Close, Period2)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>PRAGMAs<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A Pragma is a special parameter that allows you to influence the Indicator behavior.<br>Some Pragmas can be defined exclusively within the script, while others are used to set default values of properties accessible in the Indicator configuration window.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#cce9f5\">If you do not know what a <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-pragma\/\" target=\"_blank\" rel=\"noreferrer noopener\">PRAGMA<\/a><\/strong> is and how to use it, we recommend you read <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-pragma\/\" target=\"_blank\" rel=\"noreferrer noopener\">PRAGMA documentation<\/a><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Among the various pragmas available for indicators, we highlight two of them in importance:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>USE_REFERENCE_OBJECT_SCALE_AS_DEFAULT<\/strong>: allows to set the use of reference chart\/indicator scale as default. Very useful for all indicators that need to be drawn in the same window as the reference chart\/indicator such as, for example, a moving average.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Pragma<\/mark><\/strong> (\"USE_REFERENCE_OBJECT_SCALE_AS_DEFAULT\", <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">True<\/mark><\/strong>)\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> (High + Low) \/ 2\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>VALID_STARTING_FROM<\/strong>: defines the bar from which to start drawing the indicator curve. In other words, it is the index of the first valid value in the indicator values series.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Pragma<\/mark><\/strong> (\"VALID_STARTING_FROM\", Period2)\n\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> Period1 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Numeric<\/mark><\/strong>\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Range<\/mark><\/strong> (5, 100)\n    <mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Default<\/strong><\/mark> (20)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> Period2 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Numeric<\/mark><\/strong>\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Range<\/mark><\/strong> (5, 100)\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Default<\/mark><\/strong> (50)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> Mov(Close, Period1) - Mov(Close, Period2)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Indicator Description<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can define a description for the indicator using <strong><a href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/overbasic-info\/\" target=\"_blank\" rel=\"noreferrer noopener\">INFO<\/a><\/strong> keyword. Description will be shown, for example, in the available-indicators window.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:12px\"><code><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Info<\/mark><\/strong> \"Bar Midpoint\"\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Pragma<\/mark><\/strong> (\"USE_REFERENCE_OBJECT_SCALE_AS_DEFAULT\", <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">True<\/mark><\/strong>)\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> (High + Low) \/ 2\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Indicator on indicator<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To calculate an indicator based on another indicator, you need to define in the script an <em>Indicator<\/em>-type <strong>PROPERTY<\/strong>. Using this property you will be able to access the external indicator data-series and use it in the calculation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s we calculate the difference between two indicators, both set externally in the indicator configuration window:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> ExtInd1 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Indicator<\/mark><\/strong>\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Property<\/mark><\/strong> ExtInd2 <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">As Indicator<\/mark><\/strong>\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndProperty<\/mark><\/strong>\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> ExtInd1 - ExtInd2\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Compile\/build the Indicator<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To use the indicator in Overcharts, you MUST compile it. Compiling an indicator means transforming the source code into a &#8216;something&#8217; that the program understands.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Developer, you can build a single indicator in one of the following ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>by pressing <strong>Compile<\/strong> button on toolbar inside the Editor window<\/li>\n\n\n\n<li>or by pressing &#8216;Compile&#8217; icon (gear) next to indicator name in indicator list. The icon is ONLY visible if the indicator needs to be compiled.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can massively compile multiple indicators, in one of the following ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Developer main window &gt; <strong>Compile<\/strong> menu &gt; <em>Select which items to compile<\/em><\/li>\n\n\n\n<li>Developer main window &gt; press <strong>Compile<\/strong> button on main toolbar &gt; <em><em>Select which items to compile<\/em><\/em><\/li>\n\n\n\n<li>Indicator list &gt; press <strong>Compile<\/strong> button on toolbar above the list &gt; <em><em>Select which items to compile<\/em><\/em><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Using the indicator in an external script<\/strong><\/h2>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#cce9f5\"><strong><em>My.User_indicator.Private<\/em><\/strong> category contains all user-indicator functions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To use an indicator within the script of another indicator or trading-system:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create<\/strong> and <strong>Compile<\/strong> the indicator<\/li>\n\n\n\n<li>Use the indicator function in the external script. You can find the indicator function in <strong><em>My.User_Indicator.Private<\/em><\/strong> category. Function has the same name as the indicator. If present, it is also necessary to set indicator PROPERTYs by passing them as arguments to the function.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the example below, <em>BarMiddleValue<\/em> function represents a previously created and compiled indicator. Arguments 10 and 5 are the values of 2 PROPERTYs defined in the <em>BarMiddleValue<\/em> indicator script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\"><strong>Function Main<\/strong><\/mark>()\n    <strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">Return<\/mark><\/strong> BarMiddleValue(10, 5)\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0088cd\" class=\"has-inline-color\">EndFunction<\/mark><\/strong><\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: Usually, you can use the indicator function directly without specifying the full path: &#8216;<em>My. User_Indicator. Private<\/em>. <em>BarMiddleValue(10, 5)<\/em>&#8216;. You need to specify the full path only if exists another function with the same name as the indicator.<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>With Overbasic programming language you can create custom indicators (User-Indicators) to add to your charts and\/or use within Overcharts where permitted. Once created and compiled, these indicators can also be used within other indicators or trading-systems. In charts, indicators are drawn in the form of a continuous line (curve), histograms, or in the various forms [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[15],"doc_tag":[],"class_list":["post-2290","docs","type-docs","status-publish","hentry","doc_category-overbasic"],"year_month":"2026-10","word_count":1314,"total_views":"7","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"Overcharts Team","author_nicename":"overadmin","author_url":"https:\/\/www.overcharts.com\/en\/helpcenter\/author\/overadmin\/"},"doc_category_info":[{"term_name":"Overbasic","term_url":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs-category\/overbasic\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>Create an Indicator with Overbasic - Overcharts Help Center<\/title>\r\n<meta name=\"description\" content=\"With Overbasic programming language you can create custom indicators to add to your charts and\/or use within Overcharts where permitted.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Create an Indicator with Overbasic - Overcharts Help Center\" \/>\r\n<meta property=\"og:description\" content=\"With Overbasic programming language you can create custom indicators to add to your charts and\/or use within Overcharts where permitted.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/\" \/>\r\n<meta property=\"og:site_name\" content=\"Overcharts Help Center\" \/>\r\n<meta property=\"article:modified_time\" content=\"2023-07-14T08:39:45+00:00\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/docs\\\/create-an-indicator-with-overbasic\\\/\",\"url\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/docs\\\/create-an-indicator-with-overbasic\\\/\",\"name\":\"Create an Indicator with Overbasic - Overcharts Help Center\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/#website\"},\"datePublished\":\"2023-01-01T09:23:25+00:00\",\"dateModified\":\"2023-07-14T08:39:45+00:00\",\"description\":\"With Overbasic programming language you can create custom indicators to add to your charts and\\\/or use within Overcharts where permitted.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/docs\\\/create-an-indicator-with-overbasic\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/docs\\\/create-an-indicator-with-overbasic\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/docs\\\/create-an-indicator-with-overbasic\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create an Indicator with Overbasic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/#website\",\"url\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/\",\"name\":\"Overcharts Help Center\",\"description\":\"Trading Software &amp; Technical Analysis\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.overcharts.com\\\/en\\\/helpcenter\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create an Indicator with Overbasic - Overcharts Help Center","description":"With Overbasic programming language you can create custom indicators to add to your charts and\/or use within Overcharts where permitted.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/","og_locale":"en_US","og_type":"article","og_title":"Create an Indicator with Overbasic - Overcharts Help Center","og_description":"With Overbasic programming language you can create custom indicators to add to your charts and\/or use within Overcharts where permitted.","og_url":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/","og_site_name":"Overcharts Help Center","article_modified_time":"2023-07-14T08:39:45+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/","url":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/","name":"Create an Indicator with Overbasic - Overcharts Help Center","isPartOf":{"@id":"https:\/\/www.overcharts.com\/en\/helpcenter\/#website"},"datePublished":"2023-01-01T09:23:25+00:00","dateModified":"2023-07-14T08:39:45+00:00","description":"With Overbasic programming language you can create custom indicators to add to your charts and\/or use within Overcharts where permitted.","breadcrumb":{"@id":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.overcharts.com\/en\/helpcenter\/docs\/create-an-indicator-with-overbasic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.overcharts.com\/en\/helpcenter\/"},{"@type":"ListItem","position":2,"name":"Create an Indicator with Overbasic"}]},{"@type":"WebSite","@id":"https:\/\/www.overcharts.com\/en\/helpcenter\/#website","url":"https:\/\/www.overcharts.com\/en\/helpcenter\/","name":"Overcharts Help Center","description":"Trading Software &amp; Technical Analysis","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.overcharts.com\/en\/helpcenter\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/docs\/2290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/comments?post=2290"}],"version-history":[{"count":20,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/docs\/2290\/revisions"}],"predecessor-version":[{"id":2749,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/docs\/2290\/revisions\/2749"}],"wp:attachment":[{"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/media?parent=2290"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/doc_category?post=2290"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.overcharts.com\/en\/helpcenter\/wp-json\/wp\/v2\/doc_tag?post=2290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}