I want to trade a stock based on the ratio of two indexes (external), i.e. when it goes above sell, when it falls below buy. How do I do that?
Size:
Color:
There are numerous examples of ratio trading across published strategies, forum discussions etc. but I want to make sure we're talking about the right one. What does "external" mean? Please clarify your idea a bit to point you to a suitable example.
Size:
Color:
I'm completely new to this program, so of course I sound like a noob... I used the term external because 'external indicator' was the term I found in the program that got closest to what I want to do. So I could use the price of that one index to set buy and sell points. But I could not figure out how to set buy and sell points based on a calculated value (the ratio of two indexes).
Thanks for your help!
Size:
Color:
Size:
Color:
When you say indexes, do you mean tickers like DIA and SPY ? These 2 ETFs track the Dow Jones Industrials and S&P 500.
When you say ratio of the two, do you mean DIA divided by SPY? A ratio of these two DIA/SPY is called Price Relative. It is a form of Relative Performance or Relative Strength. It measures out-performance or under-performance of the numerator.
Plotting this ratio shows a line, if the line is moving higher, DIA is outperforming SPY. So, you would want to find an entry for DIA. For example, if the line is above an EMA of itself, then find an entry.
Is this what you are talking about?
Size:
Color:
Hi,
Is there a way to plot the DIA/SPY Price Relative in Wealth-lab just like plotting DIA or SPY? An example of this is when you plot DIAS:SPY at stockcharts.com (link:
http://stockcharts.com/h-sc/ui?s=dia%3Aspy). If yes, can you show me how? If not, can you make this plot available?
Size:
Color:
Hi Chunhua Qin,
Sure it's possible. Put DIA and SPY in a DataSet, click "Update DataSet", then execute this code via "Run the Strategy". Drag the slider on the bottomleft to change visibility:
CODE:
Please log in to see this code.
Size:
Color:
Thanks for the quick response, Eugene.
The code worked, and generated what I asked for. But a few questions:
1. The symbols are hard coded, can you modify the code, so the symbol 1 is a symbol in the DataSet shown in the left panel (e.g. QQQ), and symbol 2 can be changed as needed (e.g. SPY or IWM or something else)?
2. The current plot is not in the main panel, and not compatible with adding indicators. Anyway to modify it?
Size:
Color:
QUOTE:
1. The symbols are hard coded, can you modify the code, so the symbol 1 is a symbol in the DataSet shown in the left panel (e.g. QQQ), and symbol 2 can be changed as needed (e.g. SPY or IWM or something else)?
2. The current plot is not in the main panel, and not compatible with adding indicators. Anyway to modify it?
Well, this trickery is possible via modifying the Bars object's DataSeries:
CODE:
Please log in to see this code.
Size:
Color:
Very nice improvement. A few more questions:
1. When indicator (e.g. Bollinger band) is added, one can't switch from daily to weekly chart - has to delete the indicator to get the price plot back.
2. Using OHLC bar, you can see that the high and low may have to be redefined, otherwise, the bars are broken.
3. Because the ratio values are small, O,H,L,C are often displayed as the same value, the right side price axle needs to be 1/1000th or 1/10000th.
Size:
Color:
This is a workaround so no wonder it comes with tradeoffs. For the standard way see my post #7 above and apply indicators in code.
Size:
Color: