Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Using data from multiple symbols Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
SunriseMan
Posted : Monday, February 1, 2010 3:06:50 PM
Registered User
Joined: 11/30/2009
Posts: 29
Is there a way to create an indicator that pulls data from multiple symbols? I'm trying to create a graph based on the activity of all of the components in an index - that is, I need to be able to pull data from each of them. It's not practical to add them all onto one chart, although it would be easy to make a RealCode array with their names if that helped.

If it wrote a rule instead of an indicator, I could use static variables to accumulate the data across all of the components in the watchlist. At that point, though, I can't figure out how I could access that data from an indicator. I would have the rule write it out to a file and then have the indicator read it back in, but the VB.Net file operations seem to be disabled in RealCode.

I'm an experienced programmer, so I can handle a complex solution. I just can't figure out any workable approach..

Thanks in advance!
StockGuy
Posted : Monday, February 1, 2010 3:13:03 PM

Administration

Joined: 9/30/2004
Posts: 9,187
If we knew more about exactly what you're trying to calculate that would be helpful.  There are a couple of ways to plot list calculations. 
SunriseMan
Posted : Monday, February 1, 2010 3:25:57 PM
Registered User
Joined: 11/30/2009
Posts: 29

Let's say that I'm trying to calculate the number of Morningstar Sub-industry groups that had a day-over-day increase or decrease in the value of MACD-H, and plot two lines on the chart, one showing for each date the number of groups where MACD-H went up, the other showing for how many MACD-H went down. (If necessary, I'm certainly fine with have two separate indicators with largely redundant code to plot the two lines. I could also implement MACD-H from scratch based on price data, although I'd prefer not to! )

StockGuy
Posted : Monday, February 1, 2010 3:35:01 PM

Administration

Joined: 9/30/2004
Posts: 9,187

If you create two conditions, one for MACD moving up and one for MACD moving down, you can right click on each and select Create Market Indicator.  Choose the list you want to calculate against, then choose Count Passing and then the number of bars of history you want to calculate.

SunriseMan
Posted : Monday, February 1, 2010 4:42:43 PM
Registered User
Joined: 11/30/2009
Posts: 29
Awesome, thank you! The menu item is actually labeled "Create Custom Index," which made me think it did something different.
StockGuy
Posted : Monday, February 1, 2010 5:00:45 PM

Administration

Joined: 9/30/2004
Posts: 9,187

Terminology changed in version 5 

jas0501
Posted : Monday, February 1, 2010 5:28:44 PM
Registered User
Joined: 12/31/2005
Posts: 2,499
Market Indicators are very pwoerful and can do most of what one needs. 

For more complicated tasks in V5 there is a isListCalc and First symbol and Last Symbol detection. So if you write a realcode module and then use it as the basis for a market Indicator, while the market indicator is being calculated, that is the watchlist is being processed, IsListCalc is true. Symbol count is also avaialble so you can initialize structues on firstbar of first symbol, and track information accross all symbols. Then on the lastbar of the last symbol you can output the plot which would be the Market Indicator plot.

This approach a great for survey plots. At some point I'm hoping for multi-pass looping to permit more complicated surveys, std dev calc, correlation studies, optimization runs, etc.
SunriseMan
Posted : Monday, February 1, 2010 6:25:56 PM
Registered User
Joined: 11/30/2009
Posts: 29
I'm sorry, I need a little more help here. As I'm testing my indicators, I find that the "average number of bars since passed" type gives me very interesting results. I'm then trying to create a RealCode indicator that will import the value of my market indicator.

The problem is that, supposing my rule is named "Test", the indicator created is called "Index-Test Avg #Bars". When I try to add that indicator to my RealCode, the editor creates a line that looks like this:

'# TA# = indicator.Index-TestAvg#Bars

When I then try to use TA, I get an error that it's not declared. I've tried removing various parts of punctuation to no avail, and I can't figure out how to rename a market indicator.

For now, I am using an ugly workaround of adding a child plot which is the 1-day simple moving average. However, I'm hoping that there's a more elegant solution.
Bruce_L
Posted : Tuesday, February 2, 2010 11:38:14 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
SunriseMan,
You'll have to actually Edit the name of the Custom Index or Market Indicator to remove the # from the name (the Indicator itself - not just the reference in your RealCode). You should then be able to use it in your RealCode.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.