Scan for change in file by 3rd party app for market signals
Author: gchudublin
Creation Date: 7/12/2018 5:01 AM
profile picture

gchudublin

#1
In dot net there is file watcher function, any possibility that I can put a stock symbol in a file and the file watcher can trigger a strategy and run the strategy for that symbol? I would like to run a strategy from a scanner that scanning the market and when a stock meeting my criteria then I want to trigger and run it. The scanner is from 3rd party and it can write a stock symbol into a file. So file watcher can pick it up. Or I can creat a scanner in WLP.

profile picture

Eugene

#2
Sure it's possible. In Wealth-Lab, Strategy executes once a complete bar updates (e.g. 1-minute, 1-day, etc.) and determines if it wants to trade on the next bar or not. I'm not sure if there's much room for the FileSystemWatcher class as WLP's model isn't event-driven. If you give us a sample file generated by the 3rd party scanner we could help you out in creating a Strategy that imports the output file and picks up the symbol.
profile picture

gchudublin

#3
It will just be a simple text file which updates during the trading hours. The last line will be the most recent stock symbol X to use for strategy Y

Ex. sample file contents below:

1st col will be timestamp(MMddyyyyhhmmss), 2nd stock symbol, 3rd the strategy that I want to start and use this symbol to trade:

10022018152100 AAPL Stg1
10022018153015 PYX Stg2

I think C# can read the last line of the file and trigger the strategy

Thanks
profile picture

Eugene

#4
QUOTE:
I used 3rd party scanner to pick stocks to trade manually.
Now I created an app in C# to automatically add the stocks to a text file one line one stock which changes during the trading hours. ex. at 9:31 one stock is pick up, then one line added to the text file ex. AAPL is at the end of this text file.

Any way I can start a strategy when a stock is written to the text file and submit an order of x shares and then exit by the strategy?

I understand C# has filewatcher which can monitor the text file that I am referring to, if any changes happen to the text file, it can read the last line and get the stock symbol, but how to start the Wealth lab strategy and pass the stock symbol to it and buy that particular stock immediately?


Wealth-Lab isn't meant to be driven to "trigger the strategy", this is not a supported use case. Perhaps you could try to use an external scripting tool like AutoIt to open a Strategy window, choose symbol etc. However, it might be simpler to code your multiple Strategies as logic blocks within one Strategy and pick them once the condition is met. For example, see MultiSystem, or Calling a Strategy From Another. No need in the FileSystemWatcher - your meta-Strategy reads the file on each bar.
profile picture

gchudublin

#5
Makes sense. Thx.
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).