Finding out if an order has closed...

How to create strategies and indicators
Message
Author
User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

Finding out if an order has closed...

#1 Postby Tantalus » Tue Nov 20, 2007 2:17 pm

Hey, Mike...

If I open an order and set a StopLoss or TakeProfit, the order will be closed by the server automatically, without my strategy being notified that it has closed. If I want to know whether the order is closed or not, I think I need to poll the OpenOrders to find out, but I can't seem to make that work.

If I say SelectOrder(Handle, SELECT_BY_TICKET, MODE_TRADES);
then what result will I expect for OrderType if the selected order has already been closed?

I think you understand what I'm trying to achieve.. maybe you could toss me some code that will let me find out if a particular order is still open, if I already know the Ticket number.

Thanks.

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Finding out if an order has closed...

#2 Postby Terranin » Tue Nov 20, 2007 3:24 pm

Tantalus wrote:Hey, Mike...

If I open an order and set a StopLoss or TakeProfit, the order will be closed by the server automatically, without my strategy being notified that it has closed. If I want to know whether the order is closed or not, I think I need to poll the OpenOrders to find out, but I can't seem to make that work.

If I say SelectOrder(Handle, SELECT_BY_TICKET, MODE_TRADES);
then what result will I expect for OrderType if the selected order has already been closed?

I think you understand what I'm trying to achieve.. maybe you could toss me some code that will let me find out if a particular order is still open, if I already know the Ticket number.

Thanks.


There is a function for this case - OrderClosed(ticket)
Hasta la vista
Mike

User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

#3 Postby Tantalus » Tue Nov 20, 2007 3:35 pm

Now I REALLY feel stupid... :oops:

But please tell me.. what is the definition of 'true' and 'false' in Delphi?

In VB, you can just say If X is False Then...

In Delphi, do you have to test for it numerically? For instance,

if x = 1 then // if x is true
if x = 0 then // if x is false

Tnx.

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#4 Postby Terranin » Tue Nov 20, 2007 4:03 pm

Tantalus wrote:Now I REALLY feel stupid... :oops:

But please tell me.. what is the definition of 'true' and 'false' in Delphi?

In VB, you can just say If X is False Then...

In Delphi, do you have to test for it numerically? For instance,

if x = 1 then // if x is true
if x = 0 then // if x is false

Tnx.


:)

True or false is just a result of boolean operation. For example x = 1 will be true in case when variable x takes value of 1. If x is 2 then (x = 1) will return value false.

Operator if works like this: if true then we do something, if false then we do not do anything.

if x = 1 then tada;

x =
0 - ...
1 - tada!
2 - ...
3 - ...
...
Hasta la vista

Mike


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 14 guests