MetaTrader 5 Python Kullanıcı Grubu - Metatrader'da Python nasıl kullanılır - sayfa 46

 

En azından kısaca metatrader5(5.0.21) yayınlandığını ve aşağıdakilerin değiştiğini bildirin... Ve belgeleri sıraya koyun. Birkaç gün içinde yapılacak çok fazla değişiklik yok. Yoksa her şeyi dokunarak kontrol etmeniz mi gerekiyor?

Kontrol edildi ve çalışıyor:

>>> #--lib---------------------
>>> import MetaTrader5 as mt5
>>> import time
>>> #--init----------
>>> server1 = "MetaQuotes-Demo" ; login1 = 18192632
>>> server2 = "AlpariEvrasia-MT5-Demo" ; login2 = 50468487
>>> logn = login1; server = server1 
>>> if mt5.initialize(timeout = 2000 , login = logn, server = server):
...     Acc = mt5.account_info()
... 
>>> if Acc.server != server:
...         print( "Connect server wrong" )
...         quit()
... 
>>> if Acc.login != logn:
...         print( "Connect login wrong" )
...         quit()
... 
>>> info = mt5.terminal_info()
>>> if info.trade_allowed == False:
...         print( "Auto-trading disabled in Terminal, enable it" )
...         quit()
... 
>>> print(info)
TerminalInfo(community_account=True, community_connection=True, connected=True, dlls_allowed=True, trade_allowed=True, tradeapi_disabled=False, email_enabled=False, ftp_enabled=False, notifications_enabled=False, mqid=False, build= 2340 , maxbars= 100000 , codepage= 1251 , ping_last= 72203 , community_balance= 0.1 , retransmission= 0.8130081300813009 , company= 'MetaQuotes Software Corp.' , name= 'MetaTrader 5' , language= 'Russian' , path= 'C:\\Program Files\\MetaTrader 5' , ...)
>>> if info.trade_allowed == False:
...         print( "Auto-trading disabled in Terminal, enable it" )
...         quit()
... 
>>> #--------------------------
>>> symbol = "EURGBP"
>>> timefr = 4
>>> mt5.symbol_select(symbol)
True
>>> time.sleep( 1 )
>>> #--price----------------
>>> import numpy as np
>>> import pandas as pd
>>> rates = pd.DataFrame(mt5.copy_rates_from_pos(symbol, timefr, 1 , 1000 ))
>>> print(rates)
           time     open     high  ...  tick_volume  spread  real_volume
0      1582230720    0.83800    0.83802   ...           89        5              0
1      1582230960    0.83798    0.83802   ...           99        5              0
2      1582231200    0.83788    0.83795   ...           91        5              0
3      1582231440    0.83790    0.83791   ...           39        6              0
4      1582231680    0.83788    0.83793   ...           66        5              0
..          ...      ...      ...  ...          ...     ...          ...
995    1582642560    0.83624    0.83659   ...           267        1              0
996    1582642800    0.83650    0.83650   ...           293        3              0
997    1582643040    0.83617    0.83627   ...           290        5              0
998    1582643280    0.83623    0.83636   ...           226        6              0
999    1582643520    0.83624    0.83641   ...           109        5              0

[ 1000 rows x 8 columns]

Keşfetmeye devam edelim :)

 
Vladimir Perervenko :

En azından kısaca metatrader5(5.0.21) yayınlandığını ve aşağıdakilerin değiştiğini bildirin... Ve belgeleri sıraya koyun. Birkaç gün içinde yapılacak çok fazla değişiklik yok. Yoksa her şeyi kontrol etmeniz mi gerekiyor?

MetaTrader for Python çevrimiçi belgeleri, güncellenmiş işlevlerle ilgili olarak sitede zaten mevcuttur. Her biri için örnekler gösterilmiştir.

Документация по MQL5: Интеграция / MetaTrader для Python
Документация по MQL5: Интеграция / MetaTrader для Python
  • www.mql5.com
Python является современным высокоуровневым языком программирования для разработки сценариев и приложений. Содержит множество библиотек для машинного обучения, автоматизации процессов, анализа и визуализации данных. Пакет MetaTrader для Python предназначен для...
 

Elbette onu gördüm. Belgelere göre koşuyorum

>>> #--lib---------------------
>>> import MetaTrader5 as mt5
>>> import time
>>> mt5.initialize()
True
>>> mt5.login(login = 18192632 , server = "MetaQuotes-Demo" )
RuntimeError: Invalid arguments
 

Ve bu şekilde çalışır ve bu doğru başlatmadır.

>>> mt5.initialize(timeout = 2000 , login = 18192632 , server = "MetaQuotes-Demo" )
True
>>> Acc = mt5.account_info()

Sadece belgeleri düzeltin.

 
Vladimir Perervenko :

Elbette onu gördüm. Belgelere göre koşuyorum

login - gerekli adsız parametre, login= öğesini kaldırın.

mt5.login( 18192632 , server = "MetaQuotes-Demo" )
 
Vladimir Perervenko :

Ve bu böyle çalışır ve bu doğru başlatmadır.

Sadece belgeleri düzeltin.

Açıklamayı güncelleyeceğim, gönderdiğiniz için teşekkürler.

 
Vladimir Perervenko :

Ve bu şekilde çalışır ve bu doğru başlatmadır.

Sadece belgeleri düzeltin.

Şimdi yeniden bağlanmayı denerseniz

>>> res = mt5.login(server = "AlpariEvrasia-MT5-Demo" , login = 50468487 )
RuntimeError: Invalid arguments

Genel olarak, şimdiye kadar her şey çok nemli ...

 
Vladimir Perervenko :

Şimdi yeniden bağlanmayı denerseniz

Genel olarak, şimdiye kadar her şey çok nemli ...

Diziyi Renat'ın verdiği örneklerle eşleştirin.

Ticaret, otomatik ticaret sistemleri ve ticaret stratejilerinin test edilmesi hakkında forum

MetaTrader 5 Python Kullanıcı Grubu - Metatrader'da Python nasıl kullanılır

Renat Fatkhullin , 2020.02.18 22:05

import MetaTrader5 as mt5

mt5.initialize(timeout= 10000 )
mt5.initialize(login= 25035662 , password= "oxeb7lpb" , server= "MetaQuotes-Demo" )
mt5.login( 25035662 )
mt5.login( 25035662 , timeout= 10000 )
mt5.login( 25035662 , "oxeb7lpb" )
mt5.login( 25035662 , password= "oxeb7lpb" )
mt5.login( 25035662 , password= "oxeb7lpb" , server= "MetaQuotes-Demo" )
 
Arkadaşlar artık terminalde açık pozisyonlar hakkında bilgi almanın imkansız olduğunu doğru mu anladım?
 
Rashid Zeynalov :
Arkadaşlar artık terminalde açık pozisyonlar hakkında bilgi almanın imkansız olduğunu doğru mu anladım?

Orada:

initialize(path=None)                              Establish connection with the MetaTrader 5 Terminal
wait()                                             Wait for the MetaTrader 5 Terminal to connect to a broker's server
shutdown()                                         Disconnect from the MetaTrader 5 Terminal

version ()                                          Get the MetaTrader 5 Terminal version
terminal_info()                                    Get the parameters of the MetaTrader 5 terminal
account_info()                                     Returns information of current account

copy_ticks_from(symbol, from, count, flags)                Get ticks starting from the specific date
copy_ticks_range(symbol, from, to, flags)                  Get ticks from the specified period
copy_rates_from(symbol, timeframe, from, count)            Get bars starting from the specific date
copy_rates_from_pos(symbol, timeframe, start_pos, count)   Get bars starting from the specified position
copy_rates_range(symbol, timeframe, date_from, date_to)    Get bars from the specified period

positions_total()                                          Returns the number of open positions
positions_get([symbol=\"SYMBOL\"],[ticket=TICKET])         Returns all open positions, can be filtered by symbol or ticket

orders_total()                                             Returns the number of orders
orders_get([symbol=\"SYMBOL\"],[ticket=TICKET])            Returns all orders, can be filtered by symbol or ticket

history_orders_total(from, to)                             Returns the number of orders in selected range from the history
history_orders_get(from, to)                               Returns orders in selected range from the history or filtered by position id, ticket

history_deals_total(from, to)                              Returns the number of deals in selected range from the history
history_deals_get(from, to)                                Returns deals in selected range from the history or filtered by position id, ticket

order_check(request)                                                Checks if there are enough funds to execute the required trade operation
order_send(request)                                                 Sends trade requests to a server
order_calc_margin(action, symbol, volume, price)                    Calculates the margin required for the specified order
order_calc_profit(action, symbol, volume, price_open, price_close)  Calculates the profit for the current account, in the current market conditions, based on the parameters passed

symbol_info(symbol)                                        Returns full information for a specified symbol
symbol_info_tick(symbol)                                   Returns current prices of a specified symbol
symbol_select(symbol,[enable])                             Selects a symbol in the Market Watch window or removes a symbol from the window

Belgeler henüz tamamlanmadı.

Kütüphanenin en son sürümüne güncellemeyi de unutmayın, şimdi 21:

pip install --upgrade metatrader5