Modeling
Scripting
Chartboard supports Advisor-Modelling automation using custom python scripts.
- Scripts are based on the Python 3.8 release.
- Modelling is performed through Python extension functions.
- Chartboard Extension Classes (CBEC) available for developing custom scripts.
- Advisor-Modelling scripts exist as python files with ".pya" extension and may be exchanged as required. Scanning scripts use the ".pys" extension. Regular python scripts common to both Advisor and Scanning modes usually retain the ".pyw" extension.
- A console window may be activated from within Chartboard for monitoring and debugging scripts.
- Python scripts have duplex access back into Chartboard for data and visuals. Alternatively python may be used for forward access into 3rd Party products such as SQL databases, AI and machine learning.
- Scripts may query chart visuals and adjust processing and behavior accordingly.
- Drawing and Markup visuals may controlled from scripts.
- When Model trades are activated from a script it is deemed to be in modelling mode and separate from Portfolio trades.
- Advisor-Modelling scripts are attached to charts as required. Assigned scripts may verify suitability of the chart when activated.
- Scripts may be dragged and dropped on Charts either directly from "Windows File Explorer" or the internal "Mapped Python Scripts Explorer". Chartboard support a LOCAL script that is assigned individually to each Chart and a GLOBAL script that is common to all Charts. Once assigned such scripts can be activated from the Ribbon Bar >> [Python Tab] on an individual Chart basis.
- Download ChartboardQRCard.pdf Python Advisor quick reference card.
Chartboard Extension Classes (CBEC)
Modelling scripts are usually based on CBEC that wrap up the raw Chartboard python scripting API. Such extension classes are shipped with the Chartboard product in the PythonCBEC.pyw file. Alternatively the scripting API can be used to create an equivalent product or extend the existing. Python Advisor, Modelling and Scanner scripts share the same Chartboard Extension Classes (CBEC) with the structural difference Modelling scripts access Chartboard through CStack generated descendant classes and Scanning scripts access Chartboard as CScanner generated descendants.
Modelling and Scanning scripts are managed through the Python Scripts Map attachment explorer. Scanner scripts may only be run from scanning environments and Modelling scripts from a chart stack environment.
Sample Scripts
The following sample Python modelling scripts are shipped with Chartboard product.
-
SampleModel[MACD].pya
Modelling script for performing trades where MACD buy signal appears when the calculated MACD value < 0.0.
The modelling script generates trades that can be subsequently viewed as markups .
Debugging
Modelling scripts testing can be enhanced by activation of the Chartboard Diagnostics Console and diverting Python's stderr and stdout to such.
The Diagnostics Console can be toggled on and off via the Ribbon Bar >> [Home] tab >> [View] group >> Console check box. Should Python Scanning or Advisor-Modelling scripts be activated for multiple charts, debugging messages may be interweaved. Python scripts may be edited internally within Chartboard or externally through a 3rd party editor.
Moving the {Python Debug} >> Inspection cursor over a chart stack exposes the underlying data in python scripting format. Can be used both as a guide to accessing chart stack data from python or debugging advisor-modelling scripts.
Property Grids expose hints for those parameters accessible from automation scripts. Reference the "Property Description" region for the selected item at the base of the grid.
Manual Operation
Manual modelling of stock trades may be performed via the following sequence .
-
From
any chart context menu you
wish to manually model a trade select the
Modelling
Trade
menu item.
-
From the presented dialog configure the
modelled trade details
. . - Modelled trades can be displayed upon any Chart in the stack via the Markups >> Modelling Positions.. context menu item for most Charts in the stack.
- Modelled trades can be deleted manually from the Modelling Attachment explorer tree, selecting the Delete item from the annotated trade context menu, or using the ModelTrade.CleanupTrades() scripting utility.