Skip to content

Commit 630adde

Browse files
Merge pull request #52 from spotware/am/XT-17908
XT-17908 Deprecate built-in Algo samples move to GitHub and add Pytho…
2 parents d10d8f0 + 25369fe commit 630adde

File tree

72 files changed

+3166
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3166
-199
lines changed

‎.gitignore‎

Lines changed: 3 additions & 199 deletions
Large diffs are not rendered by default.

‎Indicators/.samples.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,36 @@
347347
{
348348
"name": "Rectangle Shape Sample"
349349
},
350+
{
351+
"name": "Sample Alligator"
352+
},
353+
{
354+
"name": "Sample Bears Power"
355+
},
356+
{
357+
"name": "Sample Bulls Power"
358+
},
359+
{
360+
"name": "Sample DeMarker"
361+
},
362+
{
363+
"name": "Sample EMA"
364+
},
365+
{
366+
"name": "Sample Envelopes Cloud"
367+
},
368+
{
369+
"name": "Sample Price Channels"
370+
},
371+
{
372+
"name": "Sample Reference SMA"
373+
},
374+
{
375+
"name": "Sample SMA"
376+
},
377+
{
378+
"name": "Sample Standard Deviation"
379+
},
350380
{
351381
"name": "ScrollBarVisibility Sample"
352382
},
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion =16.0.31729.503
5+
MinimumVisualStudioVersion =10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Alligator", "Sample Alligator\Sample Alligator.csproj", "{D11E711B-6CE5-42A2-BD07-F25907198272}"
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+
{D11E711B-6CE5-42A2-BD07-F25907198272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D11E711B-6CE5-42A2-BD07-F25907198272}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D11E711B-6CE5-42A2-BD07-F25907198272}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D11E711B-6CE5-42A2-BD07-F25907198272}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode =FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid ={F5EF3993-F32A-48D0-A3D9-C1F8B25B02A8}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// -------------------------------------------------------------------------------------------------
2+
//
3+
// This code is a cTrader Algo API example.
4+
//
5+
// All changes to this file might be lost on the next application update.
6+
// If you are going to modify this file please make a copy using the "Duplicate" command.
7+
//
8+
// -------------------------------------------------------------------------------------------------
9+
10+
usingcAlgo.API;
11+
usingcAlgo.API.Indicators;
12+
13+
namespacecAlgo
14+
{
15+
[Indicator(IsOverlay=true,TimeZone=TimeZones.UTC,AutoRescale=false,AccessRights=AccessRights.None)]
16+
publicclassSampleAlligator:Indicator
17+
{
18+
[Parameter("Periods",Group="Jaws",DefaultValue=13)]
19+
publicintJawsPeriods{get;set;}
20+
21+
[Parameter("Shift",Group="Jaws",DefaultValue=8)]
22+
publicintJawsShift{get;set;}
23+
24+
[Parameter("Periods",Group="Teeth",DefaultValue=8)]
25+
publicintTeethPeriods{get;set;}
26+
27+
[Parameter("Shift",Group="Teeth",DefaultValue=5)]
28+
publicintTeethShift{get;set;}
29+
30+
[Parameter("Periods",Group="Lips",DefaultValue=5)]
31+
publicintLipsPeriods{get;set;}
32+
33+
[Parameter("Shift",Group="Lips",DefaultValue=3)]
34+
publicintLipsShift{get;set;}
35+
36+
[Output("Jaws",LineColor="Blue")]
37+
publicIndicatorDataSeriesJaws{get;set;}
38+
39+
[Output("Teeth",LineColor="Red")]
40+
publicIndicatorDataSeriesTeeth{get;set;}
41+
42+
[Output("Lips",LineColor="Lime")]
43+
publicIndicatorDataSeriesLips{get;set;}
44+
45+
privateWellesWilderSmoothingjawsMa;
46+
privateWellesWilderSmoothingteethMa;
47+
privateWellesWilderSmoothinglipsMa;
48+
49+
protectedoverridevoidInitialize()
50+
{
51+
jawsMa=Indicators.WellesWilderSmoothing(Bars.MedianPrices,JawsPeriods);
52+
teethMa=Indicators.WellesWilderSmoothing(Bars.MedianPrices,TeethPeriods);
53+
lipsMa=Indicators.WellesWilderSmoothing(Bars.MedianPrices,LipsPeriods);
54+
}
55+
56+
publicoverridevoidCalculate(intindex)
57+
{
58+
Jaws[index+JawsShift]=jawsMa.Result[index];
59+
Teeth[index+TeethShift]=teethMa.Result[index];
60+
Lips[index+LipsShift]=lipsMa.Result[index];
61+
}
62+
}
63+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ProjectSdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<PackageReferenceInclude="cTrader.Automate"Version="1.*-*" />
8+
</ItemGroup>
9+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion =16.0.31729.503
5+
MinimumVisualStudioVersion =10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Bears Power", "Sample Bears Power\Sample Bears Power.csproj", "{A47D013C-CD13-4116-B515-982BB6DB8193}"
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+
{A47D013C-CD13-4116-B515-982BB6DB8193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A47D013C-CD13-4116-B515-982BB6DB8193}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A47D013C-CD13-4116-B515-982BB6DB8193}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A47D013C-CD13-4116-B515-982BB6DB8193}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode =FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid ={A737E7DA-C31D-464C-A4C9-2892B58E2BD2}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// -------------------------------------------------------------------------------------------------
2+
//
3+
// This code is a cTrader Algo API example.
4+
//
5+
// All changes to this file might be lost on the next application update.
6+
// If you are going to modify this file please make a copy using the "Duplicate" command.
7+
//
8+
// -------------------------------------------------------------------------------------------------
9+
10+
usingcAlgo.API;
11+
usingcAlgo.API.Indicators;
12+
13+
namespacecAlgo
14+
{
15+
[Indicator(TimeZone=TimeZones.UTC,AccessRights=AccessRights.None)]
16+
publicclassSampleBearsPower:Indicator
17+
{
18+
[Parameter("Source")]
19+
publicDataSeriesSource{get;set;}
20+
21+
[Parameter(DefaultValue=13,MinValue=2)]
22+
publicintPeriods{get;set;}
23+
24+
[Parameter("MA Type",DefaultValue=MovingAverageType.Exponential)]
25+
publicMovingAverageTypeMAType{get;set;}
26+
27+
[Output("Result",LineColor="Orange",PlotType=PlotType.Histogram)]
28+
publicIndicatorDataSeriesResult{get;set;}
29+
30+
privateMovingAveragemovingAverage;
31+
32+
protectedoverridevoidInitialize()
33+
{
34+
movingAverage=Indicators.MovingAverage(Source,Periods,MAType);
35+
}
36+
37+
publicoverridevoidCalculate(intindex)
38+
{
39+
Result[index]=Bars.LowPrices[index]-movingAverage.Result[index];
40+
}
41+
}
42+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ProjectSdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<PackageReferenceInclude="cTrader.Automate"Version="1.*-*" />
8+
</ItemGroup>
9+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion =16.0.31729.503
5+
MinimumVisualStudioVersion =10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Bulls Power", "Sample Bulls Power\Sample Bulls Power.csproj", "{DEFFA144-B39B-4DC8-89F6-79B28D235012}"
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+
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode =FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid ={8BE518C6-1636-48D4-BA7A-CAE50E5D6353}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// -------------------------------------------------------------------------------------------------
2+
//
3+
// This code is a cTrader Algo API example.
4+
//
5+
// All changes to this file might be lost on the next application update.
6+
// If you are going to modify this file please make a copy using the "Duplicate" command.
7+
//
8+
// -------------------------------------------------------------------------------------------------
9+
10+
usingcAlgo.API;
11+
usingcAlgo.API.Indicators;
12+
13+
namespacecAlgo
14+
{
15+
[Indicator(TimeZone=TimeZones.UTC,AccessRights=AccessRights.None)]
16+
publicclassSampleBullsPower:Indicator
17+
{
18+
[Parameter("Source")]
19+
publicDataSeriesSource{get;set;}
20+
21+
[Parameter(DefaultValue=13,MinValue=2)]
22+
publicintPeriods{get;set;}
23+
24+
[Parameter("MA Type",DefaultValue=MovingAverageType.Exponential)]
25+
publicMovingAverageTypeMAType{get;set;}
26+
27+
[Output("Result",LineColor="Orange",PlotType=PlotType.Histogram)]
28+
publicIndicatorDataSeriesResult{get;set;}
29+
30+
privateMovingAveragemovingAverage;
31+
32+
protectedoverridevoidInitialize()
33+
{
34+
movingAverage=Indicators.MovingAverage(Source,Periods,MAType);
35+
}
36+
37+
publicoverridevoidCalculate(intindex)
38+
{
39+
Result[index]=Bars.HighPrices[index]-movingAverage.Result[index];
40+
}
41+
}
42+
}

0 commit comments

Comments
(0)