Click here to Login





                                                   HEDGED Strategies

  0

0
Jaime Mauro
2018-01-08 15:32:07


Good Day,

Can you suggest a way to design a strategy, that could dynamically hedge based on signals the strategy generates?

For example, I want to buy stocks if they went up by a certain percentage today. I either want to buy the close of the trigger day(pct performance threshhold is met today therefore I buy today OR
I may decide instead to buy TOMORROW's open). However, whatever capital is generated for these BUYS----which will vary each day----must be matched with an equal amount of SHORT
capital in symbol SPY, at same time as BUY occurs.

Suggestions?

Thank you.

JM



QuantShare
2018-01-09 04:53:14

  0

Hi,

You need to use a money management script for this. Here is an example that you can download, check and update. Note that this requires some basic C# knowledge.

Hedge a portfolio strategy





Hedge a portfolio strategy (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

Jaime Mauro
2018-01-09 10:16:56

  0

Thank you kindly for the script! I will examine, but am no C# expert. Is there a quick and dirty way to get it to rebalance on a DAILY basis??


QuantShare
2018-01-10 08:31:03

  0

Are you referring to the hedge?


Jaime Mauro
2018-01-10 09:17:47

  0

Yes....referring to the hedge. If I have a strategy that buys tomorrow's open for example and sells tomorrow's close, the capital invested for those trades(assume all long), is matched by some percent of that capital in the hedge, call it SPY. Next open I have new signals and new trades for the day. I'd like the SPY hedge to be rebalanced based on the amount of capital I have in for the NEW day. Will that work with this script? Documentation indicates it may only do that rebalancing on a weekly or monthly basis.

Thank you for your consideration.



QuantShare
2018-01-11 03:37:27

  0

You will need to edit the money management script. That one will rebalance on monthly basis.
If you want to rebalance daily for example, you can replace the code before #functions" line in the "OnEndPeriod" event and put this instead:

// Adjust hedge position
double longshort = (double)Variables.GetVariable("Long (1) or Short (0)");
if(longshort == 1)
{
AdjustPosition(false, Orders, Functions);
}
else
{
AdjustPosition(true, Orders, Functions);
}



Jaime Mauro
2018-01-11 10:51:09

  0

Very interesting, but wouldn't I need to adjust all of the MONTH variables to DAY or something as well?? I just leave all those variables under section // Track changes in month as MONTH??

Thanks.



Jaime Mauro
2018-01-11 11:06:46

  0

Also, when I ran my first test using this money management script as written, it NEVER rebalances, monthly or otherwise. I have a long strategy and set to symbol SPY and 100% of equity, then toggled the long/short switch first LONG, then SHORT and did separate backtests. Script looks like it initiates the hedge at the beginning of whatever date range I have and keeps it on for the full duration of that date range.


QuantShare
2018-01-12 03:18:41

  0

Yes, the script does not work exactly the way you want it to work.
You need to create your own script or you can hire one of our programmers to implement this script for you. You can send an email to support and we will send you a quote.



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
Rebalance & Combine & backtest two trading strategies
Design and backtest a trading system with two strategies
Sharpe Ratio Ranking System to Lower Trading Strategies Volatilit...
Market Timing Rules - Used to construct profitable trading strate...
Hedge a portfolio strategy

How-to Lessons
How to import trading items from other accounts
How to synchronize stock charts?
How to run QuantShare offline
How to display notes/commentaries on a chart
How to get stocks for a particular index using the global script

Related Forum Threads
Uncorrelated/Low Correlation Strategies in Meta Strategy
Import equity curve and backtest equity curve trading strategies
All my screeners and strategies disapeared??!
Exit function in Strategies
Rotation of strategies based on their performance

Blog Posts
Running QuantShare on Amazon's EC2 Cloud & Automate Strategies Si...
How to combine long, short and custom portfolio strategies within...
Several money management strategies in a trading system
Intermarket Analysis - Correlation and Trading Strategies
Backtesting trading strategies using intraday data









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.