本文整理汇总了C#中Indicator类的典型用法代码示例。如果您正苦于以下问题:C# Indicator类的具体用法?C# Indicator怎么用?C# Indicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indicator类属于命名空间,在下文中一共展示了Indicator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Valid
public override string Valid(Indicator indicator, List<IndicatorValue> values)
{
//IndicatorValue currentValue = values.FirstOrDefault(v => v.Indicator.DisplayName == indicator.DisplayName);
//if (currentValue == null)
// return "";
//switch (indicator.DisplayName)
//{
// case "DDLFPopulationAtRisk":
// IndicatorValue related1 = values.FirstOrDefault(v => v.Indicator.DisplayName == "DDLFPopulationRequiringPc");
// if (related1 != null)
// {
// double currentPop, relatedPop;
// if (Double.TryParse(currentValue.DynamicValue, out currentPop) && Double.TryParse(related1.DynamicValue, out relatedPop))
// {
// if (currentPop < relatedPop)
// return Translations.BrettTestErrorMessage;
// }
// }
// break;
// default:
// break;
//}
return "";
}
示例2: Poll_PushedButtonAndNonEmptyBoiler_TurnsOffLight
public void Poll_PushedButtonAndNonEmptyBoiler_TurnsOffLight(
[Frozen]Mock<ICoffeeMaker> coffeeMaker,
Indicator sut)
{
sut.Poll(BoilerStatus.NOT_EMPTY, BrewButtonStatus.PUSHED);
coffeeMaker.Verify(cm => cm.SetIndicatorState(IndicatorState.OFF));
}
示例3: DIFStrategy
public DIFStrategy(Indicator Price, int DecyclePeriod = 20, int InvFisherPeriod = 40, decimal Threshold = 0.9m, decimal Tolerance = 0.001m)
{
// Initialize the fields.
_decyclePeriod = DecyclePeriod;
_invFisherPeriod = InvFisherPeriod;
_threshold = Threshold;
_tolerance = Tolerance;
// Initialize the indicators used by the Strategy.
_price = Price;
DecycleTrend = new Decycle(_decyclePeriod).Of(Price);
InverseFisher = new InverseFisherTransform(_invFisherPeriod).Of(DecycleTrend);
InvFisherRW = new RollingWindow<decimal>(2);
LightSmoothPrice = new Decycle(10).Of(Price);
Momersion = new MomersionIndicator(10, 30).Of(LightSmoothPrice, false);
// Fill the Inverse Fisher rolling windows at every new InverseFisher observation.
// Once the Inverse Fisher rolling windows is ready, at every InverseFisher update, the Check signal method will be called.
InverseFisher.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (InverseFisher.IsReady) InvFisherRW.Add(updated);
if (InvFisherRW.IsReady) CheckSignal();
};
Position = StockState.noInvested;
EntryPrice = null;
ActualSignal = OrderSignal.doNothing;
}
示例4: Poll_PushedButtonAndEmptyBoilerAndPot_TurnsOnLightAndShutsDownButton
public void Poll_PushedButtonAndEmptyBoilerAndPot_TurnsOnLightAndShutsDownButton(
[Frozen]Mock<ICoffeeMaker> coffeeMaker,
Indicator sut)
{
sut.Poll(BoilerStatus.EMPTY, WarmerPlateStatus.WARMER_EMPTY, BrewButtonStatus.PUSHED);
coffeeMaker.Verify(cm => cm.SetIndicatorState(IndicatorState.ON));
coffeeMaker.Verify(cm => cm.GetBrewButtonStatus());
}
示例5: Continent
public Continent(string Name, Indicator pop, Indicator foodNeed,Indicator foodProd, Indicator airQuality, Indicator earthQuality, Indicator seaQuality, Indicator biodiversity)
{
indicators.Add("pop", pop);
indicators.Add("foodNeed", foodNeed);
indicators.Add("foodProd", foodProd);
indicators.Add("airQuality", airQuality);
indicators.Add("earthQuality", earthQuality);
indicators.Add("seaQuality", seaQuality);
indicators.Add("biodiversity", biodiversity);
_Name = Name;
}
示例6: TripleMovingAverageStrategy
public TripleMovingAverageStrategy(Symbol sym, Indicator priceIdentity, MeanReversionAlgorithm algorithm, decimal minBarSize, decimal barDifferenceTolerance)
{
Algorithm = algorithm;
symbol = sym;
trend = new InstantaneousTrend(10).Of(_price);
ema10 = new ExponentialMovingAverage(10).Of(_price);
sma10 = new SimpleMovingAverage(10).Of(_price);
Position = StockState.noInvested;
EntryPrice = null;
ActualSignal = OrderSignal.doNothing;
}
示例7: BackTest
public Portfolio.Portfolio BackTest(Indicator.GenericIndicator indicator, HistoricalDataSet dataSet, Portfolio.Portfolio portfolio)
{
Ranking[][] rankingTable = dataSet.GetRankingTable(indicator);
SetUpPortFolio(portfolio, rankingTable[0]);
for(int i = 1; i < rankingTable.Length; i += 1)
{
UpdatePortfolio(portfolio, rankingTable[i-1], rankingTable[i]);
}
return portfolio;
}
示例8: ParseNotes
protected void ParseNotes(IHaveDynamicIndicatorValues form, Indicator notesIndicator)
{
var notesInd = form.IndicatorValues.FirstOrDefault(i => i.Indicator.DisplayName == "Notes");
if (notesInd != null)
{
if (IsRedistricted)
notesInd.CalcByRedistrict = true;
else if (notesInd.CalcByRedistrict && notesInd.DynamicValue != Notes)
notesInd.CalcByRedistrict = false;
notesInd.DynamicValue = Notes;
}
else
form.IndicatorValues.Add(new IndicatorValue { DynamicValue = Notes, Indicator = notesIndicator, IndicatorId = notesIndicator.Id, CalcByRedistrict = IsRedistricted });
}
示例9: NoStrategy
public NoStrategy(string Symbol, Indicator Price, Indicator Trend)
{
_symbol = Symbol;
_price = Price;
_trend = Trend;
_trend.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (!_trend.IsReady)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("From TREND EVENT HANDLER, Trend is NOT ready");
Console.ResetColor();
}
CheckSignal();
};
}
示例10: AsiaInitilization
private void AsiaInitilization()
{
string name = "Asie";
Debug.Log("Initialization of Asia continent start");
Indicator pop = new Indicator("Population", 100.0, 0.99, 50.0, 1.0);
Indicator foodNeed = new Indicator("Hunger", 100.0, 0.99, 50.0, 1.0);
Indicator foodProd = new Indicator("Food", 100.0, 0.99, 50.0, 1.0);
Indicator airQuality = new Indicator("Air", 100.0, 0.99, 50.0, 1.0);
Indicator earthQuality = new Indicator("Earth", 100.0, 0.99, 50.0, 1.0);
Indicator seaQuality = new Indicator("Sea", 100.0, 0.99, 50.0, 1.0);
Indicator biodiversity = new Indicator("Biodiversity", 10000000, 0.99, 10000000, 1.0);
Continent continentAsia = new Continent(name, pop, foodNeed, foodProd, airQuality, earthQuality, seaQuality, biodiversity);
Global.instance.continents.Add(name, continentAsia);
Debug.Log("Initialization of Asia continent end");
}
示例11: CrossEMAStrategy
/// <summary>
/// Initializes a new instance of the <see cref="CrossEMAStrategy"/> class.
/// </summary>
/// <param name="Price">The injected price indicator.</param>
/// <param name="SlowEMAPeriod">The slow EMA period.</param>
/// <param name="FastEMAPeriod">The fast EMA period.</param>
public CrossEMAStrategy(Indicator Price, int SlowEMAPeriod = 10, int FastEMAPeriod = 50)
{
// Initialize fields.
_price = Price;
fastEMA = new ExponentialMovingAverage(FastEMAPeriod).Of(_price);
slowEMA = new ExponentialMovingAverage(SlowEMAPeriod).Of(_price);
ActualSignal = OrderSignal.doNothing;
Position = StockState.noInvested;
EntryPrice = null;
// Fill the EMA difference rolling windows at every new slowEMA observation. Once the
// rolling windows is ready, at every indicator update the CheckSignal method will be called.
slowEMA.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (slowEMA.IsReady) EMADiffRW.Add(fastEMA - slowEMA);
if (EMADiffRW.IsReady) CheckSignal();
};
}
示例12: RSIStrategy
/// <summary>
/// Initializes a new instance of the <see cref="CrossEMAStrategy"/> class.
/// </summary>
/// <param name="Price">The injected price indicator.</param>
/// <param name="SlowEMAPeriod">The slow EMA period.</param>
/// <param name="FastEMAPeriod">The fast EMA period.</param>
public RSIStrategy(Indicator Price, int RSIPeriod = 40, decimal Threshold = 20)
{
// Initialize fields.
_threshold = Threshold;
_price = Price;
ActualSignal = OrderSignal.doNothing;
Position = StockState.noInvested;
EntryPrice = null;
rsi = new RelativeStrengthIndex(RSIPeriod).Of(_price);
// Fill the RSI rolling windows at every new RSI update. Once the
// rolling windows is ready, at every indicator update the CheckSignal method will be called.
rsi.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (rsi.IsReady) rsiRW.Add(rsi);
if (rsiRW.IsReady) CheckSignal();
};
}
示例13: ITrendStrategyJJ
/// <summary>
/// Initializes a new instance of the <see cref="ITrendStrategy"/> class.
/// </summary>
/// <param name="period">The period of the Instantaneous trend.</param>
public ITrendStrategyJJ(Indicator price, int period, decimal tolerance = 0.001m, decimal revetPct = 1.0015m,
RevertPositionCheck checkRevertPosition = RevertPositionCheck.vsTrigger)
{
_price = price;
ITrend = new InstantaneousTrend(period).Of(price);
ITrendMomentum = new Momentum(2).Of(ITrend);
MomentumWindow = new RollingWindow<decimal>(2);
Position = StockState.noInvested;
EntryPrice = null;
ActualSignal = OrderSignal.doNothing;
_tolerance = tolerance;
_revertPCT = revetPct;
_checkRevertPosition = checkRevertPosition;
ITrendMomentum.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (ITrendMomentum.IsReady) MomentumWindow.Add(ITrendMomentum.Current.Value);
if (MomentumWindow.IsReady) CheckSignal();
};
}
示例14: MultiSymbolStrategy
/// <summary>
/// Initializes a new instance of the <see cref="ITrendStrategy"/> class.
/// </summary>
/// <param name="period">The period of the Instantaneous trend.</param>
public MultiSymbolStrategy(Indicator price, int period, decimal tolerance = 0.001m, decimal revetPct = 1.0015m,
RevertPositionCheck checkRevertPosition = RevertPositionCheck.vsTrigger)
{
_price = price;
sma = new SimpleMovingAverage(period).Of(price);
SMAMomentum = new Momentum(2).Of(sma);
MomentumWindow = new RollingWindow<decimal>(2);
Position = StockState.noInvested;
EntryPrice = null;
ActualSignal = OrderSignal.doNothing;
_tolerance = tolerance;
_revertPCT = revetPct;
_checkRevertPosition = checkRevertPosition;
SMAMomentum.Updated += (object sender, IndicatorDataPoint updated) =>
{
if (SMAMomentum.IsReady) MomentumWindow.Add(SMAMomentum.Current.Value);
if (MomentumWindow.IsReady) CheckSignal();
};
}
示例15: VROC
public VROC(Indicator indicator, int length, Color color)
{
this.indicator = new FreeQuant.Indicators.VROC(indicator.indicator, length, color);
}