public void MainLoop() { while (true) { Decision = Refreash(); if (Trader.CheckTrad(Decision, Ticker.CurrentValue) == ExchangeStatus.buy && firstBuyFlag) { firstBuyFlag = false; } RefreashedEventArgs refreashEA = new RefreashedEventArgs(Ticker.CurrentValue, Ticker.LastValue, Ticker.Status, Decision, Trader.CurrentBitcoinNum, Trader.CurrentCashNum); onRefreash(refreashEA); if (IsAlert && ((AlertUpper != 0 && Ticker.CurrentValue >= AlertUpper) || (AlertLower != 0 && Ticker.CurrentValue <= AlertLower))) { AlertEventArgs alertEA = new AlertEventArgs(Ticker.CurrentValue, AlertUpper, AlertLower); alerted(alertEA); } Thread.Sleep((int)SleepTime); } }