 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Format of the OrderClosePrice() function:
double OrderClosePrice()
The OrderClosePrice() function returns the closing price of an order or position selected by the OrderSelect() function.
Let’s consider an example of usage of the OrderClosePrice() function. Suppose we know that a position closed by an order and we need to determine by what order: Stop Loss or Take Profit:
//---- select order/position with ticker 77777
if ( OrderSelect (77777, SELECT_BY_TICKET) == true)
{
// position was selected successfully
if ( OrderClosePrice() == OrderStopLoss() )
{
// position closed by Stop Loss
// ...
}
else
{
// position closed by Take Profit
// ...
}
}
else
Print("OrderSelect() returned error - ",GetLastError());
Unfortunately our example will work only in cases when Stop Loss worked out without slippage. In the following article we will complicate this example and we’ll do so that even if orders were worked out with slippage our portion of the code will detect it properly.
Next article: " OrderStopLoss function"
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
+7 (495) 710-76-76
|
© 1998—2008 «Alpari» |
|