- ago
Hi,
For interaction between a WL6 strategy and a separate app I used System.IO.FileSystemWatcher to hook file changed events. The separate app noticed when WL6 wrote to a file.

For WL8 I plan to bring this separate app into WL8 and use the same scheme.
However, I get the above message.
It appears that WL8 is using this facility and forbids C# strategies to use it.
On the other hand, I am able to do: File.AppendAllText() in WL8. This uses System.IO.

Here are the using statements for reference.
using WealthLab.Backtest;
using System;
using WealthLab.Core;
using WealthLab.Data;
using WealthLab.Indicators;
using System.Collections.Generic;
using System.IO;
using System.IO.FileSystem;

Is there a way I can hook file changed events?
Thanks!
0
302
Solved
8 Replies

Reply

Bookmark

Sort
- ago
#1
I'm not sure why you would be using System.IO.FileSystem. Practically anything you need for file IO should be in the System.IO namespace.
0
- ago
#2
If I use the same line as in the WL6 sidekick app:
using System.IO;
private System.IO.FileSystemWatcher fileSystemWatcherFmSM4TF;

The the compiler comes back with:
Compiled at 10/20/2024 11:19:51
171: The type name 'FileSystemWatcher' could not be found in the namespace 'System.IO'. This type has been forwarded to assembly 'System.IO.FileSystem.Watcher, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.
0
- ago
#3
Are you writing a strategy and putting your ported code into the strategy, and you're using the WL8 editor? Or, are you building a separate library, say using Visual Studio, that will include your ported code?
0
- ago
#4
The side kick (trade and quote) app becomes a 5 second WL8 strategy.
This way I can use your trade and quote calls.

I am using the VS2022 editor and linking the WL8 5 second strategy file to this file.
VS2022 file: feeder.cs (saved) => (updates): WL8 file: receiver.cs
This scheme you have provided on WL8 is very nice.

If file changed watcher is not available I can poll the modification time of the file.
WL8 1 minute strategy knows that at the top of the minute the file it wants will be ready (except for when it is not which seldom happens but code can handle this)
WL8 5 second strategy polls the file it wants every five seconds.

I verified that checking the file modification time scheme works.
0
- ago
#5
To clarify, I'm just another user, not a Quantacula employee.

I can use FileSystemWatcher in my separate library, and in a C# coded strategy that is linked to a file, and in a strategy that is composed in the WL8 editor.

When you get the compilation error you noted, is that occurring in Visual Studio (if you're attempting compilation there) and/or in WL8?
0
- ago
#6
I see the error in the WL8 compiler.
I am using vs2022 because it is a faster editor.
Once you save the VS2022 file, the WL8 strategy it is linked to is updated.
0
- ago
#7
In your code, get rid of

CODE:
using System.IO.FileSystem;

In WL8, go to menu Tools -> Assembly References. Make sure System.IO.FileSystem.Watcher is checked.

Then, you should be able to use statements such as the following in your code:

CODE:
         var watch = new FileSystemWatcher();
0
Best Answer
- ago
#8
Thank you! That wrked.
0

Reply

Bookmark

Sort