本文整理汇总了C#中Indicator类的典型用法代码示例。如果您正苦于以下问题:C# Indicator类的具体用法?C# Indicator怎么用?C# Indicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indicator类属于命名空间,在下文中一共展示了Indicator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 "";
}
开发者ID:ericjohnolson,项目名称:NadaNtd,代码行数:26,代码来源:DiseaseDistroCustomValidator.cs
示例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));
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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;
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:29,代码来源:DecycleInverseFisherStrategy.cs
示例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());
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例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;
}
开发者ID:Caml-light,项目名称:pfe-serious-game,代码行数:11,代码来源:Continent.cs
示例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;
}
开发者ID:bizcad,项目名称:LeanJJN,代码行数:13,代码来源:TripleMovingAverageStrategy.cs
示例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;
}
开发者ID:quoctruong,项目名称:BackTestStock,代码行数:13,代码来源:AssetAllocationStrategy.cs
示例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 });
}
开发者ID:ericjohnolson,项目名称:NadaNtd,代码行数:15,代码来源:NadaClass.cs
示例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();
};
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:17,代码来源:NaiveStrategy.cs
示例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");
}
开发者ID:Caml-light,项目名称:pfe-serious-game,代码行数:17,代码来源:Global.cs
示例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();
};
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:25,代码来源:CrossEMAStrategy.cs
示例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();
};
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:25,代码来源:RSIStrategy.cs
示例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();
};
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:26,代码来源:ITrendStrategyJJ.cs
示例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();
};
}
开发者ID:bizcad,项目名称:LeanITrend,代码行数:26,代码来源:MultiSymbolStrategy.cs
示例15: VROC
public VROC(Indicator indicator, int length, Color color)
{
this.indicator = new FreeQuant.Indicators.VROC(indicator.indicator, length, color);
}
开发者ID:heber,项目名称:FreeOQ,代码行数:4,代码来源:VROC.cs
示例16: MOM
public MOM(Indicator indicator, int length, BarData option)
{
this.indicator = new FreeQuant.Indicators.MOM(indicator.indicator, length, EnumConverter.Convert(option));
}
开发者ID:heber,项目名称:FreeOQ,代码行数:4,代码来源:MOM.cs
示例17: MACD
public MACD(Indicator indicator, int length1, int length2, Color color)
{
this.indicator = new FreeQuant.Indicators.MACD(indicator.indicator, length1, length2, color);
}
开发者ID:heber,项目名称:FreeOQ,代码行数:4,代码来源:MACD.cs
示例18: DX
public DX(Indicator indicator, int length)
{
this.indicator = new FreeQuant.Indicators.DX(indicator.indicator, length);
}
开发者ID:heber,项目名称:FreeOQ,代码行数:4,代码来源:DX.cs
示例19: CalculateIndicator
/// <summary>
/// Calculates an indicator and returns OK status.
/// </summary>
private bool CalculateIndicator(SlotTypes slotType, Indicator indicator)
{
#if !DEBUG
try
{
#endif
indicator.Calculate(slotType);
return true;
#if !DEBUG
}
catch (Exception exception)
{
string message = "Please report this error in the support forum!";
if (indicator.CustomIndicator)
message = "Please report this error to the author of the indicator!<br />" +
"You may remove this indicator from the Custom Indicators folder.";
string text =
"<h1>Error: " + exception.Message + "</h1>" +
"<p>" +
"Slot type: <strong>" + slotType + "</strong><br />" +
"Indicator: <strong>" + indicator + "</strong>" +
"</p>" +
"<p>" +
message +
"</p>";
const string caption = "Indicator Calculation Error";
ReportIndicatorError(text, caption);
_indicatorBlackList.Add(indicator.IndicatorName);
return false;
}
#endif
}
开发者ID:krogKrog,项目名称:Forex-Strategy-Builder,代码行数:37,代码来源:GeneratorMath.cs
示例20: MakeColAble
public void MakeColAble(Indicator ind, int b)
{
ind.Activate (b == 1);
}
开发者ID:TTTheMaTTT,项目名称:ProjectTowerDevelopment,代码行数:4,代码来源:ActionTypes.cs
注:本文中的Indicator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论