Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 3 additions & 199 deletions .gitignore

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions Indicators/.samples.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,6 +347,36 @@
{
"name": "Rectangle Shape Sample"
},
{
"name": "Sample Alligator"
},
{
"name": "Sample Bears Power"
},
{
"name": "Sample Bulls Power"
},
{
"name": "Sample DeMarker"
},
{
"name": "Sample EMA"
},
{
"name": "Sample Envelopes Cloud"
},
{
"name": "Sample Price Channels"
},
{
"name": "Sample Reference SMA"
},
{
"name": "Sample SMA"
},
{
"name": "Sample Standard Deviation"
},
{
"name": "ScrollBarVisibility Sample"
},
Expand Down
25 changes: 25 additions & 0 deletions Indicators/Sample Alligator/Sample Alligator.sln
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Alligator", "Sample Alligator\Sample Alligator.csproj", "{D11E711B-6CE5-42A2-BD07-F25907198272}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D11E711B-6CE5-42A2-BD07-F25907198272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D11E711B-6CE5-42A2-BD07-F25907198272}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D11E711B-6CE5-42A2-BD07-F25907198272}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D11E711B-6CE5-42A2-BD07-F25907198272}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid ={F5EF3993-F32A-48D0-A3D9-C1F8B25B02A8}
EndGlobalSection
EndGlobal
63 changes: 63 additions & 0 deletions Indicators/Sample Alligator/Sample Alligator/Sample Alligator.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Algo API example.
//
// All changes to this file might be lost on the next application update.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
public class SampleAlligator : Indicator
{
[Parameter("Periods", Group = "Jaws", DefaultValue = 13)]
public int JawsPeriods{get; set}

[Parameter("Shift", Group = "Jaws", DefaultValue = 8)]
public int JawsShift{get; set}

[Parameter("Periods", Group = "Teeth", DefaultValue = 8)]
public int TeethPeriods{get; set}

[Parameter("Shift", Group = "Teeth", DefaultValue = 5)]
public int TeethShift{get; set}

[Parameter("Periods", Group = "Lips", DefaultValue = 5)]
public int LipsPeriods{get; set}

[Parameter("Shift", Group = "Lips", DefaultValue = 3)]
public int LipsShift{get; set}

[Output("Jaws", LineColor = "Blue")]
public IndicatorDataSeries Jaws{get; set}

[Output("Teeth", LineColor = "Red")]
public IndicatorDataSeries Teeth{get; set}

[Output("Lips", LineColor = "Lime")]
public IndicatorDataSeries Lips{get; set}

private WellesWilderSmoothing jawsMa;
private WellesWilderSmoothing teethMa;
private WellesWilderSmoothing lipsMa;

protected override void Initialize()
{
jawsMa = Indicators.WellesWilderSmoothing(Bars.MedianPrices, JawsPeriods);
teethMa = Indicators.WellesWilderSmoothing(Bars.MedianPrices, TeethPeriods);
lipsMa = Indicators.WellesWilderSmoothing(Bars.MedianPrices, LipsPeriods);
}

public override void Calculate(int index)
{
Jaws[index + JawsShift] = jawsMa.Result[index];
Teeth[index + TeethShift] = teethMa.Result[index];
Lips[index + LipsShift] = lipsMa.Result[index];
}
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="cTrader.Automate" Version="1.*-*" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Indicators/Sample Bears Power/Sample Bears Power.sln
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Bears Power", "Sample Bears Power\Sample Bears Power.csproj", "{A47D013C-CD13-4116-B515-982BB6DB8193}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A47D013C-CD13-4116-B515-982BB6DB8193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A47D013C-CD13-4116-B515-982BB6DB8193}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A47D013C-CD13-4116-B515-982BB6DB8193}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A47D013C-CD13-4116-B515-982BB6DB8193}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid ={A737E7DA-C31D-464C-A4C9-2892B58E2BD2}
EndGlobalSection
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Algo API example.
//
// All changes to this file might be lost on the next application update.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
[Indicator(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SampleBearsPower : Indicator
{
[Parameter("Source")]
public DataSeries Source{get; set}

[Parameter(DefaultValue = 13, MinValue = 2)]
public int Periods{get; set}

[Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MAType{get; set}

[Output("Result", LineColor = "Orange", PlotType = PlotType.Histogram)]
public IndicatorDataSeries Result{get; set}

private MovingAverage movingAverage;

protected override void Initialize()
{
movingAverage = Indicators.MovingAverage(Source, Periods, MAType);
}

public override void Calculate(int index)
{
Result[index] = Bars.LowPrices[index] - movingAverage.Result[index];
}
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="cTrader.Automate" Version="1.*-*" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Indicators/Sample Bulls Power/Sample Bulls Power.sln
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample Bulls Power", "Sample Bulls Power\Sample Bulls Power.csproj", "{DEFFA144-B39B-4DC8-89F6-79B28D235012}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEFFA144-B39B-4DC8-89F6-79B28D235012}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid ={8BE518C6-1636-48D4-BA7A-CAE50E5D6353}
EndGlobalSection
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Algo API example.
//
// All changes to this file might be lost on the next application update.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
[Indicator(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SampleBullsPower : Indicator
{
[Parameter("Source")]
public DataSeries Source{get; set}

[Parameter(DefaultValue = 13, MinValue = 2)]
public int Periods{get; set}

[Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MAType{get; set}

[Output("Result", LineColor = "Orange", PlotType = PlotType.Histogram)]
public IndicatorDataSeries Result{get; set}

private MovingAverage movingAverage;

protected override void Initialize()
{
movingAverage = Indicators.MovingAverage(Source, Periods, MAType);
}

public override void Calculate(int index)
{
Result[index] = Bars.HighPrices[index] - movingAverage.Result[index];
}
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="cTrader.Automate" Version="1.*-*" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Indicators/Sample DeMarker/Sample DeMarker.sln
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample DeMarker", "Sample DeMarker\Sample DeMarker.csproj", "{5D4E7D9A-43FC-4F05-901D-546347D93E4E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5D4E7D9A-43FC-4F05-901D-546347D93E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D4E7D9A-43FC-4F05-901D-546347D93E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D4E7D9A-43FC-4F05-901D-546347D93E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D4E7D9A-43FC-4F05-901D-546347D93E4E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid ={36F1F62C-8815-4939-B2A2-1FAF0FA9B2FF}
EndGlobalSection
EndGlobal
49 changes: 49 additions & 0 deletions Indicators/Sample DeMarker/Sample DeMarker/Sample DeMarker.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Algo API example.
//
// All changes to this file might be lost on the next application update.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
[Indicator(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SampleDeMarker : Indicator
{
[Parameter(DefaultValue = 14)]
public int Periods{get; set}

[Output("DMark", LineColor = "Turquoise")]
public IndicatorDataSeries DMark{get; set}

private IndicatorDataSeries deMin;
private IndicatorDataSeries deMax;
private MovingAverage deMinMA;
private MovingAverage deMaxMA;

protected override void Initialize()
{
deMin = CreateDataSeries();
deMax = CreateDataSeries();
deMinMA = Indicators.MovingAverage(deMin, Periods, MovingAverageType.Simple);
deMaxMA = Indicators.MovingAverage(deMax, Periods, MovingAverageType.Simple);
}

public override void Calculate(int index)
{
deMin[index] = Math.Max(Bars.LowPrices[index - 1] - Bars.LowPrices[index], 0);
deMax[index] = Math.Max(Bars.HighPrices[index] - Bars.HighPrices[index - 1], 0);

var min = deMinMA.Result[index];
var max = deMaxMA.Result[index];

DMark[index] = max / (min + max);
}
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="cTrader.Automate" Version="1.*-*" />
</ItemGroup>
</Project>
Loading