Table of Content

Recap
The big transformation: Futures trading
Why bother futures trading
Isn't futures trading risky?
Calculating position size
Calculating position size for spot
Leverage
Margin
Liquidations
Calculating PNL - Point- & Tickvalues
The thing about leverage
But we'd also win it back using leverage
How much leverage is ok to use?
Just don't use leverage
More Futures Trading Specifics
Rolling
Backadjusting
Free Panama Backadjustment Script


Recap

In our previous Issue we re-iterated the importance of putting things (our returns) into context by shining a light on why EQ and Drawdown curves alone might not be the best way to evaluate the performance of a strategy.


Although I firmly believe this to be true, I feel the need to address some things here: EQ and Drawdown curves are not worthless! Even though they are one-sided performance metrics, they still hold lots of useful information, specifically about the behaviour of the strategies returns over time. It's possible to gain insights about your signals strength and decay and if they're even statistically relevant. More experienced quants might even be able to tell what exact strategy you're running and why the curve has formed the way it has just by eyeballing it.


These curves are not really part of this weeks discussion though. For now we're just going to acknowledge that they are useful and include them in our backtest reports.


The big transformation: Futures trading

I think it's time!


We've established a very solid foundation about the concepts of risk and reward in trading over the course of the last few weeks and learned how to construct a minimal but very insightful backtest report.


We're ready to transform our spot only strategy into a futures trading strategy. If you're one of those people that thinks "Futures trading is way too risky and just like gambling" bare with us for just a few. We're going to shed some light on why this is actually not true and what benefits it holds to transition into futures trading.


Why bother futures trading

Using futures as your primary trading vehicle offers a great deal of advantages for your trading business.


First of all, you can short! If you were restricted to only trading spot/shares, the only thing you could do on a bearish forecast is to sell the shares you already own. There's no more gains for you to be had by doing this other than not taking your shares through a drawdown. Limiting your downside by selling is nice, but it would be even nicer to profit more off of it. Short-selling enables us to do so!


Second, depending on the assets you trade, there's a clear distinction between the instruments you choose to do so! Some of them are going to be traded through a broker while futures are traded through an exchange using direct to market orders. The difference here is your counterparty on the other end of the contract.


Even big brokerage firms have gone broke in the past and usually don't have some kind of clearing house behind them. This means that when shit hits the fan, you most likely going to end up losing all the capital you've desposited with your broker and even if they're able to recover it, it's probably going to take decades.


Exchanges on the other hand are much safer in that regard because they are accompanied by externally regulated and regularly audited clearing houses.


Another good reason to use futures (or any other leveraged product really) is the concept of leverage. It lets you take on big positions with smaller capital so you don't need to upfront that much yourself. If this is really a good thing and how much leverage you should be using is a big part of this weeks discussion.


Since futures embed their costs into the contracts prices, most funding spreads are eliminated, so transaction costs are usually much lower using futures in comparison to other vehicles. On the other hand they require more capital to be able to trade them so there's a tradeoff.


The last benefit we want to highlight is the sheer diversity of futures markets. No matter what you want to trade, there's probably some kind of futures contract for it out there somwhere.


Isn't futures trading risky?

That's a pretty broad statement. I don't agree, generally.


It's true that leverage can lead to disaster quick when used wrong. But does that make leverage itself risky?


Is a pencil dangerous?


Most people would probably respond with a clear no. Would it be dangerous if I'd ram it through your eye? Sort of.. yeah. It wasn't really the pencil that brought the danger into the situation but the activity I chose to do with it.


So in my mind it's more about the activity and not the tool!


Futures themselves are not risky. It's what you do with it that can become risky real quick as we will see in the next few sections.


Let's take a closer look at what I mean:


Calculating position size

The calculation for your position size is quite different for futures than for spot. There are more variables to what makes up the notional exposure of your position. We're going to use Bitcoin Micro Futures (MBT) on Interactive Brokers as an example.


We can calculate our position size by using the formula:


Notional Exposure=No. of Contracts×Current Price×Point Value\text{Notional Exposure} = \text{No. of Contracts} \times \text{Current Price} \times \text{Point Value}


Assuming we're buying 1 contract, we still need 2 more inputs for our formula: Current Price and the Point Value of the contract we're trading. In this case, we can just pull the information from Barchart.com: https://www.barchart.com/futures/quotes/BA*0/profile


mbt_contract_specifications_barchart.png


The ones we're after are Value of One Futures Unit, which is just the monetary value of a 1 Point move and the Price shown in the upper left. If you can't find the Point Value, you can always calculate it yourself by dividing the Tick Value by the Tick Size. Those 2 are pretty much always given:


Point Value=Tick Value÷Tick Size\text{Point Value} = \text{Tick Value} \div \text{Tick Size}


The Barchart table for MBT shows 1 tick is 5 points, worth $0.50 per contract.


Point Value=$0.5÷5=$0.1\text{Point Value} = \text{\$0.5} \div \text{5} = \text{\$0.1}


Let's calculate our notional exposure for buying 1 contract worth of MBT. Price is currently at $91,440 but let's round it to $90,000 to make the example calculations easier.


Notional Exposure=1×$90,000×$0.1\text{Notional Exposure} = \text{1} \times \text{\$90,000} \times \text{\$0.1}

Notional Exposure=$9,000\text{Notional Exposure} = \text{\$9,000}


This makes sense, the Barchart table is showing us a value of 0.1 BTC per contract under Contract Size.


Calculating position size for spot

Calculating your position size for spot is very simple, you just need to multiply the amount of spot units bought by the assets current price:


Spot Exposure=1×$90,000\text{Spot Exposure} = \text{1} \times \text{\$90,000}


To make comparison easier, we're going to buy 10 contracts of MBT instead of just one:


Notional Exposure=10×$90,000×$0.1\text{Notional Exposure} = \text{10} \times \text{\$90,000} \times \text{\$0.1}

Notional Exposure=$90,000\text{Notional Exposure} = \text{\$90,000}


We're now taking on the same notional position in futures that we did with spot. So what's actually different other than the more complicated calculation?


Leverage

The thing about futures is, they allow you to use leverage. Leverage is enabling us to multiply our trading capital by a factor we choose up to a limit our broker sets for us.


We could actually buy this 10 contracts with just $18,000 or even less in capital depending on your broker instead of putting up the full $90,000 for spot.


Should we do this? Well.. Let's have a closer look at the concepts around leverage.


Margin

Margin is the capital needed to open a leveraged trade. It acts as collateral covering potential losses of your broker when loaning you money. It is commonly quoted as a percentage, leverage possible or just in monetary terms and can be different for each contract.


Example: Your broker requires 20% margin. If you want to trade $90,000 you need to deposit at least


Margin=$90,000×0.20=$18,000\text{Margin} = \text{\$90,000} \times \text{0.20} = \text{\$18,000}


The leverage possible will be


Margin=1÷18,00090,000=5\text{Margin} = \text{1} \div {\frac{18,000}{90,000}} = \text{5}


Whenever you fall below the required margin, you're going to get Margin Called by your broker, which is them saying "we can't loan you any money anymore because you're not safe enough to loan money to" but giving you the chance to deposit more so you're good again.


Liquidations

If you fail to deposit more and continue to not meet their margin requirements, your broker is going to automatically close your position to cover their risk. Their risk is really the key part here. They're not interested in giving you a good price or decent fees. They just want to close that position as quickly as possible even if it might impose more losses on you.


If this on its own isn't enough reason for you to avoid getting liquidated, remember how earlier in the series we've established that we needed to play the dice game long enough to realize our true EV.


If we get liquidated, we can't play anymore and will be stuck in the drawdown forever!


