Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 001fd9c

Browse files
Merge pull request #53 from spotware/am/XT-17909
XT-17909 Open-source all built-in indicators in both .NET and Python ...
2 parents 630adde + 5406110 commit 001fd9c

File tree

250 files changed

+7028
-0
lines changed

Some content is hidden

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

250 files changed

+7028
-0
lines changed

‎Indicators/.samples.json‎

Lines changed: 258 additions & 0 deletions
Large diffs are not rendered by default.
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}") = "Accelerator Oscillator", "Accelerator Oscillator\Accelerator Oscillator.csproj", "{42219423-f2ee-4522-8bb8-ff7a91f6548b}"
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+
{42219423-f2ee-4522-8bb8-ff7a91f6548b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{42219423-f2ee-4522-8bb8-ff7a91f6548b}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{42219423-f2ee-4522-8bb8-ff7a91f6548b}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{42219423-f2ee-4522-8bb8-ff7a91f6548b}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using cAlgo.API;
3+
using cAlgo.API.Collections;
4+
using cAlgo.API.Indicators;
5+
using cAlgo.API.Internals;
6+
7+
namespace cAlgo
8+
{
9+
[Indicator(AccessRights = AccessRights.None)]
10+
public class AcceleratorOscillator : Indicator
11+
{
12+
private AwesomeOscillator _awesomeOscillator;
13+
private SimpleMovingAverage _simpleMovingAverage;
14+
15+
[Parameter("Up", DefaultValue = "Green")]
16+
public Color UpColor { get; set; }
17+
18+
[Parameter("Down", DefaultValue = "Red")]
19+
public Color DownColor { get; set; }
20+
21+
[Output("Result", PlotType = PlotType.Histogram, IsColorCustomizable = false)]
22+
public IndicatorDataSeries Result { get; set; }
23+
24+
protected override void Initialize()
25+
{
26+
_awesomeOscillator = Indicators.AwesomeOscillator();
27+
_simpleMovingAverage = Indicators.SimpleMovingAverage(_awesomeOscillator.Result, 5);
28+
}
29+
30+
public override void Calculate(int index)
31+
{
32+
Result[index] = _awesomeOscillator.Result[index] - _simpleMovingAverage.Result[index];
33+
34+
SetLineAppearance(Result.LineOutput, index, 1, Result[index] > Result[index - 1] ? UpColor : DownColor);
35+
}
36+
}
37+
}
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>
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}") = "Accumulation Distribution", "Accumulation Distribution\Accumulation Distribution.csproj", "{cfd09ce4-69c3-4166-b00d-12676b760ab0}"
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+
{cfd09ce4-69c3-4166-b00d-12676b760ab0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{cfd09ce4-69c3-4166-b00d-12676b760ab0}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{cfd09ce4-69c3-4166-b00d-12676b760ab0}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{cfd09ce4-69c3-4166-b00d-12676b760ab0}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using cAlgo.API;
3+
using cAlgo.API.Collections;
4+
using cAlgo.API.Indicators;
5+
using cAlgo.API.Internals;
6+
7+
namespace cAlgo
8+
{
9+
[Indicator(AccessRights = AccessRights.None)]
10+
public class AccumulationDistribution : Indicator
11+
{
12+
[Output("Main")]
13+
public IndicatorDataSeries Result { get; set; }
14+
15+
public override void Calculate(int index)
16+
{
17+
var previousValue = double.IsNaN(Result[index - 1]) ? 0 : Result[index - 1];
18+
19+
var close = Bars.ClosePrices[index];
20+
var low = Bars.LowPrices[index];
21+
var high = Bars.HighPrices[index];
22+
var volume = Bars.TickVolumes[index];
23+
24+
if (high - low == 0)
25+
{
26+
Result[index] = previousValue;
27+
return;
28+
}
29+
30+
var closeLocationValue = (close - low - (high - close)) / (high - low);
31+
var moneyFlowVolume = closeLocationValue * volume;
32+
Result[index] = previousValue + moneyFlowVolume;
33+
}
34+
}
35+
}
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>
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}") = "Accumulative Swing Index", "Accumulative Swing Index\Accumulative Swing Index.csproj", "{75b060f2-b80d-405d-b794-16144ed8cc21}"
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+
{75b060f2-b80d-405d-b794-16144ed8cc21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{75b060f2-b80d-405d-b794-16144ed8cc21}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{75b060f2-b80d-405d-b794-16144ed8cc21}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{75b060f2-b80d-405d-b794-16144ed8cc21}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using cAlgo.API;
3+
using cAlgo.API.Collections;
4+
using cAlgo.API.Indicators;
5+
using cAlgo.API.Internals;
6+
7+
namespace cAlgo
8+
{
9+
[Indicator(AccessRights = AccessRights.None)]
10+
public class AccumulativeSwingIndex : Indicator
11+
{
12+
private SwingIndex _swingIndexValues;
13+
14+
[Parameter("Limit Move Value", DefaultValue = 12, MinValue = 0)]
15+
public int LimitMoveValue { get; set; }
16+
17+
[Output("Main", LineColor = "Turquoise")]
18+
public IndicatorDataSeries Result { get; set; }
19+
20+
protected override void Initialize()
21+
{
22+
_swingIndexValues = Indicators.SwingIndex(LimitMoveValue);
23+
}
24+
25+
public override void Calculate(int index)
26+
{
27+
Result[index] = index == 0 ? _swingIndexValues.Result[index] : _swingIndexValues.Result[index - 1] + _swingIndexValues.Result[index];
28+
}
29+
}
30+
}
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)

AltStyle によって変換されたページ (->オリジナル) /