Multiple lines from custom function?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dave
Newbie
Newbie
Posts: 40
Joined: Tue Dec 07, 2010 12:00 am

Multiple lines from custom function?

Post by dave » Wed Jan 05, 2011 10:38 pm

It looks like we will be creating a number of custom financial functions. I have found one example that uses the inherited Calculate event and I have that working. I see that it returns a single value and that one value is easy to plot. What I want to create are functions that return more than one line. An example from your function list is MACD. One MACD function returns 2 lines and a histogram. Can I create a single custom function that populates three lines like that? Is that the function of the CalculateMany event? Do you have a simple sample (VB.Net would be nice, but C# would suffice) of using CalculateMany? I did not see one in my samples.

Thanks for your help!

dave
Newbie
Newbie
Posts: 40
Joined: Tue Dec 07, 2010 12:00 am

Re: Multiple lines from custom function?

Post by dave » Thu Jan 06, 2011 2:42 pm

Here is a quick second question for the topic of Custom functions using the "Calculate" event. Let's say the particular bar that is being processed by some trip through this event is an "invalid" day, like a holiday or something. If I want to return a value that is not plotted, or is ignored, what kind of value do I pass back? That function returns a type double. "0" is not a good option because 0 could be a valid response. I am trying to figure out the appropriate value that would be "DoNotPainted" in the following series.

line1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint

Should I just pass back something like:

Dim O as Object = Nothing
Return O

Thanks!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Multiple lines from custom function?

Post by Sandra » Mon Jan 10, 2011 3:10 pm

Hello dave,

I am afraid that is not possible. The solution I propose to you, is that create a custom function that inherits of MACD function or ADX function. Once this is done you only has to overwrite methods Calculate and CalculateMany because works as you want. You can find examples of ADX and MACD function in Demo project All Features\Welcome !\Functions\Financial\ADX and All Features\Welcome !\Functions\Financial\MACD. And also you can find more information of methods Calculate and CalculateMany in Tutorial 7.
Here is a quick second question for the topic of Custom functions using the "Calculate" event. Let's say the particular bar that is being processed by some trip through this event is an "invalid" day, like a holiday or something. If I want to return a value that is not plotted, or is ignored, what kind of value do I pass back? That function returns a type double. "0" is not a good option because 0 could be a valid response. I am trying to figure out the appropriate value that would be "DoNotPainted" in the following series.
You have different options for achieve it:

1.- You can change color of the point you want Transparent changing property Color.Transparent.
2.- You can do SetNull(ValueIndex) of point are you want null or transparent.
3.- You can use property of Series.DefaultNullValue that sets or returns the value to be used as a null value within the series.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply