LAST_ORDER_TYPE

JedeyeFX Documentation

shp.png

LAST_ORDER_TYPE

This command allows you to add restrictions to your strategy conditions regarding the type of the last order operation. It is possible to specify six different types of order operations that the last order must match: BUY, SELL, BUY_OPEN, BUY_CLOSE, SELL_OPEN and SELL_CLOSE. Note that the first two (BUY and SELL) are broader types while the remaining four are more specific and restrictive. For example, a buy operation type encompasses both BUY_OPEN and BUY_CLOSE types, thus being less restrictive. On the other hand, a buy_open is just that, an opening of a buy order.

Syntax
last_order_type(order_operation_type)
Parameters order_operation_type Order operation type that should be matched by the last order event in order to the condition be true. It can be any of these keywords: BUY, SELL, BUY_OPEN, BUY_CLOSE, SELL_OPEN or SELL_CLOSE.
BUY The last event of an order must match the opening or closing of a buy order.
SELL The last event of an order must match the opening or closing of a sell order.
BUY_OPEN The last event of an order must strictly match the opening of a buy order.
BUY_CLOSE The last event of an order must strictly match the closing of a buy order.
SELL_OPEN The last event of an order must strictly match the opening of a sell order.
SELL_CLOSE The last event of an order must strictly match the closing of a sell order.
Single-sided Yes
Notes Since this condition is single-sided you should add the exclamation mark (!) at the end or compare it with TRUE()   and FALSE()   functions.
Example iMACD(BAR)>iMACD(LINE),last_order_type(BUY_OPEN)!
This condition triggers a signal if MACD bar gets greater than its signal line while, at the same time, the last order event was the opening of a buy order.
iMACD(BAR)>iMACD(LINE),last_order_type(SELL)==TRUE()
This condition triggers a signal if MACD bar gets greater than its signal line while, at the same time, the last order event was the opening or closing of a sell order.
iMACD(BAR)>iMACD(LINE),last_order_type(SELL_CLOSE)==FALSE()
This condition triggers a signal if MACD bar gets greater than its signal line while, at the same time, the last order event was NOT the closing of a sell order.