本文整理汇总了C#中OpenQuant.API.Bar.IsWithinRegularTradingHours方法的典型用法代码示例。如果您正苦于以下问题:C# Bar.IsWithinRegularTradingHours方法的具体用法?C# Bar.IsWithinRegularTradingHours怎么用?C# Bar.IsWithinRegularTradingHours使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQuant.API.Bar
的用法示例。
在下文中一共展示了Bar.IsWithinRegularTradingHours方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnBarOpen
public override void OnBarOpen(Bar bar)
{
if (!bar.IsWithinRegularTradingHours(Instrument.Type))
{
return;
}
if (bar.Size == PeriodConstants.PERIOD_DAILY)
{
return;
}
PublishOpenBar(bar);
base.OnBarOpen(bar);
}
示例2: IsItOkToHandleBar
protected bool IsItOkToHandleBar(Bar bar)
{
if (!bar.IsWithinRegularTradingHours(Instrument.Type))
{
LoggingUtility.WriteTraceFormat(this, "Bar is not within regular trading hours: {0}", bar);
return false;
}
return true;
}
示例3: OnBarOpen
public override void OnBarOpen(Bar bar)
{
if (!bar.IsWithinRegularTradingHours(Instrument.Type))
{
return;
}
if (bar.Size == PeriodConstants.PERIOD_DAILY)
{
// Since we will like to capture any gaps in the current day
// open and corresponding effects of ATR calculations
OnBar(bar);
}
else if (bar.BeginTime.Date >= CurrentValidityDateTime.Date)
{
OnBar(bar);
}
base.OnBarOpen(bar);
}
示例4: OnBar
public override void OnBar(Bar bar)
{
if (!bar.IsWithinRegularTradingHours(Instrument.Type))
{
return;
}
else
{
DataManager.Add(Instrument, bar);
}
try
{
CurrentBarRef = bar;
if (bar.Size == PeriodConstants.PERIOD_DAILY)
{
if (CurrentDailyBarSeries.Count <= AtrPeriod)
{
return;
}
}
if (bar.Size == CurrentExecutionTimePeriodInSeconds)
{
int[] periods = new[]
{
SlowMaPeriod,
FastMaPeriod,
StochasticsDPeriod,
StochasticsKPeriod,
StochasticsSmoothPeriod
};
int maxPeriod = periods.Max();
if (CurrentExecutionBarSeries.Count <= maxPeriod)
{
return;
}
}
// If everything is filled - then exit:
if (IsStrategyOrderFilled)
return;
CurrentClosePrice = bar.Close;
if (bar.Size == PeriodConstants.PERIOD_DAILY)
{
CurrentAtrPrice = DailyAtrIndicator.Last;
if (CurrentClosePrice > 0 && IsBarCloseEnoughForLogging(bar))
{
LoggingUtility.WriteInfoFormat(this,
"Setting ATR to {0:c} which is {1:p} of the last close price {2:c}",
CurrentAtrPrice,
CurrentAtrPrice / CurrentClosePrice,
CurrentClosePrice);
}
}
if (bar.Size == PeriodConstants.PERIOD_DAILY)
{
// We do not need to worry about any other type of bar
return;
}
if (bar.Size == CurrentExecutionTimePeriodInSeconds)
{
// Ensure that intraday indicators are evaluated
GetIsStochInBullishMode(bar);
GetIsStochInBearishMode(bar);
GetIsEmaInBearishMode(bar);
GetIsEmaInBullishMode(bar);
}
if (CurrentAtrPrice <= 0)
{
// need the ATR to process further
return;
}
if (CurrentAskPrice <= 0)
{
// need the Ask to process further
return;
}
if (CurrentBidPrice <= 0)
{
// need the Bid to process further
return;
}
if (GetCurrentDateTime() < CurrentValidityDateTime)
{
return;
}
// 1. If the order is not triggered yet - then check when is the right time to trigger the order
//.........这里部分代码省略.........