knowing if in raw profit mode or portfolio simulation mode
Author: RuneHS
Creation Date: 11/10/2009 2:50 AM
profile picture

RuneHS

#1
Hi there, not afraid of flooding the forum with messages, here's another one "newbie" from me:

When running a script, I have to be careful to set the backtesting mode right. For instance if I run a bunch of items/data in "portfolio simulation mode", an output file is created - but all data is wrong if I forget to set the mode right in the "position size control" via the WL point-and-click position size control.

Is there any way of picking up the "mode" status in the script, i.e. reading off what mode I am in, somethng like "IsInPortfolioSimulationMode = boolean" or something? And: can the mode be set in the script to start with?
profile picture

Eugene

#2
Welcome to the Wealth-Lab 5 Wiki !

IsRawProfitMode

You'll need Community.Components (this site, Extensions > Get Extensions).
profile picture

RuneHS

#3
That's it, thanks!

Follow-ups:

1) Is it possible to read the radio button "WealthScript Override", too, i.e. in the code to know if that button is checked or not?

2) Can this/these buttons be set "programatically" in the code in some way, or do the running of scripts have to involve the setting of radio buttons in the "position size control"?
profile picture

Eugene

#4
1 - At this time I do not know is it possible or not. Why'd you want it?
2 - Short answer: no. Detailed answer: the Community.Components code that supports the "equity curve interaction" technique (see the Wiki's Knowledge Base) can potentially be modified to select a custom position sizing option when performing a SSB/MSB backtest on-the-fly. But it's pretty esoteric and unsupported.
profile picture

RuneHS

#5
1 - Why: "Application-philosophically" (or: in principle), I like to be able to run scripts without having to use the graphical interface of the application. If so, I have to set those parameters in the script, like setting the simulation mode. Sort of splitting the "core calculation engine" (100% flexible use via the code) from the "graphical application shell" (mouse-point-and-click setup -> more restricted and dependent on the performance visualizers etc. that is available). The point-and-click application should be there all right, but the ability to set up reports that could be run independent of clicking buttons is very fine, too. Typically standard batch reports. "Both is best"!
2 - ok. It is related to "1 -", yes

BTW I have read your script guide and I am on with the C# scripting, it really works fine. Coming from the trading side myself, however, I must admit that there's a couple of C# and WL programming issues that is a non-intuitive to me. Specifically, the gathering of often-used WL functions or "code snippets". I suppose this means creating a private "for me only" .wle extension - or .NET or .DLL or what? I see some references and messages referring to this earlier in the forum, but a clear example of howto set up such a library - maybe that could be included in the script guide or something? Or a tutorial somewhere?

profile picture

Eugene

#6
1 - This is not a use case and therefore isn't supported by us, though you're free to explore this side of life. You can follow my logic in Utility.cs (LoadStrategyFromDisk, runDonor etc.) - hope that helps.

QUOTE:
I suppose this means creating a private "for me only" .wle extension - or .NET or .DLL or what?

A .WLE file is merely a bootstrap file used by the Extension Manager to download and decrypt the encrypted Extension hosted on our servers. What you need is a .DLL, and here you have a good example of such a function/method library: Community.Components (open source). Install C# Express 2008 (2010 Beta) or SharpDevelop, they're free, and this library will be a good starting point.
QUOTE:
but a clear example of howto set up such a library - maybe that could be included in the script guide or something?

It is not included in the guides because it's a basic programming question of creating a dynamically linked library. The world just does not need another C# 101 book from us, there are hundreds out there. :) Please search the net for tutorials on creating a "class library" in C#. Let us know if you have further questions.
profile picture

RuneHS

#7
Thanks.

And you know, just the cupla tips mentioned, the free C# editors etc, is good information for me, I am on it!

BTW I found a nice explanation to creating those DLLs here - for you other "newbies" out there:

http://msdn.microsoft.com/en-us/library/3707x96z(VS.80).aspx
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).