Click here for the source code of a sample application which listens for Stock Watch Pro messages and prints out order details. It registers to listen for SWP_ORDER messages using RegisterWindowMessage() and processes them in OnOrderMessage() handler. The order string is passed as an atom in wp parameter of OnOrderMessage() handler. It is retrieved using GlobalGetAtomName() and then parsed to retrieve the order info. The order string consists of field=value pairs separated by semicolons. Here is a table of fields and their common values:
| Field | Description | Values |
|---|---|---|
| Symbol | Symbol for which the order was initiated | any string |
| Action | Whether buying or selling | Buy, BuyCover, Sell, SellShort |
| Qty | Number of shares | any number |
| Order | Order type | Market, Limit, Stop, StopLimit, FOK (Fill or Kill), any string |
| Price | Order price | any double |
| Route | Order routing | Default, SOES, SelectNet, ECN, any string |
| MM | Market Maker or ECN | any string |
| Expire | When the order expires | Day, GTC (Good till cancelled), any string |
| StopLimit | Stop limit price (optional) | any double |
Examples:
An order can be initiated using one of the following methods:
To enable API messages, go to the Trading tab of Preferences dialog (click on Edit --> Preferences) and select API from the dropdown list. Click on Settings button to configure API options: