diff --git a/Plugins/.samples.json b/Plugins/.samples.json
index 32e55aa..574d845 100644
--- a/Plugins/.samples.json
+++ b/Plugins/.samples.json
@@ -32,6 +32,9 @@
{
"name": "Custom Frame Sample"
},
+ {
+ "name": "Custom Toolbar Button"
+ },
{
"name": "Custom Window Plugin"
},
diff --git a/Plugins/Custom Toolbar Button/Custom Toolbar Button.sln b/Plugins/Custom Toolbar Button/Custom Toolbar Button.sln
new file mode 100644
index 0000000..3cfd9ad
--- /dev/null
+++ b/Plugins/Custom Toolbar Button/Custom Toolbar Button.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30011.22
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Custom Toolbar Button", "Custom Toolbar Button\Custom Toolbar Button.csproj", "{57aed799-0d95-49c7-ae8d-a8765b3052d6}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {57aed799-0d95-49c7-ae8d-a8765b3052d6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {57aed799-0d95-49c7-ae8d-a8765b3052d6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {57aed799-0d95-49c7-ae8d-a8765b3052d6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {57aed799-0d95-49c7-ae8d-a8765b3052d6}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.cs b/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.cs
new file mode 100644
index 0000000..10e3116
--- /dev/null
+++ b/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.cs
@@ -0,0 +1,75 @@
+// -------------------------------------------------------------------------------------------------
+//
+// This code is a cTrader Algo API example.
+//
+// The code is provided as a sample only and does not guarantee any particular outcome or profit of any kind. Use it at your own risk.
+//
+// This example plugin adds a new button with a pop-up menu to the Chart Toolbar, featuring a 'Close All Positions' button that closes open positions when clicked.
+//
+// For a detailed tutorial on creating this plugin, watch the video at: [to:do]
+//
+// -------------------------------------------------------------------------------------------------
+
+using System;
+using cAlgo.API;
+using cAlgo.API.Collections;
+using cAlgo.API.Indicators;
+using cAlgo.API.Internals;
+
+namespace cAlgo.Plugins
+{
+ [Plugin(AccessRights = AccessRights.None)]
+ public class CustomToolbarButton : Plugin
+ {
+ protected override void OnStart()
+ {
+ var icon = new SvgIcon(@"");
+
+ var command = Commands.Add(CommandType.ChartContainerToolbar, OpenPositions, icon);
+ command.ToolTip = "Open Positions";
+
+ Commands.Add(CommandType.ChartContainerToolbar, CloseAllPositions, icon);
+ }
+
+ private CommandResult CloseAllPositions (CommandArgs args)
+ {
+ var buttonStyle = new Style();
+
+ buttonStyle.Set(ControlProperty.Margin, new Thickness(0, 5, 0, 0));
+ buttonStyle.Set(ControlProperty.Width, 150);
+
+ var closePositionsButton = new Button
+ {
+ Text = "Close All Positions",
+ Style = buttonStyle
+ };
+
+ closePositionsButton.Click += args =>
+ {
+ foreach (var position in Positions)
+ {
+ position.Close();
+ }
+ };
+
+ var stackPanel = new StackPanel();
+ stackPanel.AddChild(closePositionsButton);
+
+ return new CommandResult(stackPanel);
+ }
+
+ private void OpenPositions(CommandArgs args)
+ {
+ ExecuteMarketOrder(TradeType.Buy, "EURUSD", 1000);
+ ExecuteMarketOrder(TradeType.Buy, "USDJPY", 1000);
+ ExecuteMarketOrder(TradeType.Buy, "EURGBP", 1000);
+ }
+
+ protected override void OnStop()
+ {
+ // Handle Plugin stop here
+ }
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.csproj b/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.csproj
new file mode 100644
index 0000000..51ac844
--- /dev/null
+++ b/Plugins/Custom Toolbar Button/Custom Toolbar Button/Custom Toolbar Button.csproj
@@ -0,0 +1,9 @@
+
+
+ net6.0
+
+
+
+
+
+