Applying a template to all open charts via a cBot
Applying a template to all open charts via a cBot
03 Jun 2016, 00:11
I have been trying to find a way in cAlgo to write a cBot that only makes use of OnStart() who's purpose is to cycle through all of the open charts (I typically have 22-24 charts open) and apply a specific template to each one. Importing the user32.dll and using System.Runtime.InteropServices I am able to obtain the handles for the parent window and all open child windows.
For a point of reference, in MT4 you can do what I am attempting to do in cAlgo/C# by issuing a PostMessageA() call to each window, passing the WM_COMMAND as the second parameter and the numeric offset from the top of the templates list added to 34800 as the third parameter. It looks like this:
PostMessageA(iChild, WM_COMMAND, 34800+TemplateNo, 0);
WM_COMMAND is simply 0x0111.
The TemplateNo is an integer specifying the offset from the top of the template drop-down menu list, with the first template offset at 0. So say the template I want to apply to all of the open charts is called Pivot-v1 and lets say it is the 4th template in the drop-down menu list, then TemplateNo would be set to 3, and the third parameter in the PostMessageA call would be 34803.
What is the equivalent for cTrader? I would like to write the cBot to do the same sort of thing.
Replies
tdb.intg
03 Jun 2016, 11:14
How difficult could that be though? It i sobvious you (SPOTWARE) understood what I described. Couldn't you post as a reply to this forum thread what the equivalent would be in order to do the same thing in cTrader? I am not asking for you or anyone else to rewrite your client interface - I would think something this simple could be revealed as a forum post, and in return you would make those us who really enjoy using cTrader and cAlgo but are frustrated with some of its limitations even more appreciative!
Just a thought I hope you will consider. Something like this shouldn't require a feature change. Perhaps expanding some portion of the online documentation would be sufficient to allow those of us capable of C# coding to help enhance cTrader's capabilities.
@tdb.intg
Spotware
03 Jun 2016, 09:51
Dear Trader,
Currently we don't provide users with the ability to apply templates programmatically. We will consider providing it in the future. Stay tuned.
Additionally, you can post your ideas/suggestions to http://vote.spotware.com/
@Spotware