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 SMA", "Sample SMA\Sample SMA.csproj", "{A84A345B-D154-47A0-B384-D178681525D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A84A345B-D154-47A0-B384-D178681525D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A84A345B-D154-47A0-B384-D178681525D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A84A345B-D154-47A0-B384-D178681525D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A84A345B-D154-47A0-B384-D178681525D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4C1B609B-0732-4915-AC38-A0C170900740}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,36 @@
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// This code is a cTrader Automate 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;
|
||||
|
||||
namespace cAlgo
|
||||
{
|
||||
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
|
||||
public class SampleSMA : Indicator
|
||||
{
|
||||
[Parameter("Source")]
|
||||
public DataSeries Source { get; set; }
|
||||
|
||||
[Parameter(DefaultValue = 14)]
|
||||
public int Periods { get; set; }
|
||||
|
||||
[Output("Main", LineColor = "Turquoise")]
|
||||
public IndicatorDataSeries Result { get; set; }
|
||||
|
||||
public override void Calculate(int index)
|
||||
{
|
||||
var sum = 0.0;
|
||||
|
||||
for (var i = index - Periods + 1; i <= index; i++)
|
||||
sum += Source[i];
|
||||
|
||||
Result[index] = sum / Periods;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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