Option Combos

The following functions can be used for handling combinations of options, such as Straddles, Strangles, Condors, Butterflies, etc. Option combos are mainly used for limiting risk. For an introduction to options trading, see Financial Hacker. The image below shows the profit or loss of an Iron Condor combo dependent of the underlying price, at expiration (blue) and halfway to expiration (red). 

Iron Condor profit/loss curve (OptionsCurve.c)


combo (CONTRACT* C1, int N1, CONTRACT* C2, int N2, CONTRACT* C3, int N3, CONTRACT* C4, int N4): int

Combines up to 4 option contracts C1..C4 to a combo. The number and trade direction of contracts are given by N1..N4; use negative numbers for selling and positive numbers for buying that contract, f.i. -2 for short selling two contracts. Use 0 for not used contracts. Returns the number of combo legs, i.e. the number of different contracts of the combo. If any CONTRACT* pointer is zero, but the associated number N is nonzero, it deletes the combo and returns 0. Source code in contract.c.

comboAdd (CONTRACT* C, int N): int

Adds an option contract C to the current combo. The number and trade direction of the contracts is given by N; use a negative number for selling and a positive number for buying that contract. Returns the number of the current combo leg. If C is 0, it deletes all contracts from the combo and returns 0.

comboLegs (): int

Returns the number of legs of the current combo defined with the combo() function.

comboLeg (int Leg): int

Selects the contract of the combo leg with the given number (1..4), and returns the number assigned to that contract as defined in the combo() function. The number is negative for selling and positive for buying, so it can be directly used for the Lots parameter passed to enterLong

comboStrike (int Leg): var

Returns the strike value of the given combo Leg (1..4). Source code in contract.c.

comboRisk (): var

Returns the maximum risk of the current combo. Source code in contract.c.


C1..C4 CONTRACT* pointer for leg 1..4, or 0 when the leg is not used in the combo.
N1..N4 Number of contracts for leg 1..4, negative for selling and positive for buying contracts. 0 when the leg is not used in the combo.
Leg Number of the combo leg, 1..4, starting with 1 for the first contract.


Example (see also Workshop 8):

  0,0,0,0)) // Strangle combo

See also:

contract, contract variables, Workshop 8


► latest version online