Profile Picture

change watchlist programmatically

Posted By ophth1 Last Year
Message
Posted Friday April 29 2016
hi, is it in the meantime in RE possible to change watchlist (add and remove symbols) programmatically while the system is running, e.g. as part of the strategy... thanks! best wishes
Posted Monday May 02 2016
It's not possible to add or remove symbols while the system is running.  You can control the watchlist programmatically using watchlist plugins.

If you are looking to add or remove symbols from the watchlist because you want to trade an index, Norgate supports this by providing an indicator which lets you know whether the symbol was part of a given index for each bar.

Thanks,
Daniel
Posted Wednesday September 21 2016
Not sure if this helps or not, ophth1, but just in case.

The watchlists are stored in standard XML format, in your user profile. You can easily modify this list programatically as with any XML file. The changes won't take effect until the application is restarted, so you may want to do that outside of RE. Be sure to back up the XML file, since RE won't start if you goof it up.

What you can do is to programatically modify the xml file externally, before opening RE. The entire process can easily be automated. Run a script that makes the changes you need, then opens RE, runs what you want to run, report what you want, and either stay there or shut down again. I do this in-house and have plenty of automated programs running this kind of logic. 
Posted Wednesday September 21 2016
There is some code on the site that helps with this.  I start with a custom file symbol config file that contains an empty folder that will later contain my watchlists.

I Deserialize the contents of the file using a WatchListItem class I found on the site.

I then iterate through the WatchListItem until I find my folder by it's name.

After that, I add custom WatchListItems to my folder WatchListItem.

You can add folders and symbols as WatchListItems.

Then just Write the file when done.

When starting RE, you can pass the path to this custom settings file.


Posted Wednesday September 21 2016
Yep, that's smarter than what I ended up doing, John. I just played with the XML, adding and removing child nodes. Your way is better.


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems