- ago
Is it possible that Long & Short exposures are more than the Strategy's exposure?

I asked in one of my tickets ~3 months ago, and was told, that strategy exposure at any moment = positive exposure + |negative exposure|

Moreover I'm clearly getting an unrealistic 12 061% exposure, and I have Margin Factor set to 5.00

Thank you
0
401
Solved
24 Replies

Reply

Bookmark

Sort
Cone8
 ( 2.57% )
- ago
#1
Do you have a specific example to review?
0
- ago
#2
I will try to repro.

I can't see the screenshot I should have attached. Here it is

0
- ago
#3
Just try to simply combine long and short strategies in a MetaStrategy.

Here are the default settings for a MetaStrategy:



Only Short strategy is added, everything is nice:





Let's add a long strategy:



0
- ago
#4
With addition of extra strategies (more than 2), the Maximum Exposure for Short goes through the roof (see my first screenshot)

I have 95% confidence that the long max exposure is also not correct. I exported all trades to Excel and calculated myself. I leave 5% for my mistake though.

0
- ago
#5
One extra example:



Metrics:



0
- ago
#6
Hello, have you been able to repro the issue? If not, I can provide extra details

Thank you
0
Cone8
 ( 2.57% )
- ago
#7
I have not. I think it can only be a data issue.
0
- ago
#8
It's not a data issue.

I simplified the example so it only uses SPY from WealthData (and previously it only used SPY and QQQ from WealthData)

Long strategy code:

CODE:
   public class MySimpleTestLong : UserStrategyBase    {       public MySimpleTestLong()       {       }       public override void Execute(BarHistory bars, int bar)       {          if (!HasOpenPosition(bars, PositionType.Long))             PlaceTrade(bars, TransactionType.Buy, OrderType.MarketClose);       }    }


Short strategy:

CODE:
   public class MySimpleTestShort : UserStrategyBase    {       TimeSeries sma;       public override void Initialize(BarHistory bars)       {          sma = SMA.Series(bars.Close, 200);       }       public override void Execute(BarHistory bars, int bar)       {          if (HasOpenPosition(bars, PositionType.Short))          {             if (bars.Close[bar + 1] <= bars.Close[bar])                ClosePosition(LastPosition, OrderType.MarketClose);          }                 if (!HasOpenPosition(bars, PositionType.Short))          {             if (bars.Close[bar + 1] < sma[bar + 1])                PlaceTrade(bars, TransactionType.Short, OrderType.MarketClose);          }       }    }


Combo strategy:







