LAST_ORDER

JedeyeFX Documentation

shp.png

LAST_ORDER

This function allows accessing to the latest order event properties. With it you can extract order properties like the open price, close price and profit. By “latest order event”, it does not necessarily means that it is the event that triggered the latest order opening. It can be a previous event since you can use some selectors to define which order event should be considered the last. For instance, say you want to get the profit of the latest closed sell order. The following command will extract this value: last_order(SELL,PROFIT,CLOSED). Then you can use it to check, for example, if this order was profitable: last_order(SELL,PROFIT,CLOSED)>VAL(0). In case you omit the last parameter, which is optional, no distinguish will be made between open or closed orders. Thus, the latest sell order, no matter if it is a currently active one or not, will be selected and its value extracted.
 

Syntax
last_order(order_type;order_property;order_event)
Parameters order_type Defines what is the order type of the one you want to get the values from. Only BUY or SELL keywords are accepted.
BUY Buy order type.
SELL Sell order type.
order_property Sets the order property you want to get from the selected latest order accordingly to the function parameters.
OPEN_PRICE Open Price of the selected order.
CLOSE_PRICE Close Price of the selected order.
PROFIT Profit of the selected order.
order_event
(optional)
Determines whether the selection of the latest order should consider if it is an opened order or a closed one. When this parameter is not set, this distinction is not made, meaning the selected order can be a open one or an already closed one.
Single-sided No
Notes It should be noted that the order_event parameter set along with the CLOSE_PRICE property should be used with caution. It should be obvious that it is impossible to get the close_price of an order that is still open.
Example last_order(SELL,PROFIT,CLOSED)>VAL(0)
This example checks if the latest closed sell order was profitable.
last_order(BUY,OPEN_PRICE)>VAL(1.3450)
This example checks if the latest buy order (no matter if it is still open or not) open price is greater than 1.3450.