Skip to main content

MT5pytrader

Project description

MT5pytrader

A trading assistant for seamless trade execution on MT5 platform

Build Status

MT5pytrader is an MT5-based module for seamless trade execution. It is d

Features

  • Functions:
      connect() - Connects to a specified account 
      open_buy() - Open a buy position 
      open_sell() - Open a sell position 
      close_buy() - close a buy position using the symbol or ticket_id
      close_sell() - Close a sell position using the symbol or ticket_id
      open_buy_limit() - Open a buy limit
      open_sell_limit() - Open a sell limit
      close_partial_buy() - Close a percentage of an open buy position(partial close)
      close_partial_sell() - Close a percentage of an open sell position(partial close)
      modify_sl() - Modify Stop loss of a position using the symbol or ticket_id
      modify_tp() - Modify Take profit of a position using the symbol or ticket_id
      get_open_positions() - Returns a list of all open position as a pandas Dataframe
      running_profit() - Returns the cummulative sum of all runnig trades (profit/loss)
      break_even() - Break even on a trade position running in profit
    

Installation

Install the dependencies and devDependencies and start the server.

pip install MT5pytrader
#### Dependence
Please install the latest version of MetaTrader5 and numpy
```sh
pip install --upgrade numpy
pip install MetraTrader5

Usage

>>> from MT5pytrader import Trader

#instantiate 
>>> trader = Trader()

Connect to a specified account
>>> trader.connect(account, password, server) 

open a buy position
>>> trader.open_buy(symbol:str, lot:int = 0.1, stop_loss:int = None, take_profit:int = None, magic:int = 260000, comment:str = "MT5pytrader")

#open buy position on GBPUSD with 1.0lot size and 200points stop loss with no take profit
>>> trader.open_buy(symbol = "GBPUSD", lot = 1.0, sl = 200) 
    
open a sell position
>>> trader.open_sell(symbol:str, lot:int = 0.1, stop_loss:int = None, take_profit:int = None, magic:int = 260000, comment:str = "MT5pytrader")

#open sell position on CADJPY with 0.5 lot size and 150points take profit with no stop loss 
>>> trader.open_sell(symbol = "CADJPY", lot = 0.5, tp = 150) 

Development

MT5pytrader is in active development.

Want to contribute? Great! Please contact me via email with your ideas.

License

MIT

Free Software, Enjoy and Feedback!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MT5pytrader-0.61.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file MT5pytrader-0.61.tar.gz.

File metadata

  • Download URL: MT5pytrader-0.61.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for MT5pytrader-0.61.tar.gz
Algorithm Hash digest
SHA256 d1c75ec42bc5106eee74c489e397f17c78edb3ddbbdd57fb7cbb21fe59b057dc
MD5 ae48e2cba0327c5b32b6f873b14a29a3
BLAKE2b-256 f2d266763f70bb26ecb132c81781e1ceec04ebb7cd60ea21a101edbbf9455a72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page