Estimated reading time: 1 min

Coding Your Algorithm

When it becomes available, the MachinaTrader Dashboard will allow you to write code in project files and then press the Build button to compile your algorithm. Build errors will be displayed in the console and highlighted for your attention.

You can add, rename, and delete files in your project in the Projects tab.

Core Methods

The bare minimum to run an algorithm is your initialization and data event methods.

public class BasicTemplateAlgorithm : MEAlgorithm
    public override void Initialize()
        // Setup algorithm requirements: cash, dates and securities.
        // Initialize is called once at the start of the algorithm.

    public override void OnData(Slice data)
        // Data requested is then piped into event handlers like this one.

class BasicTemplateAlgorithm(MEAlgorithm):

    def Initialize(self):
        """ Initialise the data and resolution required,
            as well as the cash and start-end dates for your algorithm.
            All algorithms must initialized."""

    def OnData(self, data):
        """ OnData event is the primary entry point for your algorithm.
            Each new data point will be pumped in here.
            data: Slice object keyed by symbol containing the stock data."""
MachinaTrader Development Dashboard (Beta)
MachinaTrader Backtesting and Coding Environment

Backtesting Your Algorithm

Once you’ve got an algorithm compiling, you can click the Play button to launch a backtest. Results are shown in the Result drop-down menu. Backtesting in parallel is limited to fair usage for each user and may be reduced when it affects others in the community.

Running backtests is summarized on the terminal homepage and can be canceled from there to make room for other backtests.

Was this article helpful?
Dislike 0
Views: 157