本文整理汇总了C#中IContext.CreatePane方法的典型用法代码示例。如果您正苦于以下问题:C# IContext.CreatePane方法的具体用法?C# IContext.CreatePane怎么用?C# IContext.CreatePane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContext
的用法示例。
在下文中一共展示了IContext.CreatePane方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
public PnLReport draw(IContext context)
{
IPane profitPane = context.CreatePane("Profit", 20.0, true);
if (null != profitSource) {
profitPane.AddList(
"ProfitPerMonth",
profitSource,
ListStyles.HISTOHRAM,
0x336699,
LineStyles.SOLID,
PaneSides.VSIDE_LAST
);
}
if (null != maxLossSource) {
profitPane.AddList(
"MaxLossPerMonth",
maxLossSource,
ListStyles.HISTOHRAM,
0xff00000,
LineStyles.SOLID,
PaneSides.VSIDE_LAST
);
}
if (null != profitSource) {
IList<double> profitSma = context.GetData(
"ProfitSma",
new[] {"3"}, delegate {
return Series.SMA(profitSource, 3);
}
);
profitPane.AddList(
"ProfitPerMonthSma",
profitSma,
ListStyles.LINE,
0xff0000,
LineStyles.SOLID,
PaneSides.LEFT
);
}
return this;
}
示例2: draw
public void draw(IContext context)
{
ISecurity baseSource = source.getBaseSource();
IDictionary<int, Trade> trades = source.getBarIndexedTrades();
IList<double> losses = new List<double>(baseSource.Bars.Count);
IList<double> wins = new List<double>(baseSource.Bars.Count);
for (int i = 0; i < baseSource.Bars.Count; i++) {
if (trades.ContainsKey(i)) {
if (trades[i].getProfit() > 0) {
wins.Add(1);
losses.Add(0);
} else {
wins.Add(0);
losses.Add(1);
}
} else {
wins.Add(0);
losses.Add(0);
}
}
IPane tradesPanel = context.CreatePane("Trades", 10.0, true);
tradesPanel.AddList(
"Win trades",
wins,
ListStyles.HISTOHRAM,
0x00ff00,
LineStyles.SOLID,
PaneSides.VSIDE_LAST
);
tradesPanel.AddList(
"Loss trades",
losses,
ListStyles.HISTOHRAM,
0xff0000,
LineStyles.SOLID,
PaneSides.VSIDE_LAST
);
}