本文整理汇总了C#中StockSerie.GenerateDailyFromIntraday方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.GenerateDailyFromIntraday方法的具体用法?C# StockSerie.GenerateDailyFromIntraday怎么用?C# StockSerie.GenerateDailyFromIntraday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSerie
的用法示例。
在下文中一共展示了StockSerie.GenerateDailyFromIntraday方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyTo
public override void ApplyTo(StockSerie stockSerie)
{
int period = (int)this.Parameters[0];
int smoothing = (int)this.Parameters[1];
FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW).CalculateEMA(smoothing);
FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH).CalculateEMA(smoothing);
FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE).CalculateEMA(smoothing);
FloatSerie pivotSerie = new FloatSerie(stockSerie.Count, "PIVOT");
FloatSerie s1Serie = new FloatSerie(stockSerie.Count, "S1");
FloatSerie s2Serie = new FloatSerie(stockSerie.Count, "S2");
FloatSerie s3Serie = new FloatSerie(stockSerie.Count, "S3");
FloatSerie r1Serie = new FloatSerie(stockSerie.Count, "R1");
FloatSerie r2Serie = new FloatSerie(stockSerie.Count, "R2");
FloatSerie r3Serie = new FloatSerie(stockSerie.Count, "R3");
this.Series[0] = pivotSerie;
this.Series[1] = s1Serie;
this.Series[2] = s2Serie;
this.Series[3] = s3Serie;
this.Series[4] = r1Serie;
this.Series[5] = r2Serie;
this.Series[6] = r3Serie;
// Detecting events
this.CreateEventSeries(stockSerie.Count);
if (stockSerie.StockName.StartsWith("INT_"))
{
List<StockDailyValue> dailyValues = stockSerie.GenerateDailyFromIntraday();
IEnumerator<StockDailyValue> dailyEnumerator = dailyValues.GetEnumerator();
dailyEnumerator.Reset();
dailyEnumerator.MoveNext();
StockDailyValue dailyValue = dailyEnumerator.Current;
float pivot;
float s1;
float r1;
float r2;
float s2;
float r3;
float s3;
dailyValue.CalculatePivot(out pivot, out s1, out r1, out r2, out s2, out r3, out s3);
DateTime intradayBarDate = stockSerie.Values.First().DATE.Date;
int count = 0;
bool first = true;
foreach (StockDailyValue intradayValue in stockSerie.Values)
{
if (intradayBarDate != intradayValue.DATE.Date)
{
if (first)
{
first = false;
}
else
{
dailyEnumerator.MoveNext();
dailyEnumerator.Current.CalculatePivot(out pivot, out s1, out r1, out r2, out s2, out r3,
out s3);
}
intradayBarDate = intradayValue.DATE.Date;
}
pivotSerie[count] = pivot;
r1Serie[count] = r1;
s1Serie[count] = s1;
r2Serie[count] = r2;
s2Serie[count] = s2;
r3Serie[count] = r3;
s3Serie[count] = s3;
count++;
}
}
else
{
for (int i = 0; i <= period; i++)
{
s1Serie[i] = closeSerie[i];
s2Serie[i] = closeSerie[i];
s3Serie[i] = closeSerie[i];
r1Serie[i] = closeSerie[i];
r2Serie[i] = closeSerie[i];
r3Serie[i] = closeSerie[i];
}
for (int i = period + 1; i < stockSerie.Count; i++)
{
float low = lowSerie.GetMin(i - period - 1, i - 1);
float high = highSerie.GetMax(i - period - 1, i - 1);
float pivot = (low + high + closeSerie[i - 1]) / 3;
pivotSerie[i] = pivot;
r1Serie[i] = (2 * pivot) - low;
s1Serie[i] = (2 * pivot) - high;
//.........这里部分代码省略.........