diff --git a/Plugins/.samples.json b/Plugins/.samples.json index 5316ff8..1204564 100644 --- a/Plugins/.samples.json +++ b/Plugins/.samples.json @@ -41,6 +41,9 @@ { "name": "My ASP Example" }, + { + "name": "My Custom Frame Example" + }, { "name": "Order by Margin" }, diff --git a/Plugins/My Custom Frame Example/My Custom Frame Example.sln b/Plugins/My Custom Frame Example/My Custom Frame Example.sln new file mode 100644 index 0000000..dd62670 --- /dev/null +++ b/Plugins/My Custom Frame Example/My Custom Frame Example.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}") = "My Custom Frame Example", "My Custom Frame Example\My Custom Frame Example.csproj", "{bcac2c14-878a-4dff-aea7-df2f6d634f09}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {bcac2c14-878a-4dff-aea7-df2f6d634f09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {bcac2c14-878a-4dff-aea7-df2f6d634f09}.Debug|Any CPU.Build.0 = Debug|Any CPU + {bcac2c14-878a-4dff-aea7-df2f6d634f09}.Release|Any CPU.ActiveCfg = Release|Any CPU + {bcac2c14-878a-4dff-aea7-df2f6d634f09}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.cs b/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.cs new file mode 100644 index 0000000..f0a6c2c --- /dev/null +++ b/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.cs @@ -0,0 +1,57 @@ +// ------------------------------------------------------------------------------------------------- +// +// 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 two custom frames to the charts area, displaying two different websites. +// +// 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 MyCustomFrameExample : Plugin + { + WebView _cTraderWebView = new WebView(); + WebView _cTraderWebViewSite = new WebView(); + + protected override void OnStart() + { + _cTraderWebView.Loaded += _cTraderWebView_Loaded; + var webViewFrame = ChartManager.AddCustomFrame("Forum"); + webViewFrame.Child = _cTraderWebView; + webViewFrame.ChartContainer.Mode = ChartMode.Multi; + webViewFrame.Attach(); + + _cTraderWebViewSite.Loaded += _cTraderWebViewSite_Loaded; + var webViewFrameSite = ChartManager.AddCustomFrame("Site"); + webViewFrameSite.Child = _cTraderWebViewSite; + webViewFrameSite.ChartContainer.Mode = ChartMode.Multi; + webViewFrameSite.Attach(); + } + + private void _cTraderWebView_Loaded(WebViewLoadedEventArgs args) + { + _cTraderWebView.NavigateAsync("https://www.ctrader.com/forum"); + } + + private void _cTraderWebViewSite_Loaded(WebViewLoadedEventArgs args) + { + _cTraderWebViewSite.NavigateAsync("https://www.spotware.com"); + } + + protected override void OnStop() + { + // Handle Plugin stop here + } + } +} \ No newline at end of file diff --git a/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.csproj b/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.csproj new file mode 100644 index 0000000..51ac844 --- /dev/null +++ b/Plugins/My Custom Frame Example/My Custom Frame Example/My Custom Frame Example.csproj @@ -0,0 +1,9 @@ + + + net6.0 + + + + + +