Theoretically it is possible to go negative on your balance when the asset moves very rapidly or gaps up/down before your broker had the chance to liquidate you making you lose even more than your initial investment. Today there are rules that protect most (retail) traders from dipping into negative balances.


You need to research the instruments you trade and broker/exchange in your juristriction thoroughly to find out if you are protected or not.
(Or just not use leverage like a maniac)


Calculating PNL - Point- & Tickvalues

Calculating your PNL is a also a little different for futures than for spot due to the contract unit and leverage involved. But it's not that hard:


If BTC moves 1% from $90,000 to $90,900 you'd think that you'd make 1% of profit just like buying 1 spot unit, right?


No!


Leverage multiplies both losses and gains on your initial capital (margin).
Your PNL is calculated on your notional exposure, not your margin!


If you use 5x leverage a 1% move in your direction yields 5% gain on your margin.


Since we bought 10 contracts our notional exposure is $90,000.


After the 1 % price move, our notional exposure is:


Notional Exposure=$90,000+$90,000×0.01\text{Notional Exposure} = \text{\$90,000} + \text{\$90,000} \times \text{0.01}

Notional Exposure=$90,900\text{Notional Exposure} = \text{\$90,900}


If you were to sell now, your profit would be the current price - entry price


PNL=$90,900$90,000\text{PNL} = \text{\$90,900} - \text{\$90,000}

PNL=$900\text{PNL} = \text{\$900}


But you didn't actually buy it with $90,000, you bought it for $18,000 using x5 leverage. Your realized profit is not 1% but 5%:


PNL%=$900÷$18,000\text{PNL\%} = \text{\$900} \div \text{\$18,000} PNL%=0.05\text{PNL\%} = \text{0.05}


Great, isn't it?


The thing about leverage

Magnifying returns looks great! But what about losses?


What if BTC dumped 10% instead?


Notional Exposure=$90,000$90,000×0.1\text{Notional Exposure} = \text{\$90,000} - \text{\$90,000} \times \text{0.1}

Notional Exposure=$81,000\text{Notional Exposure} = \text{\$81,000}


PNL%=-$9000÷$18,000\text{PNL\%} = \text{-\$9000} \div \text{\$18,000} PNL%=0.5\text{PNL\%} = \text{0.5}


Your PNL is -$9,000. You just lost 50% of your magin!


This is problematic! Other than the fact that you'd now need a 100% return to recover that 50% loss to breakeven you're also breaching the margin requirements quite a bit!


Leverage=Notional Exposure÷Margin\text{Leverage} = \text{Notional Exposure} \div \text{Margin}

Leverage=$81,000÷$9,000\text{Leverage} = \text{\$81,000} \div \text{\$9,000}

Leverage=9\text{Leverage} = \text{9}


You're using x9 leverage, posting $9,000 as collateral for a position of $81,000 which equates to


Margin%=1÷9\text{Margin\%} = \text{1} \div \text{9} Margin%=0.11\text{Margin\%} = \text{0.11}


but your broker requires at least 20%.


You're going to get margin called and if you fail to deposit more even liquidated.


margin_call_phone.jpg


But we'd also win it back using leverage

It's true that our returns are also multiplied, so you might think that this cancels out over the long run. Before we take a look at some conrete examples of leverage used over time, just think about this again:


If you lose 50% of a $10,000 bankroll, you're left with $5,000.
You don't need to win back 50% to breakeven but win back 100%!


Gaining 50% of $5,000 would only bring you back up to $7,500, which would still leave you in a 25% drawdown.


Now, let's have a closer look at some common leverage levels advertised by different brokers and how they affect our capital based on some random distribution of returns:


Leverage 1 5 10 20 50
Bankroll $10,000 $10,000 $10,000 $10,000 $10,000
+10% $11,000 $15,000 $20,000 $30,000 $60,000
- 10% $9,900 $7,500 $0 $0 $0
+ 5% $10,395 $9,375 $0 $0 $0
-5% $9,848 $7,031 $0 $0 $0
-20% $7,878 $0 $0 $0 $0

