Пример #1
0
 /// <summary>
 /// Compute signal for determining response
 /// </summary>
 /// <param name="lastBar"></param>
 /// <returns></returns>
 decimal ComputeSignal(Bar lastBar)
 {
     _EMA.UpdateValue(lastBar.Close);
     // calculate the ATR using closing prices for so many bars back
     _ATR.UpdateValue(lastBar.High, lastBar.Low, lastBar.Close, _EMA.GetSignal());
     return(_ATR.GetSignal());
 }
Пример #2
0
        /// <summary>
        /// Compute ATR indicator
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="interval"></param>
        /// <returns></returns>
        decimal ComputeATR(Bar lastBar, decimal currentSMA)
        {
            decimal ATR = decimal.MinValue;

            // calculate the ATR using closing prices for so many bars back
            if (UseATRFromATSGlobalIndicator)
            {
                _ATRFromATSGlobalIndicator.UpdateValue(lastBar.High, lastBar.Low, lastBar.Close, currentSMA);
                ATR = _ATRFromATSGlobalIndicator.GetSignal();
            }
            else
            {
                //SMA = Calc.Avg(Calc.EndSlice(_blt[symbol].Open(), _barsback));
            }
            // this way we can debug our indicators during development
            // indicators are sent in the same order as they are named above
            return(ATR);
        }