derzi
Rookie
Posts: 18
Received Likes: 1
|
Post by derzi on Mar 10, 2016 19:56:07 GMT
Hello, I am building and testing an user interface for intraday trading. Therefore, I am using the DDE link to get the data. Although DDE is Jurassic, is has its UPs like being free and it suits the idea of intraday trading. After all, one most be on the computer to make trades. I am facing a problem: sometimes the DDE link is lost. AB just stops receiving any quotes.
I have an alarm (sound and email) for that but a good idea would be to force the "Reconnect" option that AB has.
Any ideas of how that could be done? This is the only place I know where the "reconnect" option is.
|
|
Milosz
Rookie
Posts: 38
Received Likes: 12
|
Post by Milosz on Mar 10, 2016 20:29:33 GMT
Hello João, I am sure, that there is a much better solution than mine and somebody will come up with it shortly, but you can always record a macro which will click the "Reconnect" button (or perform any other operations). You can use program like "Auto Hotkey" or Autoit. Then you will be able to execute such macro/script from inside AFL by using ShellExecute() in case you need it. autohotkey.com/www.autoitscript.com/site/autoit/www.amibroker.com/guide/afl/shellexecute.htmlBy the way I wonder how can I import some data from another program via DDE interface (i.e. the second, the third, the fourth, the fifth best offer - the depth of market) being connected to a regular plugin? GetRTData gives access to the first best offer only. Regards Miłosz
|
|
derzi
Rookie
Posts: 18
Received Likes: 1
|
Post by derzi on Mar 10, 2016 20:43:46 GMT
The macro is a solution. Problem is that there is no way I know to choose the "Reconnect" via keyboard, only via mouse clicks and mouse macros are a pain. I tried to use Autohotkey ages ago to use the mouse and I could not do it. I will give it another try. You can access the extra RT data, even with DDE, if your DataFeeder provides the use of GETEXTRADATA() function. It most fill those variables. www.amibroker.com/guide/afl/getextradata.htmlThere is a DDE link that provides the 5 best offers, for example.
|
|
Milosz
Rookie
Posts: 38
Received Likes: 12
|
Post by Milosz on Mar 10, 2016 21:08:11 GMT
I used to record (and modify) many macros using AutoScriptWritter II (a part of Auto Hotkey). Creating a macro using it is very easy - it records mouse coordinates, clicked buttons, keystrokes, whatever you need. Then you can modify it manually if you want. I 'm not sure if it is still available. Take a look at this link. You can find information about recommended recorders: www.autohotkey.net/~faqbot/faq.html#recordersWhere is this "DDE link that provides the 5 best offers" ? I can't find it ...
|
|
derzi
Rookie
Posts: 18
Received Likes: 1
|
Post by derzi on Mar 10, 2016 21:19:27 GMT
It is a datafeeder developed in Brazil specifically to AB. Please, notice the orders shown on the top left. The DDE Link is usually made by the broker's platform. So, the program that is providing the DDE Link most also provide additional fields to be used with GETEXTRADATA(). Even if it is a good datafeeder like eSginal or IQ, it most provide this functionality. Each feeder will have its extra data. EXAMPLE GetExtraData("briefing"); /* gives briefing text (STRING) */
graph0 = GetExtraData("QRS"); /*gives Quotes Plus relative strength (ARRAY) */
So, it is completely up to the software you are getting the data from.
|
|
Milosz
Rookie
Posts: 38
Received Likes: 12
|
Post by Milosz on Mar 10, 2016 21:32:38 GMT
Thanks for the information. The problem is that my Amibroker plugin doesn't provide these additional fields. But I use a brokerage platform which contains all the data that I need and I can only import the data from this platform using DDE. That is why I was wondering how can I combine the data from a regular plugin with some extra fields (aquired via DDE) in one AFL. I'm sure it can be done. I will find a way ;-)
Regards
|
|
fxshrat
Private Group
Posts: 566
Received Likes: 211
|
Post by fxshrat on Mar 11, 2016 0:40:18 GMT
Thanks for the information. The problem is that my Amibroker plugin doesn't provide these additional fields. But I use a brokerage platform which contains all the data that I need and I can only import the data from this platform using DDE. That is why I was wondering how can I combine the data from a regular plugin with some extra fields (aquired via DDE) in one AFL. I'm sure it can be done. I will find a way ;-) Regards So your main plugin retrieves streaming data but you want to retrieve other data being sent via DDE from elsewhere. Well, here is one method. Create DDE connection to Excel and then retrieve the data from Excel sheet's used range to AB via OLE. You may use AB matrix feature for storage of that used sheet range. Used range means cells being filled with data. So you can get Excel column and row nums programmatically for the use of AB matrix dimensions. As for storing date and time to matrix... convert Excel decimal date and time format to datenum and timenum. Be aware that both DDE and OLE are dinosaur tech (as mentioned by Joao) but that's one way to go and upper sample solution is like an emergency operation. EDIT: here is a code snippet about retireving Excel used colnum and rownum in reply #4 amibrokerforum.proboards.com/thread/103/code-snippets?page=1&scrollTo=466
|
|
derzi
Rookie
Posts: 18
Received Likes: 1
|
Post by derzi on Mar 11, 2016 15:01:10 GMT
The idea of a macro is good and will do it. I was hopping for a createobject() COM that would do it but I do not know if AB has this COM. I believe I found a good macro software, it is called Mini Mouse Macro: SourceForge.net Download
It is small, fast, easy to use, does not need to be installed and can be called using shellexecute(). It has a script builder that creates a .BAT file from where we can get the proper command line to be executed. I am still testing it but it seams to do the job so far.
|
|
Milosz
Rookie
Posts: 38
Received Likes: 12
|
Post by Milosz on Mar 13, 2016 17:55:44 GMT
Thanks for the information. The problem is that my Amibroker plugin doesn't provide these additional fields. But I use a brokerage platform which contains all the data that I need and I can only import the data from this platform using DDE. That is why I was wondering how can I combine the data from a regular plugin with some extra fields (aquired via DDE) in one AFL. I'm sure it can be done. I will find a way ;-) Regards So your main plugin retrieves streaming data but you want to retrieve other data being sent via DDE from elsewhere. Well, here is one method. Create DDE connection to Excel and then retrieve the data from Excel sheet's used range to AB via OLE. You may use AB matrix feature for storage of that used sheet range. Used range means cells being filled with data. So you can get Excel column and row nums programmatically for the use of AB matrix dimensions. As for storing date and time to matrix... convert Excel decimal date and time format to datenum and timenum. Be aware that both DDE and OLE are dinosaur tech (as mentioned by Joao) but that's one way to go and upper sample solution is like an emergency operation. EDIT: here is a code snippet about retireving Excel used colnum and rownum in reply #4 amibrokerforum.proboards.com/thread/103/code-snippets?page=1&scrollTo=466
Hello fxshrat, Thanks for the clues and the snippet. This snippet may be really interesting for some users. I have done only a few very simple things using OLE and scripting languages. This task is difficult for me. Is your code intended to be used inside AFL formula (using jscript or vbs scripting engine) or outside Amibroker? I don't want to take your time, but you were already so kind and provided this snippet. If it is possible, could you please expand it so as to be a very simple/basic and ready to use, example of how to import some values (cells) from Excel and store these values as variables/matrix in AFL code? Thanks in advance. I appreciate your time and effort.
|
|
fxshrat
Private Group
Posts: 566
Received Likes: 211
|
Post by fxshrat on Mar 14, 2016 16:13:38 GMT
So your main plugin retrieves streaming data but you want to retrieve other data being sent via DDE from elsewhere. Well, here is one method. Create DDE connection to Excel and then retrieve the data from Excel sheet's used range to AB via OLE. You may use AB matrix feature for storage of that used sheet range. Used range means cells being filled with data. So you can get Excel column and row nums programmatically for the use of AB matrix dimensions. As for storing date and time to matrix... convert Excel decimal date and time format to datenum and timenum. Be aware that both DDE and OLE are dinosaur tech (as mentioned by Joao) but that's one way to go and upper sample solution is like an emergency operation. EDIT: here is a code snippet about retireving Excel used colnum and rownum in reply #4 amibrokerforum.proboards.com/thread/103/code-snippets?page=1&scrollTo=466
Hello fxshrat, Thanks for the clues and the snippet. This snippet may be really interesting for some users. I have done only a few very simple things using OLE and scripting languages. This task is difficult for me. Is your code intended to be used inside AFL formula (using jscript or vbs scripting engine) or outside Amibroker? I don't want to take your time, but you were already so kind and provided this snippet. If it is possible, could you please expand it so as to be a very simple/basic and ready to use, example of how to import some values (cells) from Excel and store these values as variables/matrix in AFL code? Thanks in advance. I appreciate your time and effort. I do not have a ready to use example per se. But I can definitely say that the described (sample) way would work for sure and it should not be too difficult. I think that one problem would be performance issues (even more so if you intend to use in realtime intraday) since DDE/OLE are not that fast (and not multi-threading friendly). OLE can be done in AFL completely. But you would have to make some functions in vbscript that check for error handling i.e checking if Excel is busy -> being in edit mode (if not doing that then AB would create error message and interrupt for example if you edit an Excel cell there. So to avoid that such checks would be necessary. So if Excel would be released out of some cell edits of user then AB would retrieve data from Excel again automatically).
|
|