This does not seem to be working out. I am not sure the CONTRACT is correctly selected for a trade and maybe missing some other required logic such as described in the help files for contract()
contract (int Type, int Expiry, var Strike): CONTRACT*
Selects the option or future contract from the current option chain that matches exactly the given Type, Expiry date, and Strike value. Returns a CONTRACT pointer to the found contract, or 0 when no such contract was found. If a contract is selected, enterLong and enterShort will buy or write (sell short) the contract instead of the underlying asset. The function sets up ContractStrike, ContractExpiry and other contract variables, and sets ContractRow to the row of the selected contract in the historical dataset or in the options chain. Calling asset(), contractUpdate(), or contract(0,0,0) deselects the contract and allows again trading with the underlying.
From the log files the trade does not look like it is updating the underlying price. In addition the option should have expired OTM with the profit of the premium. Not sure where +55.99 is coming from.
[SPY::SP12304] Write 1 Put 20120217 134.0 100@7.05 Unl 127.53 at 15:40:00
...
[164: Fri 12-03-02 15:40] 10056 0 1/0 (137.33)
[SPY::SP12304] Expired ITM 1 Put 20120217 134.0 100@127.53: +55.99