← Back to X_TRADER® Help Library

#### Formula Building Blocks

In addition to the standard mathematical operations, the Hedge Rule Builder provides the following special actions that take into account whether the hedge order is a Buy or a Sell order.

 Action Description Automatically adds or subtracts expression values, as follows:+ For buy hedge orders, - for sell hedge orders+ For sell hedge orders, - for buy hedge orders Automatically uses greater/less than comparisons for expression values, as follows:> For buy hedge orders, < for sell hedge orders> For sell hedge orders, < for buy hedge orders

To illustrate, suppose you want to re-price a hedge order if the price of the working hedge order is too far away from the inside market. Instead of writing separate rules for Buy and Sell orders, you can use these Buy/Sell operators to handle both types of orders. In the following example, you want to take action when the price of the working hedge order is six or more price levels away from the same-side inside market.

Hedge Rule Builder window

If the hedge leg is a Buy order, the +/- operator causes the rule to look at the inside market price on the Bid side and subtracts 5 from the price; for a Sell order, it looks at the inside market on the Ask side and adds 5 to the price. Then the rule uses the >/< operator to compare the expression and determine whether to pay up 3 ticks if this adjusted price is greater than five price levels away from the inside Bid price or inside Ask price.

#### Hedge Leg Fields

The following table lists the information of an order you can use to trigger a rule.

 Field Description AskPrc Inside market Ask price AskQty Inside market Ask quantity BidPrc Inside market Bid price BidQty Inside market Bid quantity DiffQty Total quantity of working orders at the opposite inside market minus the quantity starting at the level of the working hedge orderNote: Refer to Understanding Pre and Post Hedge Rules when using this field in Pre or Post Hedge rules. HedgePrc Price of the working hedge order HedgeWorkingQty Total quantity of all the hedge orders from the same spread order working at the same price level LTP Last traded price LTQ Last traded quantity MinimumPriceIncrement The minimum tradable price increment for the leg. OppositePrc Inside market price opposite the working hedge order OppositeQty Inside market quantity opposite the working hedge order QtyRatio Ratio of orders between the working hedge order and the opposite inside marketNote: Refer to Understanding Pre and Post Hedge Rules when using this field in Pre or Post Hedge rules. SameSidePrc Inside market price on the same side as the working hedge order SameSideQty Inside market quantity on the same side as the working hedge order TicksAway Positive number of price levels necessary to completely fill the working hedge order

#### Available Actions

The following table describes the actions a triggered rule can take.

 Action Description Payup Converts the price of a working hedge order to a price specified by the number of positive or negative payup ticks.You can also specify a number of times to repeat the payup action if the order is not completely filled and is still working, as long as the rule evaluates to true. For example, if a rule includes a Time trigger set to 10000 ms with a payup action for one tick and a repeat value of three, the working hedge order pays up one tick every ten seconds for a total of three times unless the order completely fills. Fill Cancels w/Limit the working hedge order and sends limit order at a price sufficient to fill the entire working quantity. Cross Cancels Inside the working hedge order and sends a limit order to cross at the best bid or ask price. Join Cancels Best the working hedge order and sends a limit order at the same side best inside price or an offset of the best inside price.The Join Best offset defines the price levels from the best inside market: Positive offsets are price levels away from the best inside market and negative offsets are price levels better than the best inside market. Notify Provides visual and audio clues to alert you that a rule triggered. DoNotHedge No hedge orders will be sent upon quoting order fills. When Do Not Hedge is used, a synthetic spread price will not be generated upon completion of the spread order. SendMarketOrder Sends a Market Order for the hedge rather than a Limit order.