{$I xxxx} - Inlcude equivalent in WL5
Author: novendeh
Creation Date: 1/10/2010 6:44 PM
profile picture

novendeh

#1
I'm just starting to convert my WL4 scripts to WL5, and am confused on how to use the equivalent of the Include in WL5. I have several scripts that are procedures/functions and want to use them in WL5

A little guidance would be appreciated. Many thanks.

EARL
profile picture

novendeh

#2
Below is the original WL4 procedure, converted procedure, followed by the actual script, which references the procedure

CODE:
Please log in to see this code.

===================================================================
CODE:
Please log in to see this code.


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

Eugene

#3
For sure, we have talked about this several times over these years on the forum. In this case, you need to think .NET. Reusable functions in .NET languages can be grouped in external assemblies (DLLs) and included in Strategies via "using ..." and/or by adding the assembly in the Editor's References dialog ("Other assemblies to reference..."). Of course, the method body (TimerInput in your case) should at first be compiled in an assembly using Visual Studio (Express) or SharpDevelop.

This is exactly how our Community.Components works, providing reusable functions/methods for saving trades, AutoStops, filling series from file, Chandelier stops, importing history of real trades etc.

Let us know if you have further questions.
profile picture

novendeh

#4
Eugene - this goes beyond my ability to program and much more complex the the $I function in WL4. I think I'll just but TimerInput and other coding into the WL4 script and then use the translator.

Will this work?

Thanks.

EARL
profile picture

Eugene

#5
Yes, it's more involved because WL5 doesn't have the built-in ability to reference reusable methods from other XML-based strategies.

If you save TimerInput in the directory with your exported Includes, WSTL should pick it up when a script being translated needs this function. Should work.
profile picture

novendeh

#6
Eugene - what do you mean WSTL should pick it up when a script being translated needs this function? Do you mean that I would cut and paste the translated code into WL5.6?
profile picture

Eugene

#7
I mean, set up a directory with all Includes (btw, a prerequisite for using WSTL) by exporting them manually using WL4, point WSTL to it, and you're ready to translate any script that possibly requires TimerInput.
profile picture

novendeh

#8
Eugene - I'm still having trouble. Problem now is with GETEXTERNALSERIES

The actual translated code is below and the problem line is:

Problem Line
CODE:
Please log in to see this code.


Please let me know how to translate it with GETEXTERNALSYMBOL - I could figure out from dialogue on this site. Thanks.



All of translated Code
CODE:
Please log in to see this code.


profile picture

Eugene

#9
I can't advice how to mix WSTL generated code with WealthScript code, and have no idea if it works or not.

Probably it would be:
CODE:
Please log in to see this code.
profile picture

novendeh

#10
Doesn't work. Thanks for suggestion.
profile picture

Eugene

#11
Alas, mixing WSTL and native WealthScript code is not a good idea.

Here's the pure C# version of TimerInput. No WSTL required. Since the script is trivial, I translated it as well. Note: That nice Input dialog requires installing the Community.Components library from this site.
CODE:
Please log in to see this code.
profile picture

novendeh

#12
Eugene - works great and quite a bit different from WSTL. I never would have gotten it without your coding.

One last question - do I need to but this coding in every script or since it is compiled and saved as a script, will it automatically load it.

Thanks again.

EARL
profile picture

Eugene

#13
Wealth-Lab 5 is .NET. No automatical loading unless function/method exists in a library; then, standard .NET conventions apply (add a reference + using directive - as mentioned above in my reply @ 1/11/2010 2:47 AM).
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).