本文整理汇总了C#中BarList类的典型用法代码示例。如果您正苦于以下问题:C# BarList类的具体用法?C# BarList怎么用?C# BarList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BarList类属于命名空间,在下文中一共展示了BarList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Barlist2Tick
/// <summary>
/// create ticks from bars on default interval
/// </summary>
/// <param name="bl"></param>
/// <returns></returns>
public static Tick[] Barlist2Tick(BarList bl)
{
List<Tick> k = new List<Tick>(bl.Count * 4);
foreach (Bar b in bl)
k.AddRange(BarImpl.ToTick(b));
return k.ToArray();
}
示例2: NewBarList
public void NewBarList(BarList barlist)
{
chartControl1.NewBarList(barlist);
Symbol = barlist.Symbol;
Text = chartControl1.Title;
Invalidate(true);
}
示例3: NewBarList
public void NewBarList(BarList barlist)
{
bl = barlist;
Symbol = barlist.Symbol;
Text = Title;
Invalidate(true);
}
示例4: AvgVol
public decimal AvgVol(BarList bl) // gets the average volume across all bars
{
if (!bl.Has(MinimumBarsToAvg,bl.DefaultInterval)) return 0; // if we don't have a bar yet we can't have an avg bar volume
int sum = 0;
for (int i = 0; i < bl.Count; i++)
sum += bl[i].Volume;
return sum / (bl.Count);
}
示例5: BarListImpl
/// <summary>
/// make copy of a barlist. remember you must re-setup GotNewBar events after using this.
/// </summary>
/// <param name="original"></param>
public BarListImpl(BarList original) : this(original.Symbol,original.CustomIntervals,original.Intervals)
{
for (int j = 0; j<original.Intervals.Length; j++)
{
original.DefaultInterval = original.Intervals[j];
for (int i = 0; i < original.Count; i++)
{
addbar(this, original[i, original.Intervals[j]], j);
}
}
}
示例6: ChartImpl
/// <summary>
/// Initializes a new instance of the <see cref="Chart"/> class.
/// </summary>
/// <param name="b">The barlist.</param>
/// <param name="allowtype">if set to <c>true</c> [allowtype] will allow typing/changing of new symbols on the chart window.</param>
public ChartImpl(BarList b,bool allowtype)
{
InitializeComponent();
Paint += new PaintEventHandler(Chart_Paint);
MouseWheel +=new MouseEventHandler(Chart_MouseUp);
if (allowtype) this.KeyUp += new KeyEventHandler(Chart_KeyUp);
if (b != null)
{
bl = b;
Symbol = b.Symbol;
}
}
示例7: ChartControl
/// <summary>
/// Initializes a new instance of the <see cref="Chart"/> class.
/// </summary>
/// <param name="b">The barlist.</param>
/// <param name="allowtype">if set to <c>true</c> [allowtype] will allow typing/changing of new symbols on the chart window.</param>
public ChartControl(BarList b,bool allowtype)
{
InitializeComponent();
Paint += new PaintEventHandler(Chart_Paint);
MouseDoubleClick += new MouseEventHandler(ChartControl_MouseDoubleClick);
MouseWheel +=new MouseEventHandler(Chart_MouseUp);
if (b != null)
{
bl = b;
Symbol = b.Symbol;
}
}
示例8: Chart
/// <summary>
/// Initializes a new instance of the <see cref="Chart"/> class.
/// </summary>
/// <param name="b">The barlist.</param>
/// <param name="allowtype">if set to <c>true</c> [allowtype] will allow typing/changing of new symbols on the chart window.</param>
public Chart(BarList b,bool allowtype)
{
InitializeComponent();
MouseUp +=new MouseEventHandler(chartControl1.Chart_MouseUp);
MouseWheel += new MouseEventHandler(Chart_MouseUp);
if (allowtype) this.KeyUp += new KeyEventHandler(Chart_KeyUp);
if (b != null)
{
chartControl1.NewBarList(b);
Symbol = b.Symbol;
}
FormClosing += new FormClosingEventHandler(Chart_FormClosing);
}
示例9: newBar
public bool newBar(BarList bl)
{
if (!bl.isValid) return false;
Bar c = bl.RecentBar;
if (!c.isValid) return false;
decimal avgvol = Calc.Avg(bl.Vol());
decimal moverequired = c.Open * _percent;
bool voltest = (c.Volume - avgvol) > (avgvol * _bigvolper);
isBigVolume = (ZeroAvgVolIsBig && voltest) || (!ZeroAvgVolIsBig && (avgvol != 0) && voltest);
isBladeDOWN = ((c.Open - c.Close) > moverequired);
isBladeUP = ((c.Close-c.Open) > moverequired);
pctChange = c.Close / c.Open - 1;
return true;
}
示例10: newTick
/// <summary>
/// create bars from ticks
/// </summary>
/// <param name="k"></param>
public void newTick(Tick k)
{
if (bl == null)
{
Symbol = k.symbol;
bl = new BarListImpl(k.symbol);
}
bl.newTick(k);
if (k.isTrade)
{
if (k.trade > highesth)
highesth = k.trade;
if (k.trade < lowestl)
lowestl = k.trade;
}
if (_alwaysupdate)
redraw();
}
示例11: newPoint
/// <summary>
/// create bars from points
/// </summary>
/// <param name="p"></param>
/// <param name="time"></param>
/// <param name="date"></param>
/// <param name="size"></param>
public void newPoint(string symbol, decimal p, int time, int date, int size)
{
if (bl == null)
{
Symbol = symbol;
highesth = SMALLVAL;
bl = new BarListImpl(symbol);
}
bl.newPoint(symbol,p, time, date, size);
if (p!=0)
{
if (p > highesth)
highesth = p;
if (p < lowestl)
lowestl = p;
}
if (_alwaysupdate)
redraw();
}
示例12: newTick
/// <summary>
/// create bars from ticks
/// </summary>
/// <param name="k"></param>
public void newTick(Tick k)
{
if (bl == null)
{
Symbol = k.symbol;
bl = new BarListImpl(BarInterval.FiveMin, k.symbol);
}
bl.newTick(k);
if (k.isTrade)
{
if (k.trade > highesth)
highesth = k.trade;
if (k.trade < lowestl)
lowestl = k.trade;
}
barc = bl.Count;
if (_alwaysupdate)
refresh();
}
示例13: newPoint
/// <summary>
/// create bars from points
/// </summary>
/// <param name="p"></param>
/// <param name="time"></param>
/// <param name="date"></param>
/// <param name="size"></param>
public void newPoint(decimal p, int time, int date, int size)
{
if (bl == null)
{
Symbol = string.Empty;
highesth = SMALLVAL;
bl = new BarListImpl(BarInterval.FiveMin, string.Empty);
}
bl.newPoint(p, time, date, size);
if (p!=0)
{
if (p > highesth)
highesth = p;
if (p < lowestl)
lowestl = p;
}
barc = bl.Count;
if (_alwaysupdate)
refresh();
}
示例14: Lows
/// <summary>
/// gets most recent lows from barlist, for certain number of bars
/// (default is entire list)
/// </summary>
/// <param name="chart"></param>
/// <param name="bars"></param>
/// <returns></returns>
public static decimal[] Lows(BarList chart, int bars)
{
return EndSlice(chart.Low(), bars);
}
示例15: BollingerLower
/// <summary>
/// calculates lower bollinger using open (true) or closing (false) prices, at specified # of standard deviations
/// </summary>
/// <param name="bl"></param>
/// <param name="numStdDevs"></param>
/// <param name="useOpens"></param>
/// <returns></returns>
public static decimal BollingerLower(BarList bl, decimal numStdDevs, bool useOpens)
{
decimal[] prices = useOpens ? bl.Open() : bl.Close();
decimal mean = Avg(prices);
decimal stdev = StdDev(prices);
return mean - stdev * numStdDevs;
}