Remove timeframe from strategy (#13)
This commit is contained in:
@@ -12,11 +12,10 @@ public class StochRsiTrendStrategy : Strategy
|
||||
|
||||
public StochRsiTrendStrategy(
|
||||
string name,
|
||||
Timeframe timeframe,
|
||||
int period,
|
||||
int stochPeriod,
|
||||
int signalPeriod,
|
||||
int smoothPeriods) : base(name, timeframe, StrategyType.StochRsiTrend)
|
||||
int smoothPeriods) : base(name, StrategyType.StochRsiTrend)
|
||||
{
|
||||
Signals = new List<Signal>();
|
||||
StochPeriods = stochPeriod;
|
||||
@@ -34,7 +33,9 @@ public class StochRsiTrendStrategy : Strategy
|
||||
|
||||
try
|
||||
{
|
||||
var stochRsi = Candles.GetStochRsi(Period.Value, StochPeriods.Value, SignalPeriods.Value, SmoothPeriods.Value).RemoveWarmupPeriods().ToList();
|
||||
var stochRsi = Candles
|
||||
.GetStochRsi(Period.Value, StochPeriods.Value, SignalPeriods.Value, SmoothPeriods.Value)
|
||||
.RemoveWarmupPeriods().ToList();
|
||||
var stochRsiCandles = MapStochRsiToCandle(stochRsi, Candles.TakeLast(Period.Value));
|
||||
|
||||
if (stochRsi.Count == 0)
|
||||
@@ -45,11 +46,11 @@ public class StochRsiTrendStrategy : Strategy
|
||||
{
|
||||
if (currentCandle.Signal < 20)
|
||||
{
|
||||
AddSignal(currentCandle, Timeframe, TradeDirection.Long, Confidence.None);
|
||||
AddSignal(currentCandle, TradeDirection.Long, Confidence.None);
|
||||
}
|
||||
else if (currentCandle.Signal > 80)
|
||||
{
|
||||
AddSignal(currentCandle, Timeframe, TradeDirection.Short, Confidence.None);
|
||||
AddSignal(currentCandle, TradeDirection.Short, Confidence.None);
|
||||
}
|
||||
|
||||
previousCandle = currentCandle;
|
||||
@@ -83,10 +84,11 @@ public class StochRsiTrendStrategy : Strategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return emaList;
|
||||
}
|
||||
|
||||
private void AddSignal(CandleStochRsi candleSignal, Timeframe timeframe, TradeDirection direction, Confidence confidence)
|
||||
private void AddSignal(CandleStochRsi candleSignal, TradeDirection direction, Confidence confidence)
|
||||
{
|
||||
var signal = new Signal(
|
||||
MiscExtensions.ParseEnum<Ticker>(candleSignal.Ticker),
|
||||
@@ -95,7 +97,6 @@ public class StochRsiTrendStrategy : Strategy
|
||||
candleSignal,
|
||||
candleSignal.Date,
|
||||
candleSignal.Exchange,
|
||||
timeframe,
|
||||
Type,
|
||||
SignalType);
|
||||
if (!Signals.Any(s => s.Identifier == signal.Identifier))
|
||||
@@ -109,4 +110,4 @@ public class StochRsiTrendStrategy : Strategy
|
||||
public double Signal { get; internal set; }
|
||||
public double StochRsi { get; internal set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user