Add Plugins or Extensions to cTrader Automate
Add Plugins or Extensions to cTrader Automate
03 May 2020, 11:32
With indicators and cBots developers can only add limited features to cTrader and both only works if the user adds them on a chart and those two doesn't allow accessing multiple charts or other platform functions outside the chart or trading, what cTrader needs are an extension/plugin system which will allow developers to extend the platform without any limitation.
Design: A plugin/extension should work like this:
- User installs it on the platform like indicators/cBots
- After installation user should activate it, so there must be a plugin/extension manager to allow user activate/de-activate/uninstall extensions
- When a user activates a plugin/extension cTrader must show a popup window which will list the plugin/extension required permissions
- If the user gave the permissions then the plugin/extension will be activated
- Once a plugin/extension activated it will run always on the background until the user de-activate it
Events: Plugin/extension should have different events like (Developer must be able to subscribe/unsubscribe):
- OnActivate: It will trigger when the user activates the plugin/extension
- OnDeactivate: It will trigger when the user deactivates the plugin/extension
- OnStart/OnOpen/OnLaunch: This event should trigger when the user open or launch cTrader
- OnConfigured: This event will be triggered when user change/update the plugin/extension settings/parameters (More on this later)
- OnExit/OnClose: Trigger this event when the user exit or close cTrader
- OnChartAdded: Trigger when a new chart is created or added by the user
- OnChartRemoved: Triggers when a chart is removed/closed by the user
- OnChartDetached: Triggers when a chart is detached
- OnChartAttached: Triggers when a chart is attached back to the main cTrader window
- OnMaximized/Minimized/SizeChanged/LocationChanged: These events will be triggered when user maximize/minimize/changes cTrader window size or location
- OnConnect/Disconnect: These two methods are already available on indicators/cBots so you just have to add them for plugins/extensions
- OnToolSelected: It should trigger when the user selects a tool from cTrader toolbar
- Trading Events: plugins/extensions must have access to all trading events and function like a cBot
- OnTimeZoneChanged: Triggers when the user changes the platform time zone
- OnViewChanged: This will trigger when the user changes cTrader views (Trading, Automate, Mirroring (cTrader copy), Analyzer,...),
- OnChartFocusChanged: This will trigger when the user changes the focused chart
- OnWorkstationChanged: This will trigger when the user changes the workstation
- OnIndicatorInstalled/OnBotInstalled: This will trigger when user installs a new indicator/cBot on the platform
- OnIndicatorRemoved/OnBotRemoved: This will trigger when user remove/delete an indicator/cBot
- OnThemeChanged: This event will trigger if the user changes the cTrader theme
- OnAccountChanged: This event will trigger when the user changes the current account to any of the other connected trading accounts
Properties
- Charts: Contains all open charts (The plugin/extension should be able to change the collection items)
- Accounts: A collection that contains all connected accounts to the platform
- CurrentAccount: Same account object that is available on cBots/Indicators and we should be able to change it to any of the accounts inside Accounts collection
- Positions/PendingOrders: Same positions collection that is available on cBots/Indicators
- CurrentView: The current view of cTrader (Trading, Automate, Mirroring (cTrader copy), Analyzer,...), the plugin/extension should be able to change/set this
- CurrentChart: The current chart that has the focus, the plugin/extension should be able to change/set this
- CurrentWorkStation: The current workstation, the plugin/extension should be able to change/set this
- CurrentTimeZone: The current user time zone
- Bots: A collection that contains all installed cBot on the platform, the plugin/extension must be able to add a bot on any of the open charts
- Indicators: A collection that contains all installed indicators on the platform, the plugin/extension must be able to add an indicator on any of the open charts
- CurrentTheme: The cTrader current them (dark/light)
- WorkStations: A list of all user workstations (The plugin/extension should be able to change the collection items)
- ToolBar: This will be a collection of all cTrader toolbar tools and the plugin/extension should be able to add any of these tools to any chart and it should also be able to extend this collection and add new tools like a new drawing object type (This part is hard to implement)
- ChartMenuItems: The plugin/extension must be able to add new items to the menu or new parent menu with its own children menu items, each will have an OnClick method which will be triggered when the user clicks on it and sends the chart that is clicked on to the event handler, it should have a text, icon, tooltips property, we should also be able to subscribe on built-in menu items OnClick event
You should add new events/properties on Chart object:
- Indicators: Allows the plugin/extension to access all attached indicators on a chart, we should be able to add or remove the indicators
- Bots: All attached bots on the chart, we should be able to start/stop/configure/remove/add bots
- OnIndicatorAttached: When a new indicator is attached on the chart
- OnBotAdded: When a new bot is added on the chart
The indicator/cBot objects must be the same IRobot and Indicator objects that we have on Indicator/cBot with all properties and methods.
I might miss some things that are needed, I kindly ask the community to extend and add those items that I forgot.
Adding an extension/plugin system to cTrader will open the door for lots of new things that we can't even imagine, I hope Spotware start to work on this after migration to .Net 5.0.
Replies
... Deleted by UFO ...
EagleMoxy
05 Mar 2021, 10:35
RE:
And would plugins affect the speed and performance of the web based interface and cbots. Just putting it out there, gave you a thumbs up.
@EagleMoxy
de.b.rawa.de19
10 Mar 2021, 12:03
( Updated at: 19 Mar 2021, 13:53 )
RE:
afhacker said:
With indicators and cBots developers can only add limited features to cTrader and both only works if the user adds them on a chart and those two doesn't allow accessing multiple charts or other platform functions outside the chart or trading, what cTrader needs are an extension/plugin system which will allow developers to extend the platform without any limitation.
Design: A plugin/extension should work like this:
- User installs it on the platform like indicators/cBots
- After installation user should activate it, so there must be a plugin/extension manager to allow user activate/de-activate/uninstall extensions
- When a user activates a plugin/extension cTrader must show a popup window which will list the plugin/extension required permissions
- If the user gave the permissions then the plugin/extension will be activated
- Once a plugin/extension activated it will run always on the background until the user de-activate it
Events: Plugin/extension should have different events like (Developer must be able to subscribe/unsubscribe):
- OnActivate: It will trigger when the user activates the plugin/extension
- OnDeactivate: It will trigger when the user deactivates the plugin/extension
- OnStart/OnOpen/OnLaunch: This event should trigger when the user open or launch cTrader
- OnConfigured: This event will be triggered when user change/update the plugin/extension settings/parameters (More on this later)
- OnExit/OnClose: Trigger this event when the user exit or close cTrader
- OnChartAdded: Trigger when a new chart is created or added by the user
- OnChartRemoved: Triggers when a chart is removed/closed by the user
- OnChartDetached: Triggers when a chart is detached
- OnChartAttached: Triggers when a chart is attached back to the main cTrader window
- OnMaximized/Minimized/SizeChanged/LocationChanged: These events will be triggered when user maximize/minimize/changes cTrader window size or location
- OnConnect/Disconnect: These two methods are already available on indicators/cBots so you just have to add them for plugins/extensions
- OnToolSelected: It should trigger when the user selects a tool from cTrader toolbar
- Trading Events: plugins/extensions must have access to all trading events and function like a cBot
- OnTimeZoneChanged: Triggers when the user changes the platform time zone
- OnViewChanged: This will trigger when the user changes garageband cTrader views (Trading, Automate, Mirroring (cTrader copy), Analyzer,...),
- OnChartFocusChanged: This will trigger when the user changes the focused chart
- OnWorkstationChanged: This will trigger when the user changes the workstation
- OnIndicatorInstalled/OnBotInstalled: This will trigger when user installs a new indicator/cBot on the platform
- OnIndicatorRemoved/OnBotRemoved: This will trigger when user remove/delete an indicator/cBot
- OnThemeChanged: This event will trigger if the user changes the cTrader theme
- OnAccountChanged: This event will trigger when the user changes the current account to any of the other connected trading accounts
Properties
- Charts: Contains all open charts (The plugin/extension should be able to change the collection items)
- Accounts: A collection that contains all connected accounts to the platform
- CurrentAccount: Same account object that is available on cBots/Indicators and we should be able to change it to any of the accounts inside Accounts collection
- Positions/PendingOrders: Same positions collection that is available on cBots/Indicators
- CurrentView: The current view of cTrader (Trading, Automate, Mirroring (cTrader copy), Analyzer,...), the plugin/extension should be able to change/set this
- CurrentChart: The current chart that has the focus, the plugin/extension should be able to change/set this
- CurrentWorkStation: The current workstation, the plugin/extension should be able to change/set this
- CurrentTimeZone: The current user time zone
- Bots: A collection that contains all installed cBot on the platform, the plugin/extension must be able to add a bot on any of the open charts
- Indicators: A collection that contains all installed indicators on the platform, the plugin/extension must be able to add an indicator on any of the open charts
- CurrentTheme: The cTrader current them (dark/light)
- WorkStations: A list of all user workstations (The plugin/extension should be able to change the collection items)
- ToolBar: This will be a collection of all cTrader toolbar tools and the plugin/extension should be able to add any of these tools to any chart and it should also be able to extend this collection and add new tools like a new drawing object type (This part is hard to implement)
- ChartMenuItems: The plugin/extension must be able to add new items to the menu or new parent menu with its own children menu items, each will have an OnClick method which will be triggered when the user clicks on it and sends the chart that is clicked on to the event handler, it should have a text, icon, tooltips property, we should also be able to subscribe on built-in menu items OnClick event
You should add new events/properties on Chart object:
- Indicators: Allows the plugin/extension to access all attached indicators on a chart, we should be able to add or remove the indicators
- Bots: All attached bots on the chart, we should be able to start/stop/configure/remove/add bots
- OnIndicatorAttached: When a new indicator is attached on the chart
- OnBotAdded: When a new bot is added on the chart
The indicator/cBot objects must be the same IRobot and Indicator objects that we have on Indicator/cBot with all properties and methods.
I might miss some things that are needed, I kindly ask the community to extend and add those items that I forgot.
Adding an extension/plugin system to cTrader will open the door for lots of new things that we can't even imagine, I hope Spotware start to work on this after migration to .Net 5.0.
The trading API of cTrader Automate provides synchronous as well as asynchronous trade operation methods. The synchronous operation means that each statement in the code will be completed before execution proceeds to the next one. In asynchronous operation, when a request is sent to the server, the program continues to execute the next statements, without waiting for the response from the server.
Note that cBots examples in this guide are not intended to produce any profit, they are designed for instructional purposes only. Also, this guide assumes some basic knowledge of the C# programming language.
@de.b.rawa.de19
... Deleted by UFO ...