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 Price Channels", "Sample Price Channels\Sample Price Channels.csproj", "{352AA4CE-9530-4132-B500-F2809A0EEBB7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{352AA4CE-9530-4132-B500-F2809A0EEBB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{352AA4CE-9530-4132-B500-F2809A0EEBB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{352AA4CE-9530-4132-B500-F2809A0EEBB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{352AA4CE-9530-4132-B500-F2809A0EEBB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AE838552-C7FC-4153-AD99-5C69B0E8E315}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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 System;
|
||||
using cAlgo.API;
|
||||
|
||||
namespace cAlgo
|
||||
{
|
||||
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
|
||||
public class SamplePriceChannels : Indicator
|
||||
{
|
||||
[Parameter(DefaultValue = 20)]
|
||||
public int Periods { get; set; }
|
||||
|
||||
[Output("Upper", LineColor = "Pink")]
|
||||
public IndicatorDataSeries Upper { get; set; }
|
||||
|
||||
[Output("Lower", LineColor = "Pink")]
|
||||
public IndicatorDataSeries Lower { get; set; }
|
||||
|
||||
[Output("Center", LineColor = "Pink")]
|
||||
public IndicatorDataSeries Center { get; set; }
|
||||
|
||||
public override void Calculate(int index)
|
||||
{
|
||||
double upper = double.MinValue;
|
||||
double lower = double.MaxValue;
|
||||
|
||||
for (int i = index - Periods; i <= index - 1; i++)
|
||||
{
|
||||
upper = Math.Max(Bars.HighPrices[i], upper);
|
||||
lower = Math.Min(Bars.LowPrices[i], lower);
|
||||
}
|
||||
|
||||
Upper[index] = upper;
|
||||
Lower[index] = lower;
|
||||
Center[index] = (upper + lower) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
+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