Skip to content

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


⚑ 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

  1. Always fetch OpenedOrders before attempting modifications/closures.
  2. Use ShowOrderModifyExample instead of re-sending orders for SL/TP updates.
  3. Delete pending orders you no longer need to keep account clean.
  4. Store historical results using ShowOrdersHistory for 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.