コード例 #1
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
            minLow  = MIN(Low, percentK)[0];
            maxHigh = MAX(High, percentK)[0];
            relDiff.Set(Close[0] - (maxHigh + minLow) / 2);
            diff.Set(maxHigh - minLow);
            avgRel.Set(EMA(EMA(relDiff, percentD), percentD)[0]);
            avgDiff.Set(EMA(EMA(diff, percentD), percentD)[0]);

            if (CurrentBar == 0)
            {
                SMI.Set(0);
            }
            else
            {
                SMI.Set(avgRel[0] / (avgDiff[0] / 2) * 100);
            }
            SMIAvg.Set(EMA(SMI, percentD)[0]);
        }
コード例 #2
0
ファイル: SmiBot.cs プロジェクト: vmsalinasg/cAlgoBot
 protected override void OnStart()
 {
     _smi = Indicators.GetIndicator <SMI>(Period, MovingAverageType.Simple);
 }