Skip to main content

py-metatrader 0.0.1

Released: 30-May-2015

Introduction

py-metatrader is a python package that provides interfaces to metatrader4(mt4). metatrader4 is a trading platform that can automate trading(fx, stock, etc…) by your own program(ExpertAdvisor in mt4).

you can automate simuration(backtest in mt4), CI EA development , etc… by using this library.

currently works with Python 2.7.

contributing and porting is welcome.

Feature

At the moment, py-metatrader supports:

  • backtest

  • optimization

The goal of py-metatrader is to support execute all feature of metatrader4 from this library.

Installation

Install via pip:

$ pip install metatrader

Install from source:

$ git clone https://github.com/samuraitaiga/py-metatrader.git
$ cd py-metatrader
$ python setup.py install

ChangeLogs

  • 0.0.1

    • first release. backtest and optimization from python.

Usage

Backtest:

from metatrader.mt4 import initizalize
from metatrader.backtest import BackTest

# point mt4 install folder
initizalize('C:\\Program Files\\FXCM MetaTrader 4')

# specify backtest period by datetime format
from_date = datetime(2014, 9, 1)
to_date = datetime(2015, 1, 1)

ea_name = 'Moving Average'

# create ea param by dict.
param = {
         'Lots': {'value': 0.1},
         'MaximumRisk': {'value': 0.02},
         'DecreaseFactor': {'value': 3.0},
         'MovingPeriod': {'value': 12},
         'MovingShift': {'value': 6}
         }
# create backtest object
backtest = BackTest(ea_name, param, 'USDJPY', 'M5', from_date, to_date)

# run backtest
ret = backtest.run()

# you can get result from result object
# for example you can print gross profit
print ret.gross_profit

Release files for metatrader 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metatrader 0.0.1
File Size Uploaded
metatrader-0.0.1.zip 11.2 kB Details

Release files / metatrader-0.0.1.zip

Download URL metatrader-0.0.1.zip
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
859822de3daf2e3cd7ead2bed87947df5c77c1b66020210222568eca8cc4e5c2
BLAKE2b-256 checksum
How to use checksums
6569891977977dbeaa610ccc7ba12df4c808179ef0311fb563ecb73a485f9360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page