public void AddCandleStick(Candlestick candleStick) { List <Candlestick> candlesticklist = new List <Candlestick>(); candlesticklist.Add(candleStick); candlesticklist.AddRange(_candleSticks.Take(100)); _candleSticks = candlesticklist; Fast.AddCandleStick(candleStick); Slow.AddCandleStick(candleStick); var diff = Fast.Value - Slow.Value; List <decimal> list = new List <decimal>(); list.Add(diff); list.AddRange(MacdLine.Take(100)); MacdLine = list; MacdLineEma.AddCandleStick(new Candlestick() { Close = diff }); list = new List <decimal>(); list.Add(diff - MacdLineEma.Value); list.AddRange(Histogram.Take(100)); Histogram = list; }
public MomentumMacd(string name, StartProgram startProgram) : base(name, startProgram) { TabCreate(BotTabType.Simple); _tab = TabsSimple[0]; _macd = new MacdLine(name + "Macd", false); _macd = (MacdLine)_tab.CreateCandleIndicator(_macd, "MacdArea"); _macd.Save(); _mom = new Momentum(name + "Momentum", false); _mom = (Momentum)_tab.CreateCandleIndicator(_mom, "Momentum"); _mom.Save(); _tab.CandleFinishedEvent += Strateg_CandleFinishedEvent; Slipage = 0; VolumeFix = 1; Load(); DeleteEvent += Strategy_DeleteEvent; }