Click here to Login





                                                   Easy way to hedge portfolio during bear markets?

  0

0
Kiran
2015-04-26 17:48:54


How do i specify in the Strategy script to buy TLT upon Bear market signal and sell upon Bull signals?
My trading system is a simple market timer with 1 symbol (SPY) as follows -

bear_signal = <some breadth indicator condition>;
bull_signal = <some other breadth indicator condition>;

buy = bull_signal;
sell = bear_signal;

Now, how do i specify to buy TLT upon bear signal and sell it upon Bull signal?

Note - The hedging money management script in http://www.quantshare.com/item-488-hedge-a-portfolio-strategy holds a constant hedge position throughout, doesn't adjust for bull/bear markets.

thanks
Kiran





QuantShare
2015-04-27 03:54:33

  0

- You need to create a long/short trading system
- Create the "short" and "cover" variables (like the buy/sell)
- Use "stringequal" function to know which symbol is analyzed

Example:
isTLT = stringequal(name(), "tlt");
short = iff(isTLT, bear_signal, 0);
cover = iff(isTLT, bull_signal, 0);



Kiran
2015-04-27 12:58:54

  0

The logic is Buy TLT (not Short) during Bear markets. I tried the following simple system (with symbols SPY and TLT) but it holds SPY throughout - doesn't execute the Buy/Sell. Is there something wrong in having 2 Buy statements in the same script?
What could be the issue?

rsiUp = comp(1, "count", 1, rsi(close,14)>70,"SP500");
rsiDn = comp(1, "count", 1, rsi(close,14)<30,"SP500");

bull = rsiUp>rsiDn;
bear = rsiDn>rsiUp;
isSPY = stringequal(name(), "SPY");
isTLT = stringequal(name(), "TLT");

buy = iff(isTLT,bear,0);
buy = iff(isSPY,bull,0);
sell = iff(isSPY,bear,0);
sell = iff(isTLT,bull,0);



QuantShare
2015-04-28 03:27:49

  0

This was just an example.

In your formula, you are overriding the "buy" and "sell" rules.
Plot them on a chart to see (without using the "comp" function).

It should be:
buy = iff(isTLT,bear,0);
buy = iff(isSPY,bull,buy);
sell = iff(isSPY,bear,0);
sell = iff(isTLT,bull,sell);



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Hedge a portfolio strategy
Bear Put Spread
Permanent Portfolio Timing Active Rebalance V0.1
Correlation To Portfolio
Updating Margin Factor During Drawdown

How-to Lessons
How to quickly add several positions to your portfolio
How to add trades from one portfolio to another one
How to import trades into a portfolio
How to get trading orders from a portfolio programmatically
How to create a strategy-based portfolio

Related Forum Threads
C# Easy way to see if symbol exists?
Access the equity value of the portfolio from the simulator
New Financial Asset called DARWIN (i.e. portfolio of trading syst...
How to plot custom portfolio
PORTFOLIO

Blog Posts
Diversify your portfolio by investing in stocks from various indu...
A simple but useful way to display distances in a chart
6 ideas to implement in your portfolio to reduce your trading ris...
How to combine long, short and custom portfolio strategies within...
True portfolio simulation applied to trading systems









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.