Dear Neil,
Thanks a lot for your quick reply, and for your nice words. Unfortunately, the problem has not been solved yet. The CDF derived from your code will also not allow a change of stock.
Anyway, I don't quite understand in what respect the code you added/changed could improve things. The only change in behavior that I found is that with my original code after changing the name of stock 1 or stock 2 all radio buttons are turned off, and with your code sometimes they stay on. Even the annoying blue bar accross the next text field that is shown after changing the name of one of the two stocks remained with your code.
It might be good for the sake of clarity to give you here the concepts behind my code:
1. Using FinancialData I fetch for all dates between Januari 1 2016 and yesterday the price data of two chosen stocks and put them in list1 and list2.
2. From list1 I get a list of all the dates and put them in listt. Using this I make the interval slider, and using this I define start and end.
3. With any of the radiobuttons I derive from list1 and/or list2 an appropiate list y. In the very basic example that I sent you only price 1 price 2 and price 1 / price 2 are shown, but I have developed some other possible lists.
4. Using start and end I derive from list y the partial list ypart, and also a list xpart.
5. After riffling xpart and ypart and partitioning the result I make the final plot.
6. In the plot I also show a whole lot of additional lines. I did not show these in my basic example. Their definitions depend on xpart, ypart, start and end. But it all works well. The only problem I am left wth is that in the CDF the Input fields of of the stock names refuse to work. But this is also the case with the code you suggested.
I hope this explanation is clear enough.
As I wrote you yesterday I still feel myself a nitwit as to the use of Mathematica. It is therefore that I am looking for a real good systematic book on it. I have studied "The elementary introduction to the Wolfram Language". It is certainly useful, but it is not enough for me. For instance, I still don't understand completely the reasoning behind the code that you suggested. And also Dynamic remains sometimes an enigma for me. I thought maybe the Mathematica Cookbook might be useful, but I have read that it is kind of outdated by now. Is there anything else you can recommend?
To be more specific, I give you here a few examples of questions about your code proposals that I am stuck with:
a. Why does the following combination work
listfun1 [a_,b_] := list1 = FinancialData [a,"OHLCV",{2016,1,1}];
listfun1[p1,p1];
listfun1 [c_,d_] := list2 = FinancialData [c,"OHLCV",{2016,1,1}];
listfun2[p2,p2];
and not
listfun1[a_] := list1 = FinancialData [a,"OHLCV",{2016,1,1}];
listfun1[p1];
listfun2[b_] := list2 = FinancialData [b,"OHLCV",{2016,1,1}];
listfun2[p2];
b. How should I interpret the following code of yours:
listfun1[a_]:= Module[ {} , list1 = FinancialData[a,"OHLCV",{2016,1,1}];
listt = list1[[All,1]];
y[[2]] = Switch[y[[1]],
" price of stock 1 ",list1[[All,2,4]],
" price of stock 2",list2[[All,2,4]],
"quotient stock prices 1 and 2",list1[[All,2,4]]/list2[[All,2,4]]];
start = Round[Length[listt]*0.25];
end = Round[Length[listt]*0.75]] ;
What is for instance the purpose of the empty list in the begin of the module, and why do you need the Switch together with the radiobuttons? You may conclude that I hate to use code that I don't really understand.
I realize that I may bother you too much with my questions. I am sorry, but maybe you can help me to become a bit more proficient in writing Mathematica code.
Anyway, thanks a lot for all the help you gave me sofar.
Best regards,
Laurens