Tutorials
Getting started
Chart interface
Web components
Chart internals
Data integration
Customization
Frameworks and bundlers
Mobile development
Trading
Time Span Events
Term structures
ScriptIQ
Troubleshooting
Glossary
Reference
JSFiddles

ScriptIQ

Introduction

ScriptIQ is both a ChartIQ module and a scripting language that enable you to create custom indicators (studies) and plot them on the chart.

The ChartIQ library comes prepackaged with a wide variety of indicators. ScriptIQ gives you the ability to extend the library with indicators built to your specifications.

ScriptIQ is essentially a development environment connected to your ChartIQ charts. The environment includes an interactive editor that enables you to write scripts that define your custom indicators.

The ScriptIQ scripting language is built on CoffeeScript. ScriptIQ provides built-in functions that simplify data access, calculations, plotting, and styling. See the ScriptIQ API documentation for a complete list of built-in functions.

Note:

  • The ScriptIQ module is a plug-in for the technical-analysis-chart.html template (see http://demo.chartiq.com). ScriptIQ is not a stand-alone product.
  • ScriptIQ will not work when running from the file system on Chrome, Edge, or Safari. Either install files on a web server or use Firefox with ScriptIQ.
  • ScriptIQ currently runs on all browsers that support ECMAScript 6 (ES6). Internet Explorer 11 and previous versions of IE are not supported.
  • ScriptIQ requires the following (in addition to the standard library files):
    • plugins/scriptiq/* (this is an optional feature not included in all packages)

User Interface

ScriptIQ includes two web components that create a basic development environment for scripting:

  • cq-scriptiq-editor — Creates the editor that enables you to enter, edit, execute, and save ScriptIQ scripts

  • cq-scriptiq-menu — Creates a menu that displays the names of your stored ScriptIQ scripts along with controls used to manage the scripts

Integration

See technical-analysis-chart.html for an example of markup that instantiates the cq-scriptiq-editor and cq-scriptiq-menu web components (search for "scriptiq"). In technical-analysis-chart.html, the cq-scriptiq-menu component creates the SCRIPTIQ section of the Studies menu. The list of your stored scripts appears in the SCRIPTIQ section.

Customization

The programming code of the ScriptIQ plug-in references the web components by class name and expects them to exist. However, ScriptIQ places no restriction on how the components look, so you can apply CSS to override color and layout. You can also add or remove HTML componentry. For instance, if you require a disclaimer, simply add the disclaimer text to the HTML components. See Introduction to Web Components and Customizing Web Components to learn about ChartIQ web components.

FAQ

Q: Does ScriptIQ work in Internet Explorer?
A: ScriptIQ works with all versions of Microsoft Edge. IE 11 and previous versions of IE are not currently supported.

Q: Can I share ScriptIQ scripts with anyone?
A: Yes. Script sharing is as easy as copying and pasting the script from the ScriptIQ editor into any other edit window. An interface can be created in your UI to facilitate sharing. You can even create an interface to save the scripts 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 built-in I need. When will it be added?
A: As we continue to develop ScriptIQ, more built-ins will be added to the API. See CIQ.Scripting.Builtins for the list of all current built-ins.

Q: Are there ScriptIQ examples?
A: Yes. See the ScriptIQ examples tutorial.

Next steps