// ------------------------------ public override void Reset() { base.Reset(); openPosition = 0; predictorExtremes = null; predictorMeanRev = null; predictorADX = null; Setup(true); }
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); predictorMeanRev = new Data.Predictors.MeanReversion(pair, 10800); predictorADX = new Data.Predictors.ADX(pair); predictorVolume = new Data.Predictors.Volume(pair, 300, 3600); 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]); predictorADX.Recalculate(tickerList.ToArray()); if (i % 100 == 0) { Utility.ThreadManager.ReportAlive("MeanRevADX"); } } }