Strategies that trade two stocks in the same direction in variable proportion
Author: rmandel00
Creation Date: 3/7/2015 9:02 AM
profile picture


I am interested in a strategy that chooses to go long two different stocks at the same time but in a fixed proportion. I would choose that proportion from the maximum combined Sharpe ratio as calculated in the most previous interval. So for example, If the combined Sharpe ratio for the previous month of stock A and B is maximizal at 50% I would trade the two at that proportion for the following month.

This program will have several parts to it, first of how to trade two stocks in a fixed proportion, then how to calculate the Sharpe ratio for the previous month at say (0 to 100% for stock A at 10% intervals). Any help on this problem would be most appreciated.
Rich Man
profile picture


Calculating the Sharpe ratio would be the hardest part. As to the other parts:

1 - On choosing different stocks at the same time, check out SetContext in the QuickRef, DataSeries > Accessing Secondary Symbols in the WealthScript Programming Guide, and downloadable strategies inside the "Intermarket" folder (make sure to have downloaded all publicly available strategies first). There are numerous examples, strategies (e.g. "Inverse ETF Switching system") and pointers on the forum and in the Wiki.

2 - To control the proportion, you can call SetShareSize.
profile picture


Thanks Eugene, I'll give it a try.
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).