Order Operations β Overview¶
This section groups together methods for managing orders: creating, modifying, closing, deleting, and retrieving their details. Itβs the practical toolkit for working with active and historical trades.
π Methods in this Section¶
-
ShowOrderSendExample.md
Example of placing a new order. -
ShowOrderModifyExample.md
Example of updating SL/TP or other order parameters. -
ShowOpenedOrders.md
Get full details of all currently opened orders. -
ShowOpenedOrderTickets.md
Stream only the ticket IDs of active orders. -
ShowOrderCloseExample.md
Standard order close example by ticket. -
ShowOrderCloseByExample.md
Demonstrates closing one order against another (CloseBy). -
ShowOrderDeleteExample.md
Example of deleting a pending order. -
ShowOrdersHistory.md
Retrieve closed trades within a selected date range.
β‘ Example Workflow¶
// Example: lifecycle of an order
// 1. Place an order (via Send) -> returns ticket
ticket := 123456
// 2. Modify order parameters (SL/TP)
svc.ShowOrderModifyExample(ctx, ticket)
// 3. Monitor open orders
svc.ShowOpenedOrders(ctx)
// 4. Option A: Close directly
svc.ShowOrderCloseExample(ctx, ticket)
// 5. Option B: Use CloseBy to offset positions
svc.ShowOrderCloseByExample(ctx, ticket)
// 6. Review historical performance
svc.ShowOrdersHistory(ctx)
β Best Practices¶
- Always fetch OpenedOrders before attempting modifications/closures.
- Use
ShowOrderModifyExampleinstead of re-sending orders for SL/TP updates. - Delete pending orders you no longer need to keep account clean.
- Store historical results using
ShowOrdersHistoryfor analytics and compliance.
π― Purpose¶
The methods in this section are for full lifecycle management of trades:
- Open β Modify β Monitor β Close/Delete β Audit.
- Simplifies automation logic.
- Ensures robust error handling for every order action.
π Use this overview as a map and follow links to each .md file for complete details.