protected override State <Config> Run(TradingProvider trading, DataProvider data) { decimal stopPrice = data.GetLowestLow(FirstPair, AlgorithmConfiguration.Loss); stopLoss = trading.PlaceFullStoplossSell(FirstPair, stopPrice); return(new InTradeState(_buyOrder, stopLoss)); }
protected override State <Config> Run(TradingProvider trading, DataProvider data) { // Get the lowest low from the last y hours. decimal shortTermTimePrice = data.GetLowestLow(FirstPair, AlgorithmConfiguration.ShortTermTime); // Set first stop loss order at DCMin. _stoploss = trading.PlaceFullStoplossSell(FirstPair, shortTermTimePrice); return(new CheckState(_stoploss)); }
protected override State <Config> Run(TradingProvider trading, DataProvider data) { var pair = AlgorithmConfiguration.TradingPairs.First(); var price = data.GetCurrentPriceTopBid(pair); _stoploss = trading.PlaceFullStoplossSell(pair, price * AlgorithmConfiguration.StopTrail); SetTimer(TimeSpan.FromHours(AlgorithmConfiguration.WaitTime)); return(new NothingState <KeiraNightlyConfiguration>()); }