using SignalsTest; public static class Confirmations { public static float GetTWSConfirmation(List 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 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; } public static List GetResistanceLeevls(List reports, float tolerance = 0.1f, int steps = 5){ List allResistances = new List(); decimal highest = 0; decimal lowest = 1000000000000000; int lastMACross = 0; for(int k =0; k < reports.Count; k++){ if(highest < reports[k].High){ highest = reports[k].High; } if(lowest > reports[k].Low){ lowest = reports[k].Low; } if(k reports[k].High; bool MATopBefore = reports[k-1].SMA20 > reports[k-1].High; bool MACrossed = MATopBefore!=MATopNow; if(!MACrossed){continue;}//No cross if(lastMACross == 0){ lastMACross = k; continue; //First Cross } //Get lowest point between this and last cross decimal lowestInPeriod = 1000000; for(int i=k; i < lastMACross; i++ ){ if(reports[i].Low < lowestInPeriod){ lowestInPeriod=reports[i].Low; } } allResistances.Add(lowestInPeriod); } return allResistances; } }