Custom Window Plugin¶
Overview¶
Custom Window Plugin creates a simple interface in cTrader for triggering actions based on user input through the following key functionalities:
- Builds a window interface within the cTrader platform to display a custom visual component alongside the trading workspace.
- Adds a button for user interaction to initiate actions manually.
- Triggers predefined logic on button click, enabling consistent handling of trading tasks.
- Updates open positions based on set conditions, applying changes only when specific criteria are met.

The plugin adds a window where you can perform a specific action on all your open positions. This helps with manual trading by letting you apply the same rule to every position at once, without having to change each one separately.
Plugin creation¶
Learn how to create plugins, using either C# or Python, in our step-by-step guides.
Custom Window plugin code is available in our public C# and Python repositories. The same code is provided as a template in the algorithm creation wizard in cTrader Windows or Mac, or you can simply copy and use the snippet below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Customisation options¶
| Parameter | Description | Possible values |
|---|---|---|
_buttonAddTakeProfit.Text | Sets the text label displayed on the button. | Add take profit |
_buttonAddTakeProfit.Height | Specifies the height of the button in the window. | 50, 60, 65, etc. |
_buttonAddTakeProfit.BackgroundColor | Sets the background colour of the button. | color.seagreen |
_buttonAddTakeProfit.Click | Triggers an event when the button is clicked. | _buttonaddtakeprofit_click |
_window.Height | Sets the height of the window. | 150, 200, 220, etc. |
_window.Width | Sets the width of the window. | 150, 200, 220, etc. |
_window.Padding | Defines the space inside the window around its child content. | (5, 10, 10, 5), (8, 12, 12, 8), etc. |
_window.Child | Assigns the button as the content inside the window. | _buttonaddtakeprofit |
position.TakeProfit | Checks if a position already has a take profit set. | null |
position.ModifyTakeProfitPips | Modifies the take profit by setting it to a fixed pip value. | 20, 24, 26, etc. |
Use cases¶
| Use case | Scenario | Value |
|---|---|---|
| Bulk take-profit setter | You have multiple open positions without a take profit. | Automates the repetitive task of adding a 20-pip take-profit level. |
| Reactive trade manager | The market moves quickly and you need to protect profits instantly. | Applies a take profit across positions with one click. |
| Bulk stop-loss setter | You want to quickly apply a 20-pip stop loss across your open positions. | Sets consistent risk controls without editing each trade individually. |
Summary¶
Custom Window Plugin enhances manual trading by allowing you to quickly apply a take-profit level of 20 pips to all open positions that do not have one. Through a simple floating interface with a single action button, it brings speed and consistency to trade management.
For further development details, refer to our plugin documentation.