With a few configuration changes you can get desktop charting in LEAN with a HTML5 interface very similar to the one you see in QuantConnect.com. This gives you better visual feedback on your strategy and allows you to improve faster. This tutorial guides you through configuring a desktop charting environment with LEAN.

Local charting (and all local backtesting) requires you to have your own source of data. We provide a way to download FX and CFD data through our API. To get started make sure you have your data in your data folder. By default this is the /Data/ directory relative to your LEAN installation.

Two configuration changes are required for desktop charting to work:

  1. Change the “environment” field to use “backtesting-desktop”. This instructs LEAN to use the configuration settings block at the bottom of the config file.
      "environment": "backtesting-desktop",
  2. Insert your API token and user id into configuration file. This is required for chart streaming.
      // To get your api access token go to quantconnect.com/account
      "job-user-id": "....",
      "api-access-token": "...........",

With those changes in place you can simply run the project and your backtesting chart will appear in a few seconds. For live trading; use the”live-desktop” configuration environment.

If you get the run-time exception “The port configured in config.json is either being used or blocked by a firewall”- This normally means you’ve left the user interface open (you should close it between each run). It can also be because another program is sharing that port. You can fix this by changing the port LEAN transmits the data with the "desktop-http-port" setting.

In the tutorial video below we demonstrate this feature on LEAN:

Sign In to comment in this post.