Hey there, my goal is to have one file with multiple classes that each of them represents an entry signal or an utility that can be used later(called on the file as TrapCompra, TrapVenda...) . Basically, I want to create a library, however, after trying many different ways (using statement, interfaces...), I couldn't.
The classes, if in the same file, work correctly, so they`re not the problem.
Thank you in advance!
Size:
Color:
Olá Leonardo,
It doesn't work this way in Wealth-Lab. You have to organize your class(es) in a Class Library (i.e. a DLL which targets .NET 4.6.2 or higher) and compile it in Visual Studio Community 2019. Then you could refer to it via a familiar "
using" clause and call the methods of the
Utilidades class.
Here's an example of a Wealth-Lab 6 function library:
Home - Community.Components
Size:
Color:
Thank you, it helped me. But there`s another thing: I`ve built the library and made it into a DLL which targets .NET 4.7.1, then I moved it to the same folder of WealthLab.dll, Wealth-Data.dll. Then, I tryied to install it via REGSVR32.EXE, regasm, just importing the DLL .But nothing works. I keep getting the same errors:
1) RegAsm error RA0000 Could not load file or assembly on Network Drive
2) The module Sinaisl.dll was loade but the entry-point DLLRegisterServer was not found
Any thoughts? Maybe I`m not building it the right way (creating the DLL)
Thanks again!
Size:
Color:
Neither REGSVR32.EXE nor regasm are required. Just placing the DLL in the main folder should work.
However, there's a disconnect between what you intended to do (in post #1) and what you're actually coding in VS. For a true utility library, it's not required to inherit WealthScript (as per your 2nd screenshot). Take a look into the Community Components code for insight.
1. If you're after making a library of reusable functions like
UltimoTopo and the like which you can reference in a strategy in the Editor (or in a compiled strategy), go for C.Components sample code. That's your goal. No need in WealthScript inheritance, having
void Execute() etc.
2. Self-contained strategies can also exist in compiled libraries but that's not about reusing code:
Home - Strategies.ActiveTraderHow can I debug my trading strategies in Wealth-Lab?
Size:
Color:
Main folder would be the same os WealthLab.dll? C:\Program Files\MS123\Wealth-Lab Developer 6?
Maybe my DLL was really broken, since I've tried just dragging it in there.
1 - I thought I had to use the WealthScript inheritance, now I'm going to see some sample code from C.Components and try again, then, I'll give you a feedback.
2 - You are right, that would make no sense at all.
Many thanks, once again!
Size:
Color:
QUOTE:
Main folder would be the same os WealthLab.dll? C:\Program Files\MS123\Wealth-Lab Developer 6?
Right, then it will be picked up automatically by WL. That's the recommended way.
As a less convenient alternative, you can place the file anywhere else and use the Strategy Editor > .NET References > Other..., click "Add a Reference..." This applies to the current strategy only but there's a way to make the reference global for newly created strategies: WL's Edit menu > "Save as Default Template Code". Not suggesting you'd do this, just FYI.
Size:
Color:
Okay, got it.
When I delete the WealthScript inheritance it gives me errors like "the name High does not exist in the context".
Size:
Color:
Size:
Color:
Hmmmm, really helpful!
Thank you for your time Eugene!
Have a nice week!
Size:
Color:
De nada.
Size:
Color: