private static void ChangeIndicatorByMultiplier(ME2Indicator ind, double multiplier) { //194 correction - calcs already run; all props are stand alone ind.IndTMAmount = ind.IndTMAmount * multiplier; ind.IndTLAmount = ind.IndTLAmount * multiplier; ind.IndTUAmount = ind.IndTUAmount * multiplier; }
public static void AddME2IndicatorToStocks(this ME2IndicatorStock baseStat, ME2Indicator indicator) { //make sure that each indicator has a corresponding stock if (baseStat.ME2IndicatorStocks == null) { baseStat.ME2IndicatorStocks = new List <ME2IndicatorStock>(); } if (!baseStat.ME2IndicatorStocks .Any(s => s.TME2Label == indicator.IndLabel)) { if (indicator.IndLabel != string.Empty) { ME2IndicatorStock stock = new ME2IndicatorStock(indicator.CalcParameters); stock.TME2Description = indicator.IndDescription; stock.TME2Name = indicator.IndName; stock.TME2Label = indicator.IndLabel; stock.TME2Type = indicator.IndType; stock.TME2RelLabel = indicator.IndRelLabel; stock.TME2TAmount = indicator.IndTAmount; stock.TME2TUnit = indicator.IndTUnit; stock.TME2TD1Amount = indicator.IndTD1Amount; stock.TME2TD1Unit = indicator.IndTD1Unit; stock.TME2TD2Amount = indicator.IndTD2Amount; stock.TME2TD2Unit = indicator.IndTD2Unit; stock.TME2MathResult = indicator.IndMathResult; stock.TME2MathSubType = indicator.IndMathSubType; stock.TME2TMAmount = indicator.IndTMAmount; stock.TME2TMUnit = indicator.IndTMUnit; stock.TME2TLAmount = indicator.IndTLAmount; stock.TME2TLUnit = indicator.IndTLUnit; stock.TME2TUAmount = indicator.IndTUAmount; stock.TME2TUUnit = indicator.IndTUUnit; stock.TME2MathOperator = indicator.IndMathOperator; stock.TME2MathExpression = indicator.IndMathExpression; stock.TME2Date = indicator.IndDate; stock.TME2MathType = indicator.IndMathType; stock.TME2BaseIO = indicator.IndBaseIO; stock.TME21Amount = indicator.Ind1Amount; stock.TME21Unit = indicator.Ind1Unit; stock.TME22Amount = indicator.Ind2Amount; stock.TME22Unit = indicator.Ind2Unit; stock.TME25Amount = indicator.Ind5Amount; stock.TME25Unit = indicator.Ind5Unit; stock.TME23Amount = indicator.Ind3Amount; stock.TME23Unit = indicator.Ind3Unit; stock.TME24Amount = indicator.Ind4Amount; stock.TME24Unit = indicator.Ind4Unit; //test stock.TME2N = 1; //add the stock to the basestat baseStat.ME2IndicatorStocks.Add(stock); } } else { //update the identifiers in case they have changed ME2IndicatorStock stock = baseStat.ME2IndicatorStocks .FirstOrDefault(s => s.TME2Label == indicator.IndLabel); if (stock != null) { stock.TME2Description = indicator.IndDescription; stock.TME2Name = indicator.IndName; stock.TME2Label = indicator.IndLabel; stock.TME2Type = indicator.IndType; stock.TME2RelLabel = indicator.IndRelLabel; stock.TME2TAmount = indicator.IndTAmount; stock.TME2TUnit = indicator.IndTUnit; stock.TME2TD1Amount = indicator.IndTD1Amount; stock.TME2TD1Unit = indicator.IndTD1Unit; stock.TME2TD2Amount = indicator.IndTD2Amount; stock.TME2TD2Unit = indicator.IndTD2Unit; stock.TME2MathResult = indicator.IndMathResult; stock.TME2MathSubType = indicator.IndMathSubType; stock.TME2TMAmount = indicator.IndTMAmount; stock.TME2TMUnit = indicator.IndTMUnit; stock.TME2TLAmount = indicator.IndTLAmount; stock.TME2TLUnit = indicator.IndTLUnit; stock.TME2TUAmount = indicator.IndTUAmount; stock.TME2TUUnit = indicator.IndTUUnit; stock.TME2MathOperator = indicator.IndMathOperator; stock.TME2MathExpression = indicator.IndMathExpression; stock.TME2Date = indicator.IndDate; stock.TME2MathType = indicator.IndMathType; stock.TME2BaseIO = indicator.IndBaseIO; stock.TME21Amount = indicator.Ind1Amount; stock.TME21Unit = indicator.Ind1Unit; stock.TME22Amount = indicator.Ind2Amount; stock.TME22Unit = indicator.Ind2Unit; stock.TME25Amount = indicator.Ind5Amount; stock.TME25Unit = indicator.Ind5Unit; stock.TME23Amount = indicator.Ind3Amount; stock.TME23Unit = indicator.Ind3Unit; stock.TME24Amount = indicator.Ind4Amount; stock.TME24Unit = indicator.Ind4Unit; //test stock.TME2N++; } } }
public static void AddME2IndicatorToStocks(this ME2Total1 baseStat, ME2Indicator indicator) { //make sure that each indicator has a corresponding stock if (baseStat.Stocks == null) { baseStat.Stocks = new List <ME2Stock>(); } if (!baseStat.Stocks .Any(s => s.TME2Label == indicator.IndLabel)) { if (!string.IsNullOrEmpty(indicator.IndLabel)) { ME2Total1 stock = new ME2Total1(indicator.CalcParameters); stock.TME2Description = indicator.IndDescription; stock.TME2Name = indicator.IndName; stock.TME2Label = indicator.IndLabel; stock.TME2Type = indicator.IndType; stock.TME2RelLabel = indicator.IndRelLabel; stock.TME2TAmount = indicator.IndTAmount; stock.TME2TUnit = indicator.IndTUnit; stock.TME2TD1Amount = indicator.IndTD1Amount; stock.TME2TD1Unit = indicator.IndTD1Unit; stock.TME2TD2Amount = indicator.IndTD2Amount; stock.TME2TD2Unit = indicator.IndTD2Unit; stock.TME2MathResult = indicator.IndMathResult; stock.TME2MathSubType = indicator.IndMathSubType; stock.TME2TMAmount = indicator.IndTMAmount; stock.TME2TMUnit = indicator.IndTMUnit; stock.TME2TLAmount = indicator.IndTLAmount; stock.TME2TLUnit = indicator.IndTLUnit; stock.TME2TUAmount = indicator.IndTUAmount; stock.TME2TUUnit = indicator.IndTUUnit; stock.TME2MathOperator = indicator.IndMathOperator; stock.TME2MathExpression = indicator.IndMathExpression; stock.TME2Date = indicator.IndDate; stock.TME2MathType = indicator.IndMathType; stock.TME2BaseIO = indicator.IndBaseIO; stock.TME21Amount = indicator.Ind1Amount; stock.TME21Unit = indicator.Ind1Unit; stock.TME22Amount = indicator.Ind2Amount; stock.TME22Unit = indicator.Ind2Unit; stock.TME25Amount = indicator.Ind5Amount; stock.TME25Unit = indicator.Ind5Unit; stock.TME23Amount = indicator.Ind3Amount; stock.TME23Unit = indicator.Ind3Unit; stock.TME24Amount = indicator.Ind4Amount; stock.TME24Unit = indicator.Ind4Unit; //test stock.TME2N = 1; //add the indicator to this stock stock.ME2Indicators.Add(indicator); //add the stock to the basestat baseStat.Stocks.Add(stock); } } else { //this is the same as the ME2Total stock in previous condition ME2Stock stock = baseStat.Stocks .FirstOrDefault(s => s.TME2Label == indicator.IndLabel); if (stock != null) { stock.TME2TAmount += indicator.IndTAmount; stock.TME2TMAmount += indicator.IndTMAmount; stock.TME2TLAmount += indicator.IndTLAmount; stock.TME2TUAmount += indicator.IndTUAmount; stock.TME21Amount += indicator.Ind1Amount; stock.TME22Amount += indicator.Ind2Amount; stock.TME25Amount += indicator.Ind5Amount; stock.TME23Amount += indicator.Ind3Amount; stock.TME24Amount += indicator.Ind4Amount; //test stock.TME2N++; //add the indicator to this stock stock.ME2Indicators.Add(indicator); } } }