This commit is contained in:
Miha Kralj
2022-11-18 21:48:41 -08:00
parent cfa10c79e8
commit f393ec336d
13 changed files with 1264 additions and 985 deletions
+7 -7
View File
@@ -11,18 +11,18 @@ Random Bars generator - used for testing, validation and fun
public class RND_Feed : TBars
{
public RND_Feed(int bars, double volatility = 0.05, double startvalue = 100.0)
public RND_Feed(int Bars, double Volatility = 0.05, double Startvalue = 100.0)
{
Random rnd = new();
double c = startvalue;
for (int i = 0; i < bars; i++)
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);
this.Add(DateTime.Today.AddDays(i - Bars), o, h, l, c, v);
}
}
}