If I increase leverage to 3 (which should never be used, as each strategy is 100% size, the numbers get crazy:





Can you please check? If you can repro, just let me know, so I prepare a better example, although the strategies & meta are trivial
0
Cone8
 ( 2.57% )
- ago
#9
Okay, thanks. I think Max Exposure looks right for Strategy and Long Only, but you'd also expect to see Short Only closer to 100% too. We'll look into it!
0
- ago
#10
Well, the strategy exposure is 228.28% and the Margin factor is set to 2.0. So for the Strategy it doesn't look well either. Long and short enter for 100%, the largest short trade is +1.16%. So I would expect max exposure to be 200 + 1.16 = 201.16%, not 228.28%

And for shorts 982.27% is too much.

Thank you, Cone!
0
Cone8
 ( 2.57% )
- ago
#11
My first take is that it's a nonsensical metric when using the Common Capital Pool setting. The short equity curve is continually diminishing from the start, yet the size of its positions are getting larger because of the LONG equity is contributing to more and more equity. When you compare those 100% sizes to the tiny short equity curve, this is the result.

Let's see what Glitch, the MetaStrategy expert, thinks about it.
0
- ago
#12
I cut out useful code for shorts that actually earned money on backtest. With it the short equity was gradually rising. This doesn't change anything - still crazy short exposure.

Thank you, let's wait for Glitch's feedback.
0
Glitch8
 ( 6.13% )
- ago
#13
If you could email me the strategy in question I'd be happy to run it locally and can then analyze the maximum exposure (dion@wealth-lab.com.)
0
Cone8
 ( 2.57% )
- ago
#14
QUOTE:
- still crazy short exposure.
It doesn't change the point of what I'm saying. The short equity curve is still a tiny part of what's happening to the MetaStrategy and the sizes for the short positions are increasing disproportionally to the "Short Only" equity. It looks correct in my opinion.
0
- ago
#15
QUOTE:
sizes for the short positions are increasing disproportionally to the "Short Only" equity

Sorry I don't really understand why they are increasing disproportionally.

But I created a simple strategy that looks into the future. So it generates very little profit for the last 20 years.

Here is the code:

CODE:
      public override void Execute(BarHistory bars, int bar)       {          if (HasOpenPosition(bars, PositionType.Short))          {             if (bars.Close[bar + 1] <= bars.Close[bar])                ClosePosition(LastPosition, OrderType.MarketClose);          }          if (bar > bars.Count - 3)             return;                    if (!HasOpenPosition(bars, PositionType.Short))          {             //intentionally look in to the future to make profit, enter only 1 in 100 occasions             if (bars.Close[bar + 2] < bars.Close[bar + 1] && bar % 100 == 0)                PlaceTrade(bars, TransactionType.Short, OrderType.MarketClose);          }       }


The numbers for the shorts exposure are very high:

0
- ago
#16
I sent the codes to Glitch's email. Thank you
0
Cone8
 ( 2.57% )
- ago
#17
The contribution to the common equity curve is minimal for the short position, but the strategy takes larger and larger short positions because it's using 100% of the common equity. With respect to the SHORT ONLY equity, this is a massive exposure.


0
Glitch8
 ( 6.13% )
- ago
#18
Yes Pavel, I emailed you back explaining it. I know it looks weird but it’s correct.
0
Best Answer
- ago
#19
Thank you for the explanation.

As I understand it, exposure is calculated as: PositionSize / |CurrentStrategyProfit| * 100%, right? That’s why dividing 100% of the combo strategy capital by the relatively small profit of the short strategy results in such a high exposure figure.

In fact, I’ve encountered the opposite situation, where longs get XXXXX% exposure.

While I understand the math, I believe this calculation can be confusing. When profits from the long and short strategies differ significantly, the calculated exposure becomes increasingly disconnected from reality. This value I see in the ScoreCard makes me think I’m overexposed when, in fact, I’m only holding 100% size short positions. As a result, I currently need to export all trades to an Excel spreadsheet, manually calculate the total dollar exposure for each date, and then compute my true maximum exposure.

By calculating exposure as PositionSize / TotalAvailableCapital * 100%, I'm getting a more accurate view, as this method reflects the actual capital at risk instead of relying on the fluctuating profits of individual strategies. It’s a more comprehensive way to assess risk and exposure.

0
- ago
#20
QUOTE:
As a result, I currently need to export all trades to an Excel spreadsheet, manually calculate the total dollar exposure for each date, and then compute my true maximum exposure.


Excel? You can calculate all sorts of performance metrics that suit you with this extension: finantic.ScoreCard. See scriptable performance metrics.
0
- ago
#21
Hello Eugene, thank you, I will give it a try!
0
- ago
#23
QUOTE:
Excel? You can calculate all sorts of performance metrics that suit you with this extension: finantic.ScoreCard. See scriptable performance metrics.


Hello Eugene, I tried the plugin.

I wanted to calculate "adjusted" exposure: (all longs minus all shorts for the date) / totalCapital for each trading day, then find other metrics of the array: min, max, average, % less than (100%, 200%) and so on

Unfortunately, the only List<double> variables available are DailyReturns and TradeProfits arrays. So I can't extract exposure or positions by date. Something like "Percentile of returns (10, 20, 50 ...)" in InSample/OutOfSample scorecard, but for leverage.

Am I missing something? Thanks!
0
- ago
#24
Let's ask @DrKoch.
1

Reply

Bookmark

Sort