2.7.2Order-type helper functions

The framework provides a range of functions for helping to work with orderType values. For example:

var oppositeType = FXB.OrderTypes.Invert(FXB.OrderTypes.BUY_STOP);

FXB.OrderTypes.

Helper function

IsLong(x)

Tests whether the orderType represents a long order or trade (is one of BUY, BUY_LIMIT, BUY_STOP, BUY_STOP_LIMIT)

IsShort(x)

Tests whether the orderType represents a short order or trade (is one of SELL, SELL_LIMIT, SELL_STOP, SELL_STOP_LIMIT)

IsMarket(x)

Tests whether the orderType represents a trade rather than pending order (is one of BUY, SELL)

IsPending(x)

Tests whether the orderType represents a pending order rather than a trade (is one of BUY_LIMIT, BUY_STOP, SELL_LIMIT, SELL_STOP, BUY_STOP_LIMIT, SELL_STOP_LIMIT)

IsLimit(x)

Tests whether the orderType represents a limit pending order (is one of BUY_LIMIT, SELL_LIMIT)

IsStop(x)

Tests whether the orderType represents a limit pending order (is one of BUY_STOP, SELL_STOP)

IsStopLimit(x)

Tests whether the orderType represents a stop-limit pending order (is one of BUY_STOP_LIMIT, SELL_STOP_LIMIT)

IsCredit(x)

Tests whether the orderType represents a credit movement rather than an order or trade

Invert(x)

Inverts the order-type. For example, Invert(FXB.OrderTypes.BUY) = FXB.OrderTypes.SELL, and Invert(FXB.OrderTypes.SELL_LIMIT) = FXB.OrderTypes.BUY_STOP