coin_alerts/Confirmations.cs

60 lines
1.6 KiB
C#

using SignalsTest;
public static class Confirmations
{
public static float GetTWSConfirmation(List<TAReport> reports, int i)
{
float TWSHeightIncrement = 0;
if (i > 22)
{
bool hasCrossedST = false;
bool hasCrossedMA = false;
for (int z = 0; z < 20; z++)
{
if (!reports[i - z].STUp && reports[i].STUp)
{
hasCrossedST = true;
}
if (reports[i - z].SMA20 < reports[i - z].Open && reports[i].SMA20 > reports[i].Open)
{
hasCrossedMA = true;
}
}
if (hasCrossedMA) TWSHeightIncrement += 15;
if (hasCrossedST) TWSHeightIncrement += 15;
}
return TWSHeightIncrement;
}
public static float GetTBCConfirmation(List<TAReport> reports, int i)
{
float HeightIncrement = 0;
if (i > 22)
{
bool hasCrossedST = false;
bool hasCrossedMA = false;
for (int z = 0; z < 20; z++)
{
if (reports[i - z].STUp && !reports[i].STUp)
{
hasCrossedST = true;
}
if (reports[i - z].SMA20 > reports[i - z].Open && reports[i].SMA20 < reports[i].Open)
{
hasCrossedMA = true;
}
}
if (hasCrossedMA) HeightIncrement += 15;
if (hasCrossedST) HeightIncrement += 15;
}
return HeightIncrement;
}
}