As you can see, the x10, x20, x50 all didn't take long to reach an account value of $0 (or less). The x5 leverage column took longer but got there eventually while als0 underperforming the x1 column anyway.


More volatility would only add more fuel to the fire and make you burn out even quicker.


How much leverage is ok to use?

There are lots of different techniques to estimate the 'correc' amount of leverage of which only one or two should actually be taken into consideration. Namely the Kelly Criterion and Half-Kelly Betting, which feature a well defined "optimal sizing" bracket.


Kelly_betting_there_be_dragons.jpg


Graphic taken from Nick Yoder


We're going to have a look at why this makes sense in a later issue. Because there is an better technique for beginners!


Just don't use leverage

Yeah, you read that right. Don't use leverage at all. Just bet with the money you have as before. Or even better, just use half of your margin! If you have a $20,000 bankroll, only trade with $10,000 using x0.5 leverage.


Although this might put you in a tough spot instrument-choice wise depending on the size your bankroll, it is the absolutely recommended way for beginners. Your chances of ever getting margin called are virtually zero!


More Futures Trading Specifics

I think we're done with the math side of things for now. This issue so far should have made clear how it can hold more risk to trade futures using leverage instead of just trading spot.


Before we end this weeks discussion, I feel like there are still some futures trading specific things worth addressing:


Rolling

A kind of weird concept about futures trading is that you're not trading the underlying asset itself but betting money on a contract that locks in its price. These contracts expire at some point and losses/gains are being realized if you like it or not.


You might be thinking "wait a minute, if my trade is currently underwater and it forces me to close my position, I booked a loss" and that's true for the most part. Luckily though there are always more contracts available and when one closes, you can just enter your trade in another one and handle it like a normal drawdown.


This is called rolling. Rolling your position over from one contract to another one.


There's actually a lot that goes into rolling and you can even build full trading strategies around it to capure spreads between the contracts, carry, etc. but this doesn't concern us right now.


For now it's enough to just know that we have to search for a new home after our old one burned up.


Backadjusting

Rolling leads us to another "problem": The prices of different contracts usually don't line up all that well.


mbt_futures_expiring_price_gaps.png


This can have all sorts of reasons and we'll talk about them in future issues in detail more.


What interests us right now is that we have to deal with these price differences in some way when backtesting. To get a continuous price series for our contracts just like with spot, we have to stitch the different contracts together. Otherwise we would end up with - depending on the instrument - just a few months or even days of price data for each contract.


And we don't want that. We're always looking for 10+ years of daily EOD price data for our strategies to make them more statistically significant.


We could just use spot prices for the asset in question but that's not really the price we're trading, so if we can, we want to be as accurate as possible and use the actual futures contract prices.


The process of stitching them together is called adjusting. Just like the dividend and split adjustments, we're going to calculate the difference between the contracts and add it to all other prices in our series.


There's a multitude of different adjusting techniques with the probably most simple one being panama backadjusting. When panama backadjusting the last known contract - your current trading contract - is taken as the true price and all subsequent prices get adjusted by its difference to the earlier contracts in succession to eliminate price jumps.


Free Panama Backadjustment Script

As part of a follower milestone appreciations we published a free python panama backadjusting script including example data for ZC Corn Futures. You can find it in this GitHub Repository.


It works with EOD TradingView exported .csv data but can be extended to work with any csv that contains daily close prices. You can specify which contracts to roll into and how many days before maturity you want to roll:


roll_frequencies = { 'MES': {'roll_month_codes': ['H', 'M', 'U', 'Z'], 'roll_t_d': 3}, #3 days before epxiration 'ZC': {'roll_month_codes': ['Z'], 'roll_t_d': 30}, }

Usage is printed when running the script:

Usage python panama_badj.py --trade_into_backmonth [True/False] --plot [True/False]

If you have any questions or find bugs, let us know!

- Hōrōshi バガボンド