OpenAlgo MQL5 Functions
Below is the API documentation for the OpenAlgoAPI functions provided in your MQL5 header file:
OpenAlgoAPI Function Documentation
PlaceOrder
PlaceOrder
Places an order with the specified parameters by sending a POST request to the OpenAlgo API.
Parameters:
actionParam
: The trade action, either "BUY" or "SELL".quantityParam
: The quantity of the asset to trade.apiUrlParam
: The URL of the OpenAlgo API.apiKeyParam
: The API key for authentication with OpenAlgo.strategyParam
: The name of the trading strategy.symbolParam
: The symbol for the asset being traded.exchangeParam
: The exchange on which the trade will be executed.productParam
: The product type of the order.priceTypeParam
: The price type of the order.priceParam
(optional): The price at which to place the order.triggerPriceParam
(optional): The trigger price for stop-loss or stop-limit orders.disclosedQuantityParam
(optional): The disclosed quantity of the order.
Usage:
PlaceSmartOrder
PlaceSmartOrder
Places an order that considers the current open position size and matches the position size given in the position book.
Parameters:
Inherits all parameters from
PlaceOrder
.positionSizeParam
: The size of the position to be matched for the order.
Usage:
ModifyOrder
ModifyOrder
Modifies an existing order with new parameters.
Parameters:
Inherits all parameters from
PlaceOrder
.orderidParam
: The ID of the order to be modified.
Usage:
CancelOrder
CancelOrder
Cancels an existing order.
Parameters:
orderidParam
: The ID of the order to be canceled.apiUrlParam
: The URL of the OpenAlgo API.apiKeyParam
: The API key for authentication with OpenAlgo.strategyParam
: The name of the trading strategy.
Usage:
ClosePosition
ClosePosition
Closes all open positions associated with a given strategy.
Parameters:
apiUrlParam
: The URL of the OpenAlgo API.apiKeyParam
: The API key for authentication with OpenAlgo.strategyParam
: The name of the trading strategy to close positions for.
Usage:
CancelAllOrders
CancelAllOrders
Cancels all orders associated with a given strategy.
Parameters:
apiUrlParam
: The URL of the OpenAlgo API.apiKeyParam
: The API key for authentication with OpenAlgo.strategyParam
: The name of the trading strategy to cancel orders for.
Usage:
Note: Replace placeholder values like "your_api_key"
and "http://127.0.0.1:5000"
with actual API keys and URLs as required by your setup. All functions assume the existence of a network communication setup within the MetaTrader 5 environment, as well as an OpenAlgo API that responds to the specified endpoints. Ensure proper error handling and API rate limiting as per the service provider's specifications.
Last updated