Eugene, Cone
Good morning. I have a two-part question:
1- When WLP calls my strategy, how can I determine whether user has selected a DataSet or a Symbol? In other words, I need to know whether my strategy has been invoked on a DataSet or a symbol within a DataSet.
2- This is the short version of my question, I can provide details if you want. In my strategy, if the user goes back and forth between various windows, it is possible that the underlying symbol that my strategy is working on is not longer the symbol that the user has selected under the DatSets. Is there a function that I call which gives me the last selected symbol? I cannot use Bars.Symbol because as I mentioned this might be out of date.
-thanks, j
Size:
Color:
1 - Please search the forum and the Wiki. This has been thoroughly discussed and appropriate code has been included in Community Components.
Size:
Color:
Eugene,
I had tried to research this issue with no success, could you please indicate the right keywords, then I will search again:-)
-j
Size:
Color:
Size:
Color:
Eugene,
Thanks so much for the keywords. I downloaded the utility component and added it to my system. There seems to be a problem, as explained below.
I have added a menu item under Tools menu (as you had helped me out). From within my menu item under Tool, I open up a form and then click on the OK button (just for testing). The menu click handler simply runs the GetDataSetName() as explained in the wiki. This is the problem. This function either does not do anything or core dumps. This happens whether or not I choose a dataset within WLP.
Please help, thanks, -J
Size:
Color:
This function was not intended to run in this manner.
Size:
Color:
Eugene,
Hi. I have been trying to use the solution that you suggested in "Determining the mode a Strategy is running in" to determine the mode SSB/MSB. I am using this solution in the usual manner within a wealthscript strategy (not through the menu hook described earlier). This function does not work at all. I believe it was a solution written for WL5, which no longer works for WL6. [Note that the other solution, "GetDataSetName" works just fine]
I spent all of my today to determine a solution myself using the System.Reflection. I examined all the properties of the "ChartForm" in Application.OpenForms to see which one changes once I click on a symbol versus when I click on a DataSource. To my dismay, I could not find any property that changes when I click on the DataSource (as opposed to a symbol within a Datasource). I have to assume that ChartForm retains the state in a property when a user clicks on a DataSource but I could not find which one.
I do realize that you probably do not support such issues which goes beyond what is documented in quickref, but I pretty much have reached the end of my capabilities. Do you have any hints/leads for me. Perhaps if possible you can contact a developer of WLP and he may be easily tell us which property can be reflected on to determine SSB versus MSB.
-Thanks, J
Size:
Color:
Jalal,
QUOTE:
This function does not work at all. I believe it was a solution written for WL5, which no longer works for WL6.
Just confirmed that the solution keeps working for me just fine in WLD 6.2.44 x64 (patch build) as it did before. Maybe it has to do with slightly different obfuscation Fidelity does for WLP6 - that breaks reflection. Unfortunately, I can not verify it right now.
Size:
Color:
Eugene,
Thanks so much for looking into this. I am on WLP 6.2.34 x64. I tried to perform a software upgrade but it tells me that my version is current.
I stepped thru the code using my debugger. The code looks for a window called "MainForm" and looks for a property called "Symbol" on that window. This property does not exist (at least in my version of WLP) and the code does not work. The other code that works "GetDataSetName" looks for a window called "ChartForm". I guess "MainForm" belongs to WLP 5 and now is replaced with "ChartForm", not sure. it is puzzling how it works for WLP 6.2.44, perhaps something has changed again.
At any rate, I looked at all properties of "MainForm" window and could not find anything that changes as a result of the user clicking on a datasource as opposed a symbol within that datasource. Please let me know if you have any suggestions; again I would appreciate if you could contact a developer.
-Best, J
Size:
Color:
Jalal,
Sorry but I was unclear. It will not work in WLP 6.2.44 (the no yet published patch build - whenever Fidelity decides to release it) as well, because the code example will run only in Developer. Blame it on the different obfuscation parameters Fidelity applies in WLP - they make the necessary property inacessible. Of course it's possible to overcome the Reflection obstacle - otherwise my
Data Tool simply wouldn't function in WLP - but that's proprietary classes I'm not going to share with the community, sorry.
We contacted the developers before (was it 5.6 or 6.0?), allowing to save another Reflection-dependent solution from stopping to work in WLP:
Interacting Dynamically with Portfolio Level Equity. Furthermore, we urged to make GetDataSetName a standard WealthScript method - as a valid alternative to those Reflection hacks which are limited to work in Strategy windows (no Strategy Monitor).
Size:
Color:
Eugene,
Wonderful, please also urge the development of a function that determines the strategy mode SSB/MSB (if the user has selected a symbol versus a datasource) in addition to GetDataSetName.
Thanks for your support :-)
Size:
Color:
Size:
Color:
Eugene,
Wonderful, I'll take a look, thanks.
-j
Size:
Color:
Eugene,
Hi, hope all is well. With regards to GetDataSetName, it works fine if I open a chart and then call this function from within my strategy. However, if I open the strategy monitor and add my strategy, GetDataSetName no longer works, it says: "Strategy not found." I believe it looks for open window forms and it aborts when it does not see any.
Even when we invoke a strategy directly from within the Monitor, it is still attached to a dataset and therefor GetDataSetName should still work. Any comments or workarounds? I really need to determine the dataset name, regardless of whether I run the strategy from a chart or the Monitor.
-Best, J
Size:
Color:
J,
Check out the Wiki manual
GetDataSetName, the very first paragraph, note in red.
p.s. A workaround for what itself is a workaround? ;)
Size:
Color:
:)
Eugene, previously you mentioned: "Furthermore, we urged to make GetDataSetName a standard WealthScript method - as a valid alternative to those Reflection hacks which are limited to work in Strategy windows (no Strategy Monitor)." Any status on that? Could you emphasize the importance (well, at least to me) of this function to the developers and ask them for a solution in an upcoming release? -thx, J
Size:
Color:
With all respect, there are much more important tasks that really need to be prioritized for 2012/2013 for the product's progress: moving to .NET 4.0, multi-core CPU support, and other (already scheduled) projects.
Size:
Color:
Eugene, while I understand that often the needs of many outweight the needs of a few, I cannot help feeling that my needs do not have much bearing at all to the WLP team. The requested feature is a tiny task compared to the items that you mentioned. From your email, it seems like this feature will never been done (2012/2013...) and it is not on the radar screen. As an active user of WLP, this is very discouraging to me. Another approach would have been to raise the need to the development team and let them schedule that in a release, of course given all their other commitments.
I hope you can understand my frustration here. We have dedicated many man-days of work to writing code on top of WLP and feel ignored and helpless as a Fidelity client.
-j
Size:
Color:
We live in a material world. Manpower is finite, requests always keep coming. It's about bang for the buck.
GetDataSetName in Strategy Montor is definitely not something a user can't live without. And there's a super easy way to work around it: parse StrategyMonitorConfiguration.xml, find your Strategy (StrategyName is available), get the DataSourceName tag value. Voila?
Size:
Color:
Just an example of what I mean by parsing (add a Reference to System.Xml in Strategy Editor):
CODE:
Please log in to see this code.
Although Strategy names aren't used by the St.Mon. (the Guid field is), I think working around it will not be a big deal for you.
Size:
Color:
ATTENTION: Community Components has a new GetMode function since v2017.09. It supersedes the Wiki article and related forum conversations. Thanks vladl2015 for the code.GetMode
Size:
Color: