ITMScript
The builder
Write a study in the builder as text or as blocks, import a Pine Script or thinkScript study, and put the result on the chart.
The builder is where a study is written and changed. It opens beside the chart, so the candles stay in view while you work. This page names each part of it.
Open it
Open Indicators in the chart header and choose Custom study. To change a study already on the chart, open its settings from the legend. Both open the same builder. The header shows the study's name, the symbol and timeframe, and whether the script compiles.
Ctrl or Cmd plus I opens the builder on the chart under the pointer. In the builder, Alt plus I opens a list of what else it can open: the studies on this chart, the studies on the view's other charts, and the chart's indicators. Type to narrow the list, move with the arrow keys and press Enter.
A built-in indicator opens as ITMScript. Open its settings in Indicators and choose Open as ITMScript. The builder opens on a copy of the indicator written as a study, at the settings it has on the chart. The indicator itself stays on the chart. Three indicators have no script: Parabolic SAR, Fair Value Gap and Volume Profile. Ichimoku opens without its lagging line.
Code
The Code tab is a text editor for the script.
- Title names the study. Left empty, it takes the name from the script.
- The editor colours the script and completes operator names as you type.
- Problems appear under the editor. Each one gives the line and column, the message and the error code. Select the position to move the caret there. Look the code up on the error codes page.
- When the script is good, the editor says how the study reads. It also lists any other symbols and timeframes the study needs.
- A good script can still carry warnings. They appear under the editor beside how the study reads, each with its line and column and its code. The five warnings are an unread input, an unread value, a plot of a constant that no fill reads, a value named like a ticker, and a comparison with
na, which is never true. A warning never stops the study from compiling or from going on the chart. Select the position to move the caret there. The codes are in the Warnings group of the error codes page.
At the foot, Add to chart puts the study on the chart. On a study that is already there, the button reads Apply. Remove takes it off. Close leaves the builder without a change.
Tidy rewrites the script in its canonical form. Layout and comments are normalised and functions are expanded, which can change a lot of text. Tidy asks before it replaces anything. Replace swaps the text in and keeps the old text for one Undo tidy. The undo goes away as soon as you edit.
Settings beside the editor
The column beside the editor holds three groups.
- Placement puts the study over the price with Overlay, under the chart in a Pane, or as the tile's own series in Own tile.
- Inputs shows one control for each input in the script. A label says whether a change reaches the chart as you make it or when you apply.
- Outputs appears when the script has a table or a field. It chooses where each one is shown.
The same inputs can be changed later from the study's settings in the legend.
Import
Select Import in the header to import a study written in Pine Script or thinkScript. ITMScript translates from those two languages. It does not write them. The import view takes the place of the editor.
- Choose the language, or leave it on Auto.
- Paste the script.
- Select Convert.
The conversion is exact and uses no model. The same script always gives the same result. The converter is in beta. The report is the last word on a script. The report lists every line. A line is converted, converted with a note, refused or dropped. A refused line carries a code and the rewrite that would let it through. The codes are on the error codes page. Nothing is lost without a note. The Migrate group in the side navigation has a page for each language, with the full tables of what converts.
Use this script brings the result into the Code tab, where you can read it and change it. Back returns to the editor and leaves your text alone. Nothing runs on the chart until you add the study. The script you pasted is kept with the study you save.
Blocks
The Blocks tab shows the same script as blocks. Code and Blocks are two views of one script, so a change in either shows in the other.
Place and edit
- Each statement is a row of blocks. A block has sockets for its arguments. A socket has a type, and only a block of that type fits.
- The palette beside the well lists inputs, data, logic, the operator families, math and outputs. A search field narrows it as you type, and each group shows how many rows match. With a socket selected, blocks that do not fit it stay in the list, dimmed, with the reason.
- The group This script comes first. It lists the names the script declares: values, inputs, series and the outputs that a destructuring names. Choose one to place it by name in the selected socket. A name that cannot go there, such as one that would read itself, stays dimmed with the reason.
- Select a socket and press Enter. An empty socket, or one that holds a bar field, an input or a name, opens the palette. A number or a text is edited in place, and Enter keeps the change. Choosing a block from the palette fills the socket, or wraps what the socket held.
- With a socket selected, type a letter to open the palette with that letter in its search. The space bar and the slash key keep their own meanings.
- With a row selected, an input or an output chosen from the palette is added as a new statement after that row.
- A plot's colour, a marker's colour, a fill's colour and a background's colour can change from bar to bar. Colour by condition, in the Logic group, places one: green on an up bar and red on a down bar, which you then change. A level's colour takes one colour, so the row stays dimmed there and says why.
Drag and move
- On a desktop, drag an operator or a name from the palette onto a socket. On a line that returns several outputs, drag the tab of an output you named onto a socket to place that output by name. The socket it would drop on takes a highlight. A socket under the pointer that does not take it dims, and the line under the blocks says why. The palette hint says it too. A drop there changes nothing. Press Esc to cancel the drag.
- Drag a statement's number in the left margin to move the whole row. A line shows where it will land.
- Every drag has a keyboard route. With a statement selected, Delete removes it. Ctrl plus M opens Move to..., a menu of positions such as "Before line 2" and "After line 9". Choose a position to move the statement there.
- The menu at the end of a row holds Move to..., Unwrap, Extract to a name and Delete. Shift plus F10 opens it from the keyboard. Unwrap and Extract to a name act on the focused socket in that row. Unwrap replaces an operator with its first argument that fits. Extract to a name asks for the name first, in a field under the blocks that starts with a suggested name. Enter moves the expression to a new line above, and the socket reads the name.
- A statement that other lines read cannot be removed or moved below them. The line under the blocks names the readers.
Undo, refusals and tidy
- On a desktop, Undo and Redo sit on the toolbar row. They cover every edit made in the blocks, including moves and a tidy. Ctrl or Cmd plus Z undoes. Ctrl or Cmd plus Shift plus Z redoes.
- Every edit in the blocks is checked before it is written. A refused edit changes nothing. The line under the blocks gives the reason, and on a desktop the palette hint gives it too. A screen reader announces each refusal once. The script, the blocks and the chart stay as they were.
- Some scripts must be tidied before the blocks can change them. The line under the blocks then asks "Tidy this script into blocks? Comments and layout are normalised. Undo brings the original back." Choose Tidy to rewrite the script in its canonical form and make the edit. The line then offers Undo tidy, and one undo brings the original back. The original is kept for the session. Not now leaves everything as it is.
- Problems are listed under the blocks, as they are under the editor. Since every block edit is checked first, only a change in Code can stop the script compiling. Until it compiles again, the blocks show the last good version and cannot be changed.
- The Study settings group holds the same controls as the column beside the editor.
Shifts and choices
A plot that is drawn ahead shows its offset as a chip. The chip takes a whole number from 0 to 500, the name of an int input, or the name of an int input plus or minus a whole number, such as shift - 1. Any other text is refused, and the line under the blocks gives the sentence. A zero takes the offset off the plot. An offset that the code writes in another form, such as the name of a value, shows as it is written. Change it in the Code tab.
A choice input compared with one of its options, as in kind == "ema", is a condition block. The group This script lists each choice input already compared with its first option, as A choice compared. The option sits in the block as a chip. Select the chip to pick another option from the list the choice declares. The input side of the comparison takes a choice input and nothing else, and the line under the blocks says "A choice compares with one of its options."
On a phone
- The palette rises as a sheet from the bottom. Tap a socket to select it. Tap it again, or select Blocks on the toolbar, to open the sheet. A second tap on a bar field, an input or a name opens the sheet. Then tap a block to place it. A second tap on a number edits it in place.
- A second tap on an offset chip opens its field. A second tap on a choice chip opens its options as a sheet.
- Tap a statement's number to select the statement. Delete and Move to... then appear on the toolbar. After a Delete or a move, the line under the blocks offers Undo.
- Blocks are not dragged on a touch screen, and a long press does nothing. Tapping covers every edit.
Values, events and periods
A value, an events row and a periods row edit as blocks. A value has a socket for its expression. An events row has a socket for its condition, one for each column and one for its where test, and its label, sort and limit are options of the row. A periods row shows its clock as a chip, and the clock is picked from a list of the five periods. A column that reads a name its condition also reads is refused, and the line under the blocks says why. A column is added or removed in the code.
Not in the builder yet
Screens, sets, fields and comment rows are not in the builder yet. Parts the blocks cannot edit show as text only, with Edit in code. Make those changes in the Code tab.
Where to go next
A tour of the language covers each part of a study. Your first study walks one study from paste to chart.