Remove timeframe from strategy (#13)
This commit is contained in:
@@ -13,7 +13,7 @@ public class RSIDivergenceStrategy : Strategy
|
||||
private const int UpperBand = 70;
|
||||
private const int LowerBand = 30;
|
||||
|
||||
public RSIDivergenceStrategy(string name, Timeframe timeframe, int period) : base(name, timeframe, StrategyType.RsiDivergence)
|
||||
public RSIDivergenceStrategy(string name, int period) : base(name, StrategyType.RsiDivergence)
|
||||
{
|
||||
Period = period;
|
||||
Signals = new List<Signal>();
|
||||
@@ -91,7 +91,7 @@ public class RSIDivergenceStrategy : Strategy
|
||||
// Price go down but RSI go up
|
||||
if (currentCandle.Close < lowPrices.TakeLast(Period.Value).Min(p => p.Close))
|
||||
{
|
||||
AddSignal(currentCandle, Timeframe, TradeDirection.Long);
|
||||
AddSignal(currentCandle, TradeDirection.Long);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -164,7 +164,7 @@ public class RSIDivergenceStrategy : Strategy
|
||||
// Price go up but RSI go down
|
||||
if (currentCandle.Close > highPrices.TakeLast(Period.Value).Max(p => p.Close))
|
||||
{
|
||||
AddSignal(currentCandle, Timeframe, TradeDirection.Short);
|
||||
AddSignal(currentCandle, TradeDirection.Short);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -194,9 +194,10 @@ public class RSIDivergenceStrategy : Strategy
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSignal(CandleRsi candleSignal, Timeframe timeframe, TradeDirection direction)
|
||||
private void AddSignal(CandleRsi candleSignal, TradeDirection direction)
|
||||
{
|
||||
var signal = new Signal(MiscExtensions.ParseEnum<Ticker>(candleSignal.Ticker), direction, Confidence.Low, candleSignal, candleSignal.Date, candleSignal.Exchange, timeframe, Type, SignalType);
|
||||
var signal = new Signal(MiscExtensions.ParseEnum<Ticker>(candleSignal.Ticker), direction, Confidence.Low,
|
||||
candleSignal, candleSignal.Date, candleSignal.Exchange, Type, SignalType);
|
||||
|
||||
if (Signals.Count(s => s.Identifier == signal.Identifier) < 1)
|
||||
{
|
||||
@@ -216,7 +217,6 @@ public class RSIDivergenceStrategy : Strategy
|
||||
private List<CandleRsi> MapRsiToCandle(IReadOnlyCollection<RsiResult> rsiResult,
|
||||
IEnumerable<Candle> candles)
|
||||
{
|
||||
|
||||
return candles.Select(c => new CandleRsi()
|
||||
{
|
||||
Close = c.Close,
|
||||
@@ -231,4 +231,4 @@ public class RSIDivergenceStrategy : Strategy
|
||||
{
|
||||
public double Rsi { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user