Metatrader library for python
Project description
EAMetatrader
Metatrader library for python powered by MtApi
This library currently only supports MetaTrader 4
Installation
- Install the library with the
pip install EAMetatrader
command - Copy and run the
MtApi.ex4
file in MetaTrader software - Set up a
port
in Expert and Application for network connection - and over
Required libraries
from EAMetatrader import MT4Client,Color
from EAMetatrader.Enums import *
import datetime
Connection
client = MT4Client(True)
client.Connect(8222)
Copy Rates
start = datetime.datetime(2021,3,16)
end = datetime.datetime(2021,3,1)
mqlrate = client.CopyRates("EURUSD",ENUM_TIMEFRAMES.PERIOD_H1,start,end)
print(mqlrate.Time(2))
Indicators
Symbol = "EURUSD"
Timeframe = 60
Period = 14
Appliedprice = 0 #Close
Shift = 0
RSI = client.iRSI(Symbol,Timeframe,Period,Appliedprice,Shift)
Send Order
Lot = 0.01
Price = 1.18
SL = 1.17800
TP = 1.18400
Slippage = 5
Comment = "EAMT"
Magic = 2222
Expiration = datetime.datetime(2021,3,25)
color = Color()
Order = client.OrderSend("EURUSD",TradeOperation.OP_BUY,Lot,Price,Slippage,SL,TP,Comment,Magic,Expiration,color.Green())
TODO
- Debug some functions
- Write MT5Client class
- Development of functions for working with artificial intelligence
Issues
If you have a question or want to report a bug, send it in this section
My social medias
Donating
Bitcoin: 1LsuAxGGdfH43YpgSjY8CSZdX45r4BE4jx
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
EAMetatrader-1.0.4.tar.gz
(867.9 kB
view hashes)