Skip to content

Commit d3699f9

Browse files
authored
Merge pull request spotware#22 from spotware/CNT-653-My-Custom-Frame-Plugin-Sample
es/CNT-653
2 parents e11a175 + b0040e3 commit d3699f9

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

Plugins/.samples.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
{
4242
"name": "My ASP Example"
4343
},
44+
{
45+
"name": "My Custom Frame Example"
46+
},
4447
{
4548
"name": "Order by Margin"
4649
},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30011.22
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "My Custom Frame Example", "My Custom Frame Example\My Custom Frame Example.csproj", "{bcac2c14-878a-4dff-aea7-df2f6d634f09}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{bcac2c14-878a-4dff-aea7-df2f6d634f09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{bcac2c14-878a-4dff-aea7-df2f6d634f09}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{bcac2c14-878a-4dff-aea7-df2f6d634f09}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{bcac2c14-878a-4dff-aea7-df2f6d634f09}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// -------------------------------------------------------------------------------------------------
2+
//
3+
// This code is a cTrader Algo API example.
4+
//
5+
// 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.
6+
//
7+
// This example plugin adds two custom frames to the charts area, displaying two different websites.
8+
//
9+
// For a detailed tutorial on creating this plugin, watch the video at: [to:do]
10+
//
11+
// -------------------------------------------------------------------------------------------------
12+
13+
using System;
14+
using cAlgo.API;
15+
using cAlgo.API.Collections;
16+
using cAlgo.API.Indicators;
17+
using cAlgo.API.Internals;
18+
19+
namespace cAlgo.Plugins
20+
{
21+
[Plugin(AccessRights = AccessRights.None)]
22+
public class MyCustomFrameExample : Plugin
23+
{
24+
WebView _cTraderWebView = new WebView();
25+
WebView _cTraderWebViewSite = new WebView();
26+
27+
protected override void OnStart()
28+
{
29+
_cTraderWebView.Loaded += _cTraderWebView_Loaded;
30+
var webViewFrame = ChartManager.AddCustomFrame("Forum");
31+
webViewFrame.Child = _cTraderWebView;
32+
webViewFrame.ChartContainer.Mode = ChartMode.Multi;
33+
webViewFrame.Attach();
34+
35+
_cTraderWebViewSite.Loaded += _cTraderWebViewSite_Loaded;
36+
var webViewFrameSite = ChartManager.AddCustomFrame("Site");
37+
webViewFrameSite.Child = _cTraderWebViewSite;
38+
webViewFrameSite.ChartContainer.Mode = ChartMode.Multi;
39+
webViewFrameSite.Attach();
40+
}
41+
42+
private void _cTraderWebView_Loaded(WebViewLoadedEventArgs args)
43+
{
44+
_cTraderWebView.NavigateAsync("https://www.ctrader.com/forum");
45+
}
46+
47+
private void _cTraderWebViewSite_Loaded(WebViewLoadedEventArgs args)
48+
{
49+
_cTraderWebViewSite.NavigateAsync("https://www.spotware.com");
50+
}
51+
52+
protected override void OnStop()
53+
{
54+
// Handle Plugin stop here
55+
}
56+
}
57+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<PackageReference Include="cTrader.Automate" Version="*" />
8+
</ItemGroup>
9+
</Project>

0 commit comments

Comments
 (0)