Initial commit

This commit is contained in:
Michael Schimmel
2026-01-28 09:10:52 +01:00
commit a1d2e96f8a
513 changed files with 19503 additions and 0 deletions
@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parabolic Stop", "Parabolic Stop\Parabolic Stop.csproj", "{fbbf853c-ecf6-4c65-b8cf-c9b8291d74f7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{fbbf853c-ecf6-4c65-b8cf-c9b8291d74f7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{fbbf853c-ecf6-4c65-b8cf-c9b8291d74f7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{fbbf853c-ecf6-4c65-b8cf-c9b8291d74f7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{fbbf853c-ecf6-4c65-b8cf-c9b8291d74f7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,74 @@
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ParabolicStop : Indicator
{
[Parameter("Start", DefaultValue = 0.02)]
public double Start { get; set; }
[Parameter("Maximum", DefaultValue = 0.2)]
public double Maximum { get; set; }
[Parameter("Length", DefaultValue = 20)]
public int Length { get; set; }
[Parameter("Multiplier", DefaultValue = 4)]
public int Multiplier { get; set; }
private ParabolicSAR _sar;
private SimpleMovingAverage _smaClose;
private AverageTrueRange _atr;
private double _max;
private double _min;
private bool _isUptrend;
private double _vstop;
bool isUptrendPrev;
double vstopPrev;
// Erstelle die IndicatorDataSeries mit Output-Attribut und LineColor
[Output("Stop Line", LineColor = "Aqua", PlotType = PlotType.Line)]
public IndicatorDataSeries _stopLine { get; set; }
[Output("SMA Line", LineColor = "White", PlotType = PlotType.Line)]
public IndicatorDataSeries _smaLine { get; set; }
protected override void Initialize()
{
_sar = Indicators.ParabolicSAR(Bars, Start, Maximum);
_smaClose = Indicators.SimpleMovingAverage(Bars.ClosePrices, 3 * Length);
_atr = Indicators.AverageTrueRange(Bars, Length, MovingAverageType.Exponential);
}
public override void Calculate(int index)
{
double smaClose = _smaClose.Result[index];
double max1 = System.Math.Max(_max, Bars.ClosePrices[index]);
double min1 = System.Math.Min(_min, Bars.ClosePrices[index]);
double stop = isUptrendPrev ? max1 - Multiplier * _atr.Result[index] : min1 + Multiplier * _atr.Result[index];
double vstop1 = isUptrendPrev ? System.Math.Min(System.Math.Max(vstopPrev, stop), _sar.Result[index]) : System.Math.Max(System.Math.Min(vstopPrev, stop), _sar.Result[index]);
isUptrendPrev = _isUptrend;
_isUptrend = Bars.ClosePrices[index] - vstop1 >= 0;
bool isTrendChanged = _isUptrend != isUptrendPrev;
_max = isTrendChanged ? Bars.ClosePrices[index] : max1;
_min = isTrendChanged ? Bars.ClosePrices[index] : min1;
vstopPrev = _vstop;
_vstop = isTrendChanged ? (_isUptrend ? System.Math.Max(_max - Multiplier * _atr.Result[index], _sar.Result[index]) : System.Math.Min(_min + Multiplier * _atr.Result[index], _sar.Result[index])) : vstop1;
_stopLine[index] = _vstop;
_smaLine[index] = smaClose;
}
}
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="cTrader.Automate" Version="*" />
</ItemGroup>
</Project>