當前位置: 首頁>>代碼示例>>C#>>正文


C# BarInterval類代碼示例

本文整理匯總了C#中BarInterval的典型用法代碼示例。如果您正苦於以下問題:C# BarInterval類的具體用法?C# BarInterval怎麽用?C# BarInterval使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BarInterval類屬於命名空間,在下文中一共展示了BarInterval類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawBarList

        public Image DrawBarList(BarListImpl bl, BarInterval bi,Color up, Color down)
        {
            bl.DefaultInterval = bi;
            Bitmap sl = new Bitmap(w, h);
            Graphics g = Graphics.FromImage(sl);
            high = Calc.HH(bl);
            low = Calc.LL(bl);
            decimal range = high - low;
            int pixperdollar = range != 0 ? (int)(h / range) : 0;
            int pixperbar = bl.Count != 0 ? (int)(w / (decimal)bl.Count) : 0;
            for (int i = 0; i< bl.Count; i++)
            {
                Bar b = bl[i,bi];
                Pen p = new Pen(b.Close>=b.Open ? up : down);
                g.DrawLine(p, i * pixperbar, h-(int)((b.Low - low) * pixperdollar), i * pixperbar, h-(int)((b.High - low) * pixperdollar));
            }
            return sl;

        }
開發者ID:antonywu,項目名稱:tradelink,代碼行數:19,代碼來源:SparkLine.cs

示例2: BarListImpl

 /// <summary>
 /// creates a barlist with array of custom intervals
 /// </summary>
 /// <param name="symbol"></param>
 /// <param name="intervals"></param>
 public BarListImpl(string symbol, int[] intervals, BarInterval[] types)
 {            // set symbol
     _sym = symbol;
     // set intervals requested
     _availint = intervals;
     // size length of interval data to # of requested intervals
     _intdata = new IntervalData[intervals.Length];
     // create interval data object for each interval
     for (int i = 0; i < intervals.Length; i++)
     {
         try
         {
             // save index to this data for the interval
             _intdataidx.Add(intervals[i], i);
         }
         // if key was already present, already had this interval
         catch (Exception) { continue; }
         // set default interval to first one
         if (i == 0)
             _defaultint = intervals[0];
         // create data object appropriate for type of interval
         switch (types[i])
         {
             case BarInterval.CustomTicks:
                 _intdata[i] = new TickIntervalData(intervals[i]);
                 break;
             case BarInterval.CustomVol:
                 _intdata[i] = new VolIntervalData(intervals[i]);
                 break;
             default:
                 _intdata[i] = new TimeIntervalData(intervals[i]);
                 break;
         }
     
         // subscribe to bar events
         _intdata[i].NewBar += new SymBarIntervalDelegate(BarListImpl_NewBar);
     }
 }
開發者ID:antonywu,項目名稱:tradelink,代碼行數:43,代碼來源:BarListImpl.cs

示例3: FromTIK

 /// <summary>
 /// create barlist from a tik file using given intervals/types
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="uselast"></param>
 /// <param name="usebid"></param>
 /// <param name="intervals"></param>
 /// <param name="types"></param>
 /// <returns></returns>
 public static BarList FromTIK(string filename, bool uselast, bool usebid, int[] intervals, BarInterval[] types)
 {
     _uselast = uselast;
     _usebid = usebid;
     SecurityImpl s = SecurityImpl.FromTIK(filename);
     s.HistSource.gotTick += new TickDelegate(HistSource_gotTick);
     _fromepf = new BarListImpl(s.Symbol,intervals,types);
     while (s.HistSource.NextTick()) ;
     return _fromepf;
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:19,代碼來源:BarListImpl.cs

示例4: BarsBackFromDate

 public static int BarsBackFromDate(BarInterval interval, int startdate, int enddate) { return BarsBackFromDate(interval, Util.ToDateTime(startdate, 0), Util.ToDateTime(enddate,Util.ToTLTime())); }
開發者ID:antonywu,項目名稱:tradelink,代碼行數:1,代碼來源:BarImpl.cs

示例5: Has

 /// <summary>
 /// returns true if barslist has at least minimum # of bars for specified interval
 /// </summary>
 /// <param name="minBars"></param>
 /// <param name="interval"></param>
 /// <returns></returns>
 public bool Has(int minBars, BarInterval interval)
 {
     return minBars<=CountInterval(interval);
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:10,代碼來源:BarListImpl.cs

示例6: Bollinger

 public Bollinger(decimal sds, BarInterval bi, int lookback)
 { this.sds = sds;
 this.bi = bi;
 this.lookback = lookback;
 isbarcons = true;
 }
開發者ID:antonywu,項目名稱:tradelink,代碼行數:6,代碼來源:Bollinger.cs

示例7: BarListImpl

 /// <summary>
 /// creates a barlist with requested interval.  symbol will be defined by first tick received
 /// </summary>
 /// <param name="interval"></param>
 public BarListImpl(BarInterval interval)
     : this(string.Empty, new BarInterval[] { interval })
 {
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:8,代碼來源:BarListImpl.cs

示例8: CountInterval

 /// <summary>
 /// gets count of bars in specified interval
 /// </summary>
 /// <param name="interval"></param>
 /// <returns></returns>
 public int CountInterval(BarInterval interval)
 {
     return _intdata[_intdataidx[(int)interval]].Count();
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:9,代碼來源:BarListImpl.cs

示例9: LastInterval

 /// <summary>
 /// gets the last bar in specified interval
 /// </summary>
 /// <param name="interval"></param>
 /// <returns></returns>
 public int LastInterval(BarInterval interval)
 {
     return _intdata[_intdataidx[(int)interval]].Last();
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:9,代碼來源:BarListImpl.cs

示例10: GetNearestIntraBar

 public static int GetNearestIntraBar(BarList bl, int time, BarInterval bint,DebugDelegate debug)
 {
     try
     {
         long barid = TimeIntervalData.getbarid(time, bl.RecentBar.Bardate, (int)bint);
         BarListImpl bli = (BarListImpl)bl;
         TimeIntervalData tid = (TimeIntervalData)bli._intdata[bli._intdataidx[(int)bint]];
         for (int i = 0; i < tid.Count(); i++)
             if (tid.ids[i] == barid)
                 return i;
     }
     catch (Exception ex)
     {
         if (debug != null)
             debug("error getting nearest bar from: " + bl.Symbol + " at: " + time + " for: " + bint + " error: " + ex.Message + ex.StackTrace);
     }
     return -1;
 }
開發者ID:wang-shun,項目名稱:tradelink,代碼行數:18,代碼來源:BarListImpl.cs

示例11: High

 public decimal[] High(BarInterval interval)
 {
     return _intdata[_intdataidx[(int)interval]].high().ToArray();
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:4,代碼來源:BarListImpl.cs

示例12: BarImpl

 public BarImpl(BarInterval tu) 
 {
     units = (int)tu;
 }
開發者ID:antonywu,項目名稱:tradelink,代碼行數:4,代碼來源:BarImpl.cs

示例13: GetNearestIntraBar

 /// <summary>
 /// find the bar # that matches a given time
 /// </summary>
 /// <param name="bl"></param>
 /// <param name="time"></param>
 /// <param name="bint"></param>
 /// <returns></returns>
 public static int GetNearestIntraBar(BarList bl, int time, BarInterval bint)
 {
     long barid = TimeIntervalData.getbarid(time, bl.RecentBar.Bardate, (int)bint);
     BarListImpl bli = (BarListImpl)bl;
     TimeIntervalData tid = (TimeIntervalData)bli._intdata[bli._intdataidx[(int)bint]];
     for (int i = 0; i < tid.Count(); i++)
         if (tid.ids[i] == barid)
             return i;
     return -1;
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:17,代碼來源:BarListImpl.cs

示例14: Low

 public decimal[] Low(BarInterval interval)
 {
     return _intdata[_intdataidx[(int)interval]].low().ToArray();
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:4,代碼來源:BarListImpl.cs

示例15: Open

 public decimal[] Open(BarInterval interval)
 {
     return _intdata[_intdataidx[(int)interval]].open().ToArray();
 }
開發者ID:sopnic,項目名稱:larytet-master,代碼行數:4,代碼來源:BarListImpl.cs


注:本文中的BarInterval類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。