How to use custom fields in charts and strategies?
Author: wbzhang
Creation Date: 9/15/2010 9:32 PM
profile picture

wbzhang

#1
Hello, I just started to use Wealth-lab recently, and have questions how to refer custom fields...

For example, I can import historical data with "Data Manager->ASCII file...".
Unlike traditional day bar, I created three custom fields (Freq, Pos, and Neg), and the can be imported successfully from Data Manager.

Date,Open,High,Low,Close,Volume,Freq,Pos,Neg
2010-08-17,53.96,54.84,53.96,54.55,2473400,0,2,2
2010-08-16,53.03,53.61,52.74,53.52,1962100,4,0,17
2010-08-13,52.16,53.83,52.16,53.42,2389100,0,0,2
2010-08-12,52.03,53.06,51.75,52.97,2713500,0,0,2
2010-08-11,53.57,53.70,52.42,52.43,1797000,4,0,2

However I have problems while I was trying to use these custom fields.
1) While I create new chart, the plot only show open/close/high/low/volume. I have no idea how to view the custom fields in chart(or table). Any solutions?

2)How to use the additional fields in strategy code? For example, I can use "Close[bar]" to refer Close, but "Freq[bar]" is invalid. Any ideas?

3)By the way, I also tried to edit the bar (imported from ASCII files), but the chart told me "Bar Data Editor is not available for this chart". What's the problem?

Thanks for your response.
profile picture

Eugene

#2
Hello,

1 - Custom series are not plotted on the OHLC chart therefore you have to use the standard PlotSeries method.

2 - Before using (p.1 and 2), you need to check if the custom series exists (see HasNamedDataSeries in the QuickRef, hit F11 to invoke) and then define it using FindNamedSeries (check the QuickRef example.)

3 - The ASCII provider doesn't support editing bar data. Use a text editor to load and edit ASCII files. Keep in mind that your changes will be lost the very next time your ASCII data is updated.
profile picture

wbzhang

#3
Thank you for your response. I still have problems for 2).

I use below code:
CODE:
Please log in to see this code.


It told me the bars contain 4 named series. But I don't know what the 4 named series are. How to find them out?

The strange things is, It seems all the 9 named series are imported successfully. But I cannot even find "Close" series with below code:

CODE:
Please log in to see this code.


While I use Close[bar], the result seems fine. No ideal what is happening...

profile picture

Eugene

#4
No need to bother with the Close as it's already there, just define the rest of them right after checking:
CODE:
Please log in to see this code.

Note: case-sensitive.
profile picture

wbzhang

#5
Thanks.

Now I found I can use below code to find out these named series:

CODE:
Please log in to see this code.


For me, they are:
AdjClose
Freq
Pos
Neg

Then I can use Bars.FindNamedSeries( "Freq" ) to refer these data series. thanks!
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).