public void RecordMACD(KLine _curKL, ref iEMA ema11, ref iEMA ema22, ref iMACD macd) { ema11.ReceiveTick(_curKL.close); ema22.ReceiveTick(_curKL.close); double DI = ((double)_curKL.close * 2 + _curKL.highest + _curKL.lowest) / 4.0; macd.ReceiveTick(DI / 100); }
public bool ReceiveData(ref int cnt, ref KLine _KL, ref List <KLine> _lst, ref iEMA _ema11, ref iEMA _ema22, ref iMACD _macd, int period, DateTime _CurTime, int open, int highest, int lowest, int close, int amount) { cnt++; if (cnt == 1) { _KL = new KLine(FIFTEEN_MINUTES, _CurTime, open, highest, lowest, close, amount); } else { _KL.amount += amount; if (lowest < _KL.lowest) { _KL.lowest = lowest; } else if (highest > _KL.highest) { _KL.highest = highest; } if (cnt == period / ONE_MINUTE) { _KL.close = close; _KL.datetime = g_CurTime; _lst.Add(_KL); cnt = 0; //記錄MACD RecordMACD(_KL, ref _ema11, ref _ema22, ref _macd); //K棒收集完成 return(true); } } return(false); }