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 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
|
||||
@@ -0,0 +1,42 @@
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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;
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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