Dear all,
I have been trading options both buying and selling call/put options on the FTSE100 reasonably successfully
I am now looking to automate my options delta hedging rather than manually do this.
My simple strategy is to sell (short) ODTE ATM call options at the open or close thereto, to profit from the max theta decay, and then turn on an auto trade with the strike price as an input, to then automatically hedge the option when the FTSE raises above the strike price and then close when the strike price is return to. I am testing at £1 per FTSE point so giving £10k of notional position and currently FTSE call are trading at 50 points a one day to expire with delta at about 0.5
I have currently created and been testing the code below however I am finding in my testing I am getting a lot of execution slippage at the strike price as the FTSE moves around it so was hoping that an expert here can advise on better code or anybody with delta hedging experience give their views and thoughts
Many Kind Thanks in Advance
Rob
———————————————————————————————-
// Allow multiple trades if true
DEFPARAM CumulateOrders = False // one position at a time
DEFPARAM FlatBefore = 080000 // optional: no constraint
DEFPARAM FlatAfter = 185959 // optional: no constraint
DEFPARAM PreLoadBars = 500
//DEFPARAM UpdateOnEveryTick = True // <-- key for "current candle" logic
// Strategy with Stop Loss and Positionsize parameters
StopLossATR = 10
//Sets the StopLoss parameter based on the ATR
Equity = STRATEGYPROFIT [1]+ 10000
//Sets the equity based on initial equity and adds the cummulative profit of the strategy
Positionsize = 1
// Calculates the positions size as a % of equity and the ATR
Margin = Positionsize *500
// Strike level of your short call on the openning strike
IF time = 080000 THEN
open0800 = open
ENDIF
strikeLevel = open0800
// =========================
// ENTRY: OPEN HEDGE ABOVE STRIKE
// =========================
// If price is above strike and we don't have a hedge on, go long
IF NOT longonmarket AND Open > strikeLevel THEN
BUY Positionsize CONTRACT AT MARKET
ENDIF
// =========================
// EXIT: CLOSE HEDGE WHEN BACK TO STRIKE
// =========================
// If we are hedged long and price comes back to or below strike, close
IF longonmarket AND open <= strikeLevel THEN
SELL Positionsize CONTRACT AT MARKET
ENDIF
Print (Equity )
Print (Positionsize)
Print (StopLossATR )
Print (Margin)
Print (strikeLevel )
Considering the spread, it would be hard to make it profitable, as basically, transaction costs are just too high for dynamic hedging.
Since you are buying and selling at the market and inside the normal trading hours, I don’t think it is slippage; it’s just that the price crosses your strike level multiple times, executing a high number of trades and bleeding transaction cost/spread
You could do two things:
1. Give away some theta premium to create a band around your open price, and you enter a hedge trade if the price is above strikeLevel+thetaband and exit at the strikeLevel+thetaband. However, I suspect you might still execute a few trades, and the spread will eat the expected profit.
2. Don’t hedge dynamically. Enter into the hedge trade opposite your short option and stay in the hedge trade until the option expires. You’ll have to find the right balance of leverage between your short options and the hedge trade. I guess this is more of a “poor man’s covered option” strategy and focuses on theta decay.
Also, one question? Why “open > StrikeLevel” and not “Close>StrikeLevel”?
Someone with more experience can clarify, but I suspect that you will check the condition in this bar and then execute at the open of the next bar. You can have some differences between the two bars open, hence some of the “slippage” you are seeing.
But if you do “Close>StrikeLevel” then the condition is checked at the close of the bar and then executed at the open of the next bar, so that between close and open of the adjacent bar you usually have less difference.
Thank you so much, really really helpful on both strategy and the code. and yes I am actually looking at also test trading “Poor man covered calls” based on the Tasty Trade information on the more efficient use of capital and deltas to use. I also see good risk mgt here from diversification view point too. Thank you again