Exposure is less than expected with SetContext
Author: kbellare
Creation Date: 2/15/2016 4:41 PM
profile picture

kbellare

#1
I have a Relative Strength strategy that buys the ETF from a data-set of 24 ETFs if the ETF has relative strength compared to SPY, else buys SPY in its position (using SetContext/RestoreContext).
- Position is sold after 20 days.
- Position size is 10% of Equity (so, 10 positions). Capital is $100K, 1:1 Margin.

I'm seeing 2 strange behaviors

1) Only 7-8 positions are held instead of 10 (as i observe positions in the Portfolio Inspector tab). As a result, my exposure is only 69% instead of ~100% - Buy code below ..
CODE:
Please log in to see this code.




2) If i add a Position Priority (i.e. uncomment the BuyAtClose statement in the code above), SPY is never bought - i don't see SPY in Trades tab, Symbol tab, Portfolio Inspector tab and # of Trades and Exposure also go down.
i.e. the SetContext/RestoreContext doesnt seem to work.

Pl advise how to address these two issues
profile picture

Eugene

#2
1) This is the key:
QUOTE:
- Position size is 10% of Equity (so, 10 positions). Capital is $100K, 1:1 Margin.

It's rarely possible to take 10% * 10 positions and thus utilize 100% capital. To achieve that you either have to allow for a leeway or use some tricks (bump up margin, use PosSizer etc.) It's been discussed dozens of times so here's the FAQ:

I'm using 100% Equity position sizing and strategy doesn't seem to use all capital and/or there are trades not included due to insufficient capital.

2) Add a debug output of the priority value to the Debug window or via AnnotateBar etc. and compare it to other Position.Priority values.
profile picture

Cone

#3
Re:
QUOTE:
If i add a Position Priority (i.e. uncomment the BuyAtClose statement in the code above), SPY is never bought

Uncommenting BuyAtClose (which one?) does not "add Position Priority". It's not clear what are you trying to convey with that statement.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).