本文整理匯總了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
//.........這裏部分代碼省略.........