- ago
Hi,
My WL6 strategy was coupled to a Windows Forms app that did the actula trading. They communicated via file changed events or via polling.

In WL8 I am plannning to have this piece to be another WL8 strategy so I can use WL8 trade facility, I have a need for inputs that can override what the code does for example, or condiitoning the strategy fior various options live.

Can a WL8 strategy spawn a Windows Form for example?
Do you have example code for this purpose?
It does not have to be Forms. Any way to input would be great.
And textbox like facility.

Thanks!
0
130
Solved
2 Replies

Reply

Bookmark

Sort
- ago
#1
QUOTE:
My WL6 strategy was coupled to a Windows Forms app that did the actual trading. They communicated via file changed events or via polling.

You are making it sound like you want to pass information via the Windows Clipboard. That's a good, not too complicated solution. Understand, the Clipboard is not a part of .NET 8.0 (which WL8 is based upon), so you need to include Windows.Forms in your library build. See Post #2. I don't have a WL8 strategy that references the Clipboard directly, but you could certainly build a local library call that could do that with Visual Studio.

WL8 doesn't use Windows Forms, but rather uses WPF (Windows Presentation Foundation). WPF is somewhat more complicated because it executes as an independent thread so Windows GUI events are placed on the WPF dispatcher queue for execution. If you want to try your hand at that, I would go to https://www.wealth-lab.com/Support/ExtensionApi/WealthLabClientExtension and have Visual Studio download and install the GIT client-window extension demo linked at the top of that page. This would be the most modern approach.

In theory, you could build a Windows Forms app linked to WL8, but I don't know much about doing that. That's kind of old school. Happy coding.
0
- ago
#2
QUOTE:
Understand, the Clipboard is not a part of .NET 8.0 (which WL8 is based upon), so you need to include Windows.Forms in your library build.


Sorry, but that is incorrect. You can use the System.Windows.Clipboard class: https://learn.microsoft.com/en-us/dotnet/api/system.windows.clipboard?view=windowsdesktop-8.0

You don't need Windows.Forms.

You can use System.Windows.Clipboard in a WPF app, and even use it in strategy code. In strategy code, you need it to run on the UI thread, so you have to do this for example:

CODE:
using System.Windows; //... more code // in some method... Application.Current.Dispatcher.Invoke(() => { var text = Clipboard.GetText(); WriteToDebugLog(text); });
1
Best Answer

Reply

Bookmark

Sort