AlphaChart

AlphaScript Limits and safety

Limits and safety

A script works on the chart’s bars and nothing else. These rules keep AlphaChart fast and your account safe, whatever a script does.

What a script cannot do

  • Reach the page, the browser, your account or your settings.
  • Use the network: no requests, no sockets, no downloads.
  • Read or write files, or use the device (camera, clipboard, storage).
  • Start timers or run in the background.
  • See the future: x[n] only looks back, and a bar sees only itself and the bars before it.

This holds in every language: a script is read and run by AlphaChart’s own script engine, and no part of it is ever handed to the browser to run as code.

Limits of a run

WhatLimit
Script length100,000 characters
Work per run60 million steps (loop rounds and calls)
Time per run2.5 seconds
Calls inside calls100
Items in a list100,000
Characters in a text10,000
Plots, levels and backgrounds64
Inputs64
Fills32
Labels, lines, boxes500 each (the oldest go first)
Marks10,000
Console lines kept500
Scripts per account200

A script that reaches a limit stops with a message saying which one and on which line, and the chart keeps whatever it drew up to that bar.

Values that cannot be worked out

Dividing by zero, the average of too few bars, a value from before the first bar: all give na (missing), not an error. A plot simply has no value on those bars.

Alerts

Script alerts come from scripts on a chart that is open in a browser tab: the chart works them out on your device as new prices arrive. When no tab is open, scripts raise no alerts.

Not advice

Indicators you write show what your code computes. Nothing a script draws or says is investment advice, from you or from AlphaChart.