Exemple #1
0
        public override void Setup(bool simulate = false)
        {
            GUI.GUIManager.AddStrategyScreenPair(this.pair);

            // ----------------------------------

            SetupRules();

            // ----------------------------------

            // Check file if this has been bought already
            double openPos = Utility.TradeTracker.GetOpenPosition(pair);

            LastBuyTime  = Utility.TradeTracker.GetOpenPositionBuyTime(pair);
            openPosition = openPos;

            TickerChangedEventArgs lastTicker = Data.Store.GetLastTicker(pair);

            if (lastTicker == null)
            {
                throw new Exception("Couldn't build timeframe model for " + pair + " - no tickers available");
            }

            predictorExtremes = new Data.Predictors.PriceExtremes(pair);
            predictorMACD     = new Data.Predictors.MACD(pair, 7200);
            predictorVolume   = new Data.Predictors.Volume(pair, 300, 7200);
            predictorMeanRev  = new Data.Predictors.MeanReversion(pair, 7200);

            TickerChangedEventArgs[] tickers = Data.Store.GetTickerData(pair);
            if (tickers == null)
            {
                throw new Exception("Couldn't build predictor history for " + pair + " - no tickers available");
            }

            predictorExtremes.Update(tickers);
            predictorVolume.Recalculate(tickers);
            predictorMeanRev.Recalculate(tickers);

            List <TickerChangedEventArgs> tickerList = new List <TickerChangedEventArgs>();

            for (int i = 0; i < tickers.Length; i++)
            {
                tickerList.Add(tickers[i]);

                predictorMACD.Recalculate(tickerList.ToArray());

                if (i % 100 == 0)
                {
                    Utility.ThreadManager.ReportAlive("MeanRevADX");
                }
            }
        }
Exemple #2
0
        public override void UpdatePredictors()
        {
            TickerChangedEventArgs lastTicker = Data.Store.GetLastTicker(pair);
            double lastPrice = lastTicker.MarketData.PriceLast;
            double buyPrice  = lastTicker.MarketData.OrderTopBuy;
            double sellPrice = lastTicker.MarketData.OrderTopSell;

            TickerChangedEventArgs[] tickers = Data.Store.GetTickerData(pair);
            if (tickers == null)
            {
                throw new Exception("Data store returned NULL tickers for pair " + pair);
            }

            predictorExtremes.Update(tickers);
            predictorVolume.Recalculate(tickers);
            predictorPriceDelta.Recalculate(tickers);

            Utility.TradeTracker.UpdateOpenPosition(pair, buyPrice);

            GUI.GUIManager.SetPairSummary(this.pair, tickers, lastTicker.MarketData.Volume24HourBase);
        }
Exemple #3
0
        public override void Setup(bool simulate = false)
        {
            GUI.GUIManager.AddStrategyScreenPair(this.pair);

            // ----------------------------------

            SetupRules();

            // ----------------------------------

            // Check file if this has been bought already
            double openPos = Utility.TradeTracker.GetOpenPosition(pair);

            LastBuyTime  = Utility.TradeTracker.GetOpenPositionBuyTime(pair);
            openPosition = openPos;

            TickerChangedEventArgs lastTicker = Data.Store.GetLastTicker(pair);

            if (lastTicker == null)
            {
                throw new Exception("Couldn't build timeframe model for " + pair + " - no tickers available");
            }

            predictorExtremes   = new Data.Predictors.PriceExtremes(pair);
            predictorVolume     = new Data.Predictors.Volume(pair, 300, 3600);
            predictorPriceDelta = new Data.Predictors.PriceDelta(pair, 300);

            TickerChangedEventArgs[] tickers = Data.Store.GetTickerData(pair);
            if (tickers == null)
            {
                throw new Exception("Couldn't build predictor history for " + pair + " - no tickers available");
            }

            predictorExtremes.Update(tickers);
            predictorVolume.Recalculate(tickers);
            predictorPriceDelta.Recalculate(tickers);
        }