Initial commit
This commit is contained in:
@@ -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 Envelopes Cloud", "Sample Envelopes Cloud\Sample Envelopes Cloud.csproj", "{C0EC0427-9DF4-4210-8082-017AA80C774A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C0EC0427-9DF4-4210-8082-017AA80C774A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C0EC0427-9DF4-4210-8082-017AA80C774A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C0EC0427-9DF4-4210-8082-017AA80C774A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C0EC0427-9DF4-4210-8082-017AA80C774A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B08A4524-33BD-4715-B7D2-5A9DCB221E43}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using cAlgo.API;
|
||||
using cAlgo.API.Indicators;
|
||||
|
||||
namespace cAlgo
|
||||
{
|
||||
[Cloud(UpperBandLineName, LowerBandLineName)]
|
||||
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
|
||||
public class SampleEnvelopesCloud : Indicator
|
||||
{
|
||||
private const string UpperBandLineName = "UpperBand";
|
||||
private const string LowerBandLineName = "LowerBand";
|
||||
|
||||
[Parameter(DefaultValue = 14)]
|
||||
public int Period { get; set; }
|
||||
|
||||
[Parameter(DefaultValue = 0.1)]
|
||||
public double Deviation { get; set; }
|
||||
|
||||
[Output(UpperBandLineName, LineColor = "#B268BCFF")]
|
||||
public IndicatorDataSeries UpperBand { get; set; }
|
||||
|
||||
[Output(LowerBandLineName, LineColor = "#B2FF5861")]
|
||||
public IndicatorDataSeries LowerBand { get; set; }
|
||||
|
||||
private MovingAverage _movingAverage;
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
_movingAverage = Indicators.MovingAverage(Bars.ClosePrices, Period, MovingAverageType.Simple);
|
||||
}
|
||||
|
||||
public override void Calculate(int index)
|
||||
{
|
||||
var maValue = _movingAverage.Result[index];
|
||||
UpperBand[index] = maValue * (1 + Deviation / 100);
|
||||
LowerBand[index] = maValue * (1 - Deviation / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="cTrader.Automate" Version="1.*-*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user