Callable Math Functions
Author: jcthread
Creation Date: 3/13/2008 11:12 AM
profile picture

jcthread

#1
Wealth-Lab Version 5 (.NET) 5.0

Stuck. I'm in Pro 5 and want to use some standard
math functions. There are many Documented in Chapter 8
of the WealthScript Function Reference, i.e.,
Abs(),Cos(),Sqrt(), etc but I can't get to them.
Is there a Using .... statement I need to add to
the Script?
profile picture

Eugene

#2
Sticky post. "Missing" functions.

CODE:
Please log in to see this code.
profile picture

jcthread

#3
I appreciated your clear example.
I have used it to code the standard error function, ERF(x),
which is now working in some Strategy Script.
It can be used in a random walk calculation, i.e.
to find the probability of a given price move.
profile picture

Eugene

#4
Nice to hear that. Note that WL5 has the StdError built-in function. I hope someday soon you'll have an opportunity to publish your function in a new incarnation of the Code Library for WL5.
profile picture

jcthread

#5
I think I coded Erf(x) reasonably well, so yes it's not a secret. Of course, it is the use of it that counts and I'm confident that something worthwhile can be done.

To ask you again seems a bit much, but afraid I am driven to it. There are useful functions in Section 6 of the WealthScript Function Reference, such as: DaysBetweenDates(),GetMonth(),OptionExpiryDate(), etc.

How does one get to these in Pro 5 Script? Or better yet, is there documentation available that tells one how to get these into the simulation Script?

I'm missing something somewhere in regard to documentation. No search in either the Guide or the Language Reference brought me to any description of WL5's StdError function.
profile picture

Eugene

#6
There are useful functions in Section 6 of the WealthScript Function Reference, such as: DaysBetweenDates(),GetMonth(),OptionExpiryDate(), etc.

GetMonth - once again, like with System.Math, .NET has extensive number of classes to support everyday tasks like this one. The Date object has necessary function:
CODE:
Please log in to see this code.


OptionExpiryDate = IsOptionExpiryDate() - please see in the QuickRef.

DaysBetweenDates() - again, "think .NET instead". However, it has been already coded for WL5:
DaysBetweenDates #1
DaysBetweenDates #2

I'm missing something somewhere in regard to documentation. No search in either the Guide or the Language Reference brought me to any description of WL5's StdError function.

It's a regular Indicator found in the Indicators list, which can be also dragged and dropped onto chart.
profile picture

jcthread

#7
Thank you again. The truth is I will be glad to see the WL5 .NET Function Reference documented in a printable PDF file. For whatever reason, at least for me, search by flipping
pages works better.

This is marvelous software. I just hope I can do something really valuable with it.
profile picture

Cone

#8
There are no current plans to put the WL5 Function Ref into a pdf. For now, you'll have to print the pages, albeit one at a time, from the QuickRef.
profile picture

jcthread

#9
For Cone:
I'm doing OK--making progress, thanks to all this help. Still looking forward to comprehensive documentation for WL5 methods--an example of stumbles is found in the present documentation for exponentiation. It is Math.Power() in the WealthScript Function Reference. The WL5 version is Math.Pow()--found by trial and error.

For Eugene:
The StdError Indicator is, or appears to be from the available documentation, an rms deviation of a Price Series from it's Linear Regression Line. The Erf(double x) function I coded is a Gaussian probability distribution. One use for Erf(), that worked, was to find the fair price for an Option.
profile picture

Eugene

#10
Still looking forward to comprehensive documentation for WL5 methods--an example of stumbles is found in the present documentation for exponentiation. It is Math.Power() in the WealthScript Function Reference. The WL5 version is Math.Pow()--found by trial and error.

What you found is just what, most likely, you are not about to see in WL documentation in the future. It is not a WL method, but a standard function from one of the .NET library of classes.

Indicators - yes, there will be an online reference as before (that's in the making).

Throughout the thread, I was referring to that two times:
...Sticky post. "Missing" functions.... and ..."think .NET instead"....

No need for trial and error, just get an extensive .NET reference book to find these functions.
profile picture

jcthread

#11
I am doing pretty well, and appreciate your help. Will
try to find a decent "Language Reference"--the two books I have are adequate for the C# syntax, but there is nothing in them, except in passing, of standard functions.
Some remarkably encouraging back test strategies are running--so now the courage to put real $ in!
profile picture

Eugene

#12
Try:

Herb Schildt's C# 2.0: The Complete Reference
fundtimer's list of downloadable books HERE (will probably cover everyone's needs)
profile picture

jcthread

#13
If this book is like his C++ pocket reference--all I/O ,String, and Math functions laid out in alphabetical order--then it is the book for me. Thank you.
Herbert Schildt has been tracking C upwards since the beginning of time.
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).