Ivyware Chartboard Python advisors Python 3.11 · *.pya Melbourne, AU
Ivyware

Ivyware/Chartboard/Advisors

Embedded Python

Scripts that can see the chart they run on

Chartboard ships with an embedded Python 3.11 interpreter. Advisor scripts have duplex access — they read the chart's data and visuals, and they draw back onto it. Assign a script, run it from the ribbon, and watch the console while it works.

Scripting

  • Scripts are based on the Python 3.11 release that ships with the product.
  • Duplex interaction is provided by an extensive set of Python extension functions.
  • Chartboard Extension Classes (CBEC) are available for developing proprietary scripts.
  • Advisor scripts are disk files with the .pya extension and may be exchanged freely. Scanning scripts use .pys; regular Python modules common to both usually keep the standard .pyw extension.
  • A console window can be activated from inside Chartboard for monitoring and debugging.
  • Python has duplex access back into Chartboard for data and visuals. It can equally be used for forward access into third-party products — SQL databases, AI and machine learning.
  • Scripts may query chart visuals and adjust their processing and behaviour accordingly.
  • Drawing and mark-up visuals can be controlled from scripts.
  • Model trades may be activated from scripts.
  • Advisor scripts are attached to charts as required, and an assigned script may verify the chart's suitability when activated.

Scripts may be dragged and dropped onto charts, either from Windows File Explorer or from the internal Mapped Python Scripts Explorer. Chartboard supports a LOCAL script assigned individually to each chart and a GLOBAL script common to all charts. Once assigned, they are activated from Ribbon Bar → [Python] tab on an individual chart basis.

Chartboard Extension Classes

Advisor scripts are usually built on CBEC, which wraps the raw Chartboard Python scripting API. These foundation classes ship with the product in PythonCBEC.pyw. Alternatively the scripting API can be used directly to create an equivalent library, or to extend the existing one.

Advisor and scanning scripts share the same extension class libraries, with one structural difference:

Advisor scripts
Access Chartboard as CStack-generated descendant classes. They may only run from a chart stack environment.
Scanner scripts
Access Chartboard as CScanner-generated descendants. They may only run from a scan environment.

Both are managed through the Python Scripts Map attachment explorer.

If scripts will not run at all, check that Chartboard is not running elevated. It has no need for administrator privileges, and disables Python scripting entirely when it detects them. The other cause is the Python 3.11 runtime not being found — it ships with the installer, so this normally means a partial install.

Scripts execute with your privileges and can reach outside Chartboard, so accept .pya, .pys and .pyw files only from sources you trust.

Debugging

Advisor script testing is much easier with the application console active and Python's stderr and stdout diverted to it.

  • Toggle the console via Ribbon Bar → [Home] tab → [View] group → Console. Note that if scripts are active on multiple charts, their debug messages will interleave.
  • Python scripts may be edited inside Chartboard or externally in a third-party editor.
  • Moving the {Python Debug} → Inspection cursor over a chart stack exposes the underlying data in Python scripting format — usable both as a guide to reaching chart data from Python and as a debugging aid.
  • Property grids expose hints for the parameters reachable from automation scripts; look at the Property Description region at the base of the grid for the selected item.
The Chartboard diagnostics console showing Python stdout and stderr output alongside a chart.
The diagnostics console, with Python output redirected into it.

Sample scripts

The following sample advisor scripts are supported by the Chartboard product.

Advisor samples (.pya)

Sample[MACD]-[RSI]-[ADX].pya

Generates buy shading signals using the MACD, RSI and ADX charts and data series.

Advisor
Trade[RSI]-[Reversal-ENGULFING].pya

Illustrates using engulfing reversal candlesticks together with the RSI data series to generate buy and sell shading signals.

Advisor
Sample[Aroon].pya

Highlights overbought and oversold zones using the Aroon indicator.

Advisor
SampleModel[MACD].pya

Modelling script that performs trades where the MACD buy signal appears while the calculated MACD value is below zero. Generated trades can then be viewed as mark-ups.

Modelling

Strategy samples

Two further advisor strategies ship with the product. Both model trades on the OHLC chart stacks they run over, for the active period, annotate the trades on the chart, and present results in the grid properties window.

Crossover[Aroon]Strategy.pya
Uses Aroon indicator crossovers — robo buy/sell signals — to model trades for the active monthly, weekly or daily period.
Swapover[SAR]Strategy.pya
Uses Parabolic SAR swapovers to model trades for the active weekly or daily period.
Sample workspace showing the Aroon crossover strategy with modelled trades annotated on the chart.
Crossover[Aroon]StrategyModelled trades annotated on the OHLC stack, results in the properties grid.
Sample workspace showing the Parabolic SAR swapover strategy with modelled trades annotated on the chart.
Swapover[SAR]StrategyParabolic SAR swapovers driving the modelled trade sequence.

Scanning uses the same interpreter and the same extension classes from the other end — see stock scanning. For trades produced by scripts, see trade modelling.