Get Last Candlestick Info on MetaTrader5 and PYMT5ADAPTER python libraries

ultrachihuahua
8
ultrachihuahua  

Hi,


I am a seasoned python programmer but a novice in all things FOREX and MT5.  

I am trying to create a program to log the last closing position in an array for the purpose of creating an SMA and EMA indicator.

How can I access the last "CANDLESTICK" data that just immediately occurred (within seconds) and be able to see the CLOSING, HIGH and LOW using the python 'MetaTrader5' library?


NOTE:

If someone knows the answer as to how to do this on PYMT5ADAPTER library as well i would thank you for your response as I may be transitioning to this library.



Best Regards,

ultrachihuahua
8
ultrachihuahua  
ultrachihuahua:

Hi,


I am a seasoned python programmer but a novice in all things FOREX and MT5.  

I am trying to create a program to log the last closing position in an array for the purpose of creating an SMA and EMA indicator.

How can I access the last "CANDLESTICK" data that just immediately occurred (within seconds) and be able to see the CLOSING, HIGH and LOW using the python 'MetaTrader5' library?


NOTE:

If someone knows the answer as to how to do this on PYMT5ADAPTER library as well i would thank you for your response as I may be transitioning to this library.



Best Regards,

Hey guys, Thanks but i found my answer in the following

https://www.mql5.com/en/docs/integration/python_metatrader5/mt5copyratesfrompos_py

as such here is the line of code needed for the last candle position


mt5.copy_rates_from_pos(symbol_str, mt5.TIMEFRAME_M1, 01)
Documentation on MQL5: Integration / MetaTrader for Python / copy_rates_from_pos
Documentation on MQL5: Integration / MetaTrader for Python / copy_rates_from_pos
  • www.mql5.com
copy_rates_from_pos - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5