public static void Main()
const float START_CAPITAL = 94000f;
float[] chanceChain = { 0.8958f, 0.7731f, 0.8152f, 0.8617f, 0.7724f };
float[] winPct = { 0.0025f, 0.005f, 0.0075f, 0.01f, 0.015f };
float trailStopPct = 0.0025f;
float leverageFactor = 4f;
float bonusGainChance = 0.0f;
float maxBonusGainPct = 0.005f;
int numSimulations = 1000000;
Random rnd = new Random();
float totalEndingCapital = 0;
float minOutcome = float.MaxValue;
float maxOutcome = float.MinValue;
for (int i=0; i < numSimulations; ++i)
for (int j=0; j < numSteps; ++j)
for (; p < holdOutLength - 1; ++p)
if (rnd.NextDouble() > chanceChain[p])
capital -= capital * lossPct * leverageFactor;
capital += capital * (winPct[p] - trailStopPct) + leverageFactor;
capital += capital * winPct[holdOutLength - 1] * leverageFactor;
if (rnd.NextDouble() <= bonusGainChance)
capital += capital * maxBonusGainPct * leverageFactor * (float)rnd.NextDouble();
minOutcome = Math.Min(minOutcome, capital);
maxOutcome = Math.Max(maxOutcome, capital);
totalEndingCapital += capital;
float avgEndingCapital = totalEndingCapital / numSimulations;
Console.WriteLine("Min: " + minOutcome.ToString("N") + "\n" +
"Max: " + maxOutcome.ToString("N") + "\n" +
"Avg: " + avgEndingCapital.ToString("N"));