Documentation for OrderHandle, Magic Number, etc.? Help with OCO order

Examples step by step how to make your own automated strategy or user indicator
Message
Author
ProfPeanuts
Posts: 3
Joined: Mon Dec 07, 2020 8:58 pm

Documentation for OrderHandle, Magic Number, etc.? Help with OCO order

#1 Postby ProfPeanuts » Thu Dec 10, 2020 2:05 am

I am new at programming. I want to enter a buy stop and a sell stop at the same time every day, and close one as soon as the other gets triggered. So I am trying to create an EA with one-cancels-the-other order functionality. Since OCO is a common feature, is there Delphi code for this already available?

I reviewed the forums, the APIs and the Help feature in FT4. There is virtually no information about things like OrderHandle. When orders are placed, I assume an OrderHandle is created? Is OrderHandle one variable that is constantly updated, or is there a list of OrderHandles accumulating somewhere that I can reference?

Can the Magic Number field in a SendPendingOrder function create a Magic Number that has characters in addition to numbers? Can the Magic Number be a number plus the dd:mm:yyyy that the order is placed?

When a pending order is triggered, what happens? An overview of how orders and open trades are logged and referred to would be extremely helpful. Thanks.

ProfPeanuts
Posts: 3
Joined: Mon Dec 07, 2020 8:58 pm

Re: Documentation for OrderHandle, Magic Number, etc.? Help with OCO order

#2 Postby ProfPeanuts » Thu Dec 24, 2020 9:53 pm

For posterity: look at the documentation for SendPendingOrder and SendInstant Order. These functions return (1) True or False, AND (2) the OrderHandle. If you run one of these functions, and then set a variable := OrderHandle, that is how you can save the OrderHandle for future reference. The OrderHandle is sometimes referred to as the "ticket" in the documentation.

You should also read the documentation for OrderSelect. You can OrderSelect an order by the OrderHandle to manipulate it.

Also FYI: Stop and Limit orders are classified as "buy" and "sell" type orders once they are triggered.


Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 11 guests