Connect GitHub with AgenaTrader

To use scripts from our GitHub project you have two options:

  1. Manual download the source files to your local directories
  2. Clone the GitHub project and link the scripts to your AgenaTrader directory (our recommendation)

Manual download to your local AgenaTrader directory

Of course this is easy to do and pretty straight forward if you just want to test AgenaScript for your stock trading.
The main disadvantage is that your local files will not update, if we modify scripts on our GitHub project!

Clone GitHub project and link to your AgenaTrader

This is our recommendation because if you clone a GitHub repository to your local computer you will automatically get the latest updates from the GitHub repository straight into your AgenaTrader. This is easy and you will receive AgenaScript updates immediately after you click on the sync button in your GitHub Desktop client.

Install GitHub client

If you want to stay up to date and always get the latest updates you need to download the GitHub desktop client (of course you can use any other Git client). Afterwards you are able to clone our GitHub project to your local AgenaTrader workspace using the GitHub client.

Follow this guide to download the GitHub Desktop application for your operating system. After the installation you are ready to clone your first GitHub repository.

The following checklist will help you do to this:

  1. Sign in to GitHub and GitHub Desktop before you start to clone an AgenaScript repository.
  2. On GitHub, navigate to the main page of the AgenaScript repository.
  3. Under the repository name click clone or download.
  4. Click Open in Desktop to clone the repository and open it in GitHub Desktop.
  5. In GitHub Desktop please verifying the name and location on your local drive where you would like to clone the repository. In the end click on the clone button.

Detailed description how to clone a repository from GitHub using command line.

Linking scripts directly into AgenaTrader

Now we need to link the files from our local GitHub workspace into the local AgenaTrader directories. In Linux this would be pretty easy using symbolic linking command, but also on Windows there is a solution for this! We can use mklink to work for us.

Have a look at this mklink guide

The stock trading scripts in AgenaScript language must be placed inside the following three AgenaTrader directories:

  • indicator => ‘[… path to your AgenaTrader User directory …]\AgenaTrader\UserCode\Indicators\’
  • condition => ‘[… path to your AgenaTrader User directory …]\AgenaTrader\UserCode\ScriptedConditions\’
  • strategy => ‘[… path to your AgenaTrader User directory …]\AgenaTrader\UserCode\Strategies\’

The following examples will show you how to link files into AgenaTrader using mklink on command line:

mklink /d “C:\AgenaTrader\UserCode\Indicators\github_indicator” “C:\Github\AgenaTrader\Indicator”
mklink /d “C:\AgenaTrader\UserCode\ScriptedConditions\github_condition” “C:\Github\AgenaTrader\Condition”
mklink /d “C:\AgenaTrader\UserCode\Strategies\github_strategy” “C:\Github\AgenaTrader\Strategy”

Many of our AgenaScript indicators do need our global utility class. Your need also to link this folder, into the AgenaTrader indicator directory:

mklink /d “C:\AgenaTrader\UserCode\Indicators\github_utility” “C:\Github\AgenaTrader\Utility”

Please pay attention you MUST run mklink in ADMINISTRATOR mode!