Liquid Charts API Docs
Liquid Charts Pro Scripts Documentation
Liquid Charts Pro Scripts Documentation
  • Liquid Charts Pro User-Defined Indicators
    • Introduction
      • 1.1 Access to the Liquid Charts scripting framework (UDI vs UDIX)
      • 1.2 Example UDI code
      • 1.3 Adding a UDI to a chart
      • 1.4 Lifecycle
      • 1.5 Alerts
      • 1.6 Indicator-on-indicator
      • 1.7 Technical note: web workers
      • 1.8 Technical note: dates
    • Initialisation: UDI.onInit()
      • 2.1 Return value from UDI.onInit()
      • 2.2 The plots[] array
      • 2.3 The settingsFields[] array
      • 2.4 Context data passed to UDI.onInit()
    • Calculating data: UDI.onCalculate()
      • 3.1 Reading settings fields
      • 3.2 Input data for the UDI
      • 3.3 Updates of the current bar only
      • 3.4 Calculating output data
      • 3.5 Requesting out-of-band updates
      • 3.6 Technical analysis: moving averages, ATR etc
    • Changes to the chart or parameters
      • 4.1 UDI.onContextChange()
      • 4.2 UDI.onParameterChange()
    • Creating drawings, event markers, and bar highlights
      • 5.1 Creating drawings
      • 5.1.1 Drawing properties
      • 5.2 Creating event markers
      • 5.2.1 Click notifications from event markers
      • 5.3 Creating bar highlights
    • Notifying the user
      • 6.1 Creating toast
      • 6.2 Changing the panel background colour
    • Adding HTML to the chart
      • 7.1 Adding HTML
      • 7.2 Positioning the HTML
      • 7.3 Sending messages from the HTML to the UDI
      • 7.4 Sending messages from the UDI to the HTML
    • Recommended trade
      • 8.0 Recommended trade
    • Other indicator topics
      • 9.1 Collecting external data
      • 9.2 Converting dates to chart time
      • 9.3 Multi-timeframe (MTF) indicators
  • Liquid Charts Pro Framework
    • Examples
    • Collections, objects, and properties in the framework
    • Functions in the framework
    • Messages and event handlers
    • Working with candle data
    • Widget HTML and CSS reference
    • Liquid.utils and other helper functions
    • Framework error codes
    • Script contexts
    • Sending mail into Liquid Charts Pro from outside the platform
    • language variables
Powered by GitBook
On this page
  • 9.1 Quote Board script context
  • 9.2 Trade List script context
  • 9.3 Chart script context
  • 9.4 Order Menu script context
  1. Liquid Charts Pro Framework

Script contexts

When you save a script in the Run Script widget, you can give it a "context". This makes it available in a specific place within the Liquid Charts Pro platform, rather than being part of the list of scripts for general use.

For example, you can set up a script so that it is included on the action menu for a trade or order (in the Trade List component, or from the chart marker for an open trade or pending order).

Scripts which have a context receive information about that context in their Framework.privateSettings, as described below.

9.1 Quote Board script context

Scripts which are assigned to the Quote Board context are displayed under the widget's Tools menu. For example, you could create a script which doubles up any open position on markets currently listed in the quote board.

The script receives the following information in its Framework.privateSettings about the current contents of the quote board:

Member

Description

scriptContext

Set to "quoteboard"

listedInstruments[]

Array of all markets currently loaded into the quote board (potentially including markets filtered out, and not currently visible)

filteredInstruments[]

Array of all markets which meet any filtering, and are currently visible in the quote board

selectedInstruments[]

Array of markets which are currently selected by the user (and highlighted) in the quote board

9.2 Trade List script context

Scripts which are assigned to the Trade List context are displayed under the widget's Tools menu. For example, you could create a script which calculates a technical indicator and closes any trade based on the indicator value for its market.

(Note: scripts can also be assigned to the Order Menu context. This causes them to be displayed under the All/Filtered Orders and Selected Orders sub-menus of the Tools menu.)

The script receives the following information in its Framework.privateSettings about the current contents of the trade list:

Member

Description

scriptContext

Set to "tradelist"

listMode

Selected mode for the list. One of "trades", "pending", or "all".

listedOrders[]

Array of all orders markets currently loaded into the trade list (which will match all the trades/orders currently existing on the account, depending on the value of the listMode)

filteredOrders[]

Array of all orders which meet any filtering, and are currently visible in the trade list

selectedOrders[]

Array of order which are currently selected by the user (and highlighted) in the trade list

9.3 Chart script context

Scripts which are assigned to the Chart context are displayed under a chart's settings menu.

The script receives the following information in its Framework.privateSettings about the current chart:

Member

Description

scriptContext

Set to "chart"

instrumentId

ID of the market being displayed on the chart

timeframe

Timeframe being displayed on the chart

timezone

Selected time zone for the chart

9.4 Order Menu script context

Scripts which are assigned to the Order Menu context are displayed in the following places within Liquid Charts Pro:

· In the trade list widget, under the All/Filtered Orders and Selected Orders sub-menus of the Tools menu

· In the pop-up action menu for an individual order in the trade list grid

· In the pop-up action menu for an order from its marker on a trade chart

The script receives the following information in its Framework.privateSettings about the applicable orders. The orders[] array will contain a single ID if used from the action menu of a chart marker or individual entry in the trade list grid. The array may contain multiple orders if used from the Tools menu of the trade list.

Member

Description

scriptContext

Set to "ordermenu"

orders[]

Array of applicable orders/trades

PreviousFramework error codesNextSending mail into Liquid Charts Pro from outside the platform

Last updated 3 months ago