Code Quality

This commit is contained in:
Miha Kralj
2022-11-11 11:42:06 -08:00
56 changed files with 48 additions and 268 deletions
-1
View File
@@ -55,4 +55,3 @@ public class Alphavantage_Feed : TBars
return (date, o, h, l, c, v);
}
}
+3 -3
View File
@@ -38,11 +38,11 @@ public class GBM_Feed : TBars
double OCMax = Math.Max(Open,Close);
double High = (GBM_value(seed, volatility*0.5, 0));
High = (High<OCMax)? 2*OCMax-High : High;
High = (High<OCMax)? (2 * OCMax) - High : High;
double OCMin = Math.Min(Open,Close);
double Low = (GBM_value(seed, volatility*0.5, 0));
Low = (Low>OCMin)? 2*OCMin-Low : Low;
Low = (Low>OCMin)? (2 * OCMin) - Low : Low;
double Volume = GBM_value(seed*10, volatility*2, Drift:0);
@@ -55,6 +55,6 @@ public class GBM_Feed : TBars
double U1 = 1.0-rnd.NextDouble();
double U2 = 1.0-rnd.NextDouble();
double Z = Math.Sqrt(-2.0 * Math.Log(U1)) * Math.Sin(2.0 * Math.PI * U2);
return Seed * Math.Exp( Drift - (Volatility*Volatility*0.5) + Volatility * Z);
return Seed * Math.Exp( Drift - (Volatility*Volatility*0.5) + (Volatility * Z));
}
}
+3 -3
View File
@@ -17,9 +17,9 @@ public class RND_Feed : TBars
double c = startvalue;
for (int i = 0; i < bars; i++)
{
double o = Math.Round(c + c * (volatility * 0.1 * rnd.NextDouble() - 0.005), 2);
double h = Math.Round(o + c * volatility * rnd.NextDouble(), 2);
double l = Math.Round(o - c * volatility * rnd.NextDouble(), 2);
double o = Math.Round(c + (c * (volatility * 0.1 * rnd.NextDouble() - 0.005)), 2);
double h = Math.Round(o + (c * volatility * rnd.NextDouble()), 2);
double l = Math.Round(o - (c * volatility * rnd.NextDouble()), 2);
c = Math.Round(l + (h - l) * rnd.NextDouble(), 2);
double v = Math.Round(1000 * rnd.NextDouble(), 2);
this.Add(DateTime.Today.AddDays(i - bars), o, h, l, c, v);