ScriptIQ - Introduction

'ScriptIQ' is both the name of the module as well as the language that allows users to create custom indicators and plot them on the chart.

Why would you want to create your own indicators?

Even though the ChartIQ library comes prepackaged with over 100 indicators, the ability to to create custom indicator allows the user a more powerful option that they fully control. Say you don't agree with how the ChartIQ Study Library calculates a certain value, now you can write your own script that will calculate that value how you want.

The 'ScriptIQ' language is built on top of CoffeeScript and provides the user with preset builtins that will make inputs and calculations easier to manage. A list of builtins can be viewed on the ScriptIQ API documentation

**This module runs as a plug-in to the sample-template-advanced.html GUI interface and not as a stand-alone module, and will not work when running from the filesystem on Chrome, Edge, or Safari. Please either install files on a web-server or use Firefox for evaluation purposes.

NOTE ScriptIQ currently runs on all Browsers that support ES6. Versions of Internet Explorer 11 and below are not supported.

In addition to the the standard library files, This module requires the following:

  • plugins/scriptiq/* (ScriptIQ is an optional feature not included in all packages)

User Interface

ChartIQ provides two widgets out of the box that provides a simple user interface. See sample-template-advanced.html for reference.

cq-scriptiq-editor contains the interface that allows a user to enter or edit their ScriptIQ entries. By default the ScriptIQ editor will be place under the chart area.

cq-study-script-menu contains the interface that will display all current ScriptIQ entries and have a way to display the ScriptIQ editor. By default the ScriptIQ entries will be listed in the Study Menu under 'ScriptIQ'


Complete code for initializing the cq-scriptiq and cq-scriptiq-menu widgets can be found in sample-template-advanced.html (search for "scriptiq", NOT case sensitive).


ScriptIQ graphical components are plain html. As such they can be modified if desired. The JavaScript code for ScriptIQ references these objects by class name and expects the components to exist however it makes no restriction on how they look. You may apply CSS selectors to override color or layout. You may also add or remove HTML componentry. For instance if you require a disclaimer, simply add the disclaimer text to the HTML components.

Including additional js files

Since the ScriptIQ plugin is dynamically loaded, including additional js files in the plug in must be done with care.

The best place to do this is on the CIQ.loadWidget callback function.

The following example outlines the process that takes place in scriptiq.js:

function widgetLoaded(err){
        // now load your script using CIQ.loadScript,
        // and have the rest of the original code loaded
        // in the the CIQ.loadScript callback function
        // so it all loads in order.
        CIQ.loadScript("yourScript.js", function(){
            // now run the rest of the code that may need yourScript.js
            var editor = document.querySelector('cq-scriptiq-editor');
CIQ.loadWidget("plugins/scriptiq/scriptiq-editor", this, widgetLoaded);


Q: Does ScriptIQ work in IE?

A: ScriptIQ works with Microsoft Edge and above. Version IE11 and below are not currently supported.

Q: Can I share ScriptIQ entries with anyone?

A: Yes. script sharing is as easy as copying and pasting the script form the edit window into any other edit window. An interface can be created on your UI to facilitate this operation and even create an interface to save the scripts on to a centrally located facility where users can share their scripts. See CIQ.Scripting for the APIs used to load scripts into a chart.

Q: I am not seeing a builtin I need. When will it be added?

A: As we continue to develop ScriptIQ, more builtins will be added to the API. The list of current builtins can be found here: CIQ.Scripting.Builtins

Q: Are there ScriptIQ examples?

A: Yes. See the following tutorial: ScriptIQ Examples

Next Steps: