Add a user menu and custom tool within WLP
Author: jalalfeghhi1
Creation Date: 10/12/2011 1:24 PM
profile picture

jalalfeghhi1

#1
Eugene, Cone
I have a few general questions, I guess the answers to most of them are negatives, but I had to ask anyway!
1- Is there any way to extend WLP by adding a user defined menu within WLP?

2- When WLP loads a user defined dll, is there any way to get WLP to execute it right away? In other words, I would like to have my code executed when WlP comes up, not when I open a chart and then open my strategy. The desired outcome is to gain access to my custom features as soon as WLP comes up.

3- When I extend WLP with my own forms (I finally figured out how to do it:-), my forms does not become part of WLP, for example, they do not move with I move WLP, they behave very much like the WLP Debug window, which stands separate. Do you know how I might be able to do that? Perhaps if you can tell me why you Debug window behaves differently that other chart windows, I might be able to figure that out myself.

4- Is there any way I can create a window similar to you Strategy Ranker and build my own custom functionality in it?

-Regards, J
profile picture

Eugene

#2
The answer to your questions #1 and #4 (and maybe it helps with #2 to some extent) is yes, it's possible by including a menu item under Tools with your GUI form:

Wiki > Wealth-Lab 6.x API Changes > Inserting custom items under Wealth-Lab's Tools menu (6.0)

Neuro-Lab, Extension Manager and Index Manager are such windows with custom functionality.


Re: #2 - Wealth-Lab scans for DLLs on startup to make them available in appropriate places, instantiates custom data providers etc. Please rephrase what do you mean by having Wealth-Lab to execute your code on startup.
profile picture

jalalfeghhi1

#3
Eugene,
Wonderful, i am pleasantly surprised :-) I believe this might solve all my issues.

-Best, j
profile picture

jalalfeghhi1

#4
Eugene,
I am having a problem when I add a feature under the Tools menu. The menu click invokes my form, from within that form I need to be able to access all the WealtScript features, Bars object, etc. The issue is that I cannot gain access to these features. I believe the problem is that the class that contains the menu click handler extends MenuItemHook, not WealtScript.

From within my menu click handler, I tried to instantiates a class derived from WealthScript and then invoke a method on this instance, trying to get into the WealtScript context. That did not help either. The Bars object is null, even though I have opened up a chart within WLP.

Could you please help out? Does this way of extending WLP via MenuItemHook allow us to access the functionality of WealtScript? I clearly see that other menu items such as Strategy Ranking can access the Bars object, not sure how they can do it but I cannot.

-Thanks, J
profile picture

Eugene

#5
As you might have already noticed, there are no easy ways or an API would be available. Try using System.Reflection.
profile picture

jalalfeghhi1

#6
Eugene,
I guess a great benefit of providing the menu hook is the ability to leverage WealthScript, are you saying System.Reflection can do the job? Could you please provide some sample code using System.Reflection?

-j
profile picture

Eugene

#7
WealthScript is designed to be used in programming trading strategies, not for creating interactive GUI WinForms. Please look up Dotnetperls and MSDN for Reflection usage examples.
profile picture

jalalfeghhi1

#8
Eugene,
Will do, thanks. I just wanted to comment that I do not want to use WS to create interactive forms, quite the opposite, I need to access WS features from within the form that pops up once I click on the menu item. Because WLP already provides a mechanism to add user defined menus items, perhaps in a future release it can provide a straightforward way to access WS features from user defined menu items.

-Best, J
profile picture

Eugene

#9
I understood you. WealthScript is for trading strategies. If you need to access it somewhere else than in a Strategy window, like in a custom menu item, it's an unsupported hack. While we may offer ideas, currently there is no example but reflecting on Wealth-Lab's classes might do the job. There is no plan to provide way to access these features from user defined menus.
profile picture

jalalfeghhi1

#10
Eugene, thanks as always for your support