Skip to content
A collection of Metatrader 4 and R scripts
Branch: master
Clone or download


Type Name Latest commit message Commit time
Failed to load latest commit information.
R-knitr 0.9.0 Automated an include file "mt4Rmonte.mqh" for a Monte Carlo Ana… May 1, 2013
R-shiny-01 1.0.2 Modified script to work with a major revision of PlusLotto 1.0.… Dec 3, 2012
R-shiny-02 1.0.1 Fixed some minor bugs when loading the file and tweaked the gra… Nov 26, 2012
R-source 0.9.3 Added function MtrAv0() and parameter Rsourcedir in function Mt… May 1, 2013
R-test-03 1.0.0 This script perform unit tests on functions in PlusPdf.R. Nov 23, 2012
R-test-04 1.0.1 Added test_that() for function lottoArimaConfZooDfr(). Dec 3, 2012
R-test-05 1.0.0 This script perform unit tests on functions in PlusMonte.R. Dec 11, 2012
R-test-06-Rtt 1.0.0 This script performs unit tests on functions in library "PlusRt… Mar 10, 2013
R-test-07-job 1.0.1 The saved CSV files have been deprecated, and replaced by RDA f… Mar 24, 2013
R-test-08-bscd 1.0.0 This script perform unit tests on functions in PlusBscd.R. Adde… Apr 6, 2013
R-test 1.0.1 Added a test for ONE (1) function MtrLookupJFun(). Apr 28, 2013
experts 1.0.1 Add extern MaxAccountTrades, this works with orderSendReliable(). Dec 12, 2012
include 1.0.3 Added externs DoNotBuyGreedy and DoNotSellGreedy for a slightly… Dec 21, 2012
indicators Added new CumulantRatio indicator. Oct 31, 2019
presets 1.00 Cointegration AUD, CAD, EUR, USD, base 1000, Lot 0.1, MaxAccount… Dec 8, 2012
scripts 1.0.1 Additional test on the parameters DoNotBuyGreedy and DoNotSellG… Dec 21, 2012 Added new CumulantRatio indicator. Oct 31, 2019


GitHub repo size GitHub language count GitHub top language GitHub last commit GitHub stars GitHub forks GitHub watchers GitHub followers

A collection of Metatrader 4 ["MT4"] and R scripts

About FX-Git

This project was created by me because projects created by either Software Geeks or Financial Gurus are mutually exclusive.

As both a Software Geek and Financial Guru, I mixed them up by writing codes about finance related stuff.

About Me

Software Geek

Started as a hobbyist, studied computer engineering as a degree, then worked as a full-time software engineer, and a freelance programmer.

Accounting / Financial Perfectionist

Studied accounting as a master degree, worked as a research analyst & fund manager, and a cashflow accounting perfectionist.

Trading Maestro

Started as a hobbyist, and maintains an open-source repository of trading indicators and advisors.

Passionate Learner

Dabbled in email marketing, and new to full-stack development.

What To Do Next

This collection has grown relatively large over time, and some of these scripts are course related.

Eventually, I will be moving some of these course related scripts to separate GitHub repositories.

The core scripts will remain in this repository.


This collection of scripts was written using either MT4 or R.

  • Metatrader 4 ["MT4"] client and demo account with any broker.

  • R and RStudio

Project Structure

 FX-Git/                  <-- Root of this project
   +- experts/            <-- Holds any MT4 Expert Advisors ["EA"]
   +- include/            <-- Holds any MT4 Include Files
   +- indicators/         <-- Holds any MT4 Indicators
   +- presets/            <-- Holds any MT4 Preset Files
   +- scripts/            <-- Holds any MT4 Script Files
   +- R-knitr/            <-- R Markdown documentation for R-source
   +- R-shiny01/          <-- R-shiny Example 1
   +- R-shiny02/          <-- R-shiny Example 2
   +- R-source/           <-- Holds any R scripts
   +- R-test/             <-- R Unit Tests for PlusMtr.R, PlusMtrGhost.R, PlusFile.R
   +- R-test-03/          <-- R Unit Test for PlusPdf.R
   +- R-test-04/          <-- R Unit Test for PlusLotto.R
   +- R-test-05/          <-- R Unit Test for PlusMonte.R
   +- R-test-06-Rtt/      <-- R Unit Test for PlusRtt.R
   +- R-test-07-job/      <-- R Unit Test for PlusJob.R
   +- R-test-08-bscd/     <-- R Unit Test for PlusBscd.R

MT4 Packages

  1. Ghost Package - Paper trading module in Metatrader 4.

MT4 Indicators

  1. Cumulant Ratio Indicator - A Digital Signal Processing indicator in Metatrader 4.


Add more documentation for MT4 Packages, Expert Advisors, and Indicators.

YouTube Channel

I made videos on some MT4 scripts below:

Dennis Lee's YouTube Channel

Example Usage

In the following example, the default application will be created in the folder myproject/.

 $ git clone myproject

Reach Out!

Please consider giving this repository a star on GitHub.

You can’t perform that action at this time.