1 min read

How to Get All Your Open Orders from MetaTrader 5 with Python

Learn how to get a list of all your currently open orders from MetaTrader 5, using Python 3
Cool little clockwork robot, using Sepia colors. Holds a red trading arrow.
Python Trading Bot

Python Trading Bot

If you’ve been building your own Python trading bot using MetaTrader 5 as your interface, you’ll know that there are times when you need to get all your open orders.

If you need to implement this function, here’s how.


Get Open Orders

  1. Make sure you’ve connected to MetaTrader 5
  2. Use this code:
# Function to retrieve all open orders from MT5
def get_open_orders():
    orders = MetaTrader5.orders_get()
    order_array = []
    for order in orders:
        order_array.append(order[0])
    return order_array

Say Hi!

I love hearing from my readers, so feel free to reach out. It means a ton to me when you clap for my articles or drop a friendly comment — it helps me know that my content is helping.