EMA Period: only whole-number possible?
EMA Period: only whole-number possible?
13 Sep 2015, 13:41
Is there a method to code the value of the EMA with digits after the decimal point?
Example: EMA 123.456 ?
Replies
MaVe
14 Sep 2015, 21:13
RE:
Spotware said:
Dear Trader,
We are not sure we understand what you are trying to do.
You cannot change the values calculated in the EMA indicator. However you could add them to an IndicatorDataSeries and add/subtract/roundup the values you like.
The following code snippet illustrates it:
private ExponentialMovingAverage ema; protected override void Initialize() { ema = Indicators.ExponentialMovingAverage(MarketSeries.Close, 50); } public override void Calculate(int index) { // Display the ema result on the chart Result[index] = ema.Result[index] + 1; }We hope this helps you.
Dear Spotware,
I meant the EMA Period as a number with digits after the decimal point.
Example beneath with EMA(20) indicator, how to adapt to EMA(20.123)?
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class MaVe2015 : Indicator { [Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)] public MovingAverageType MaType { get; set; } // ----- [Output("EMA(20)", Color = Colors.White)] public IndicatorDataSeries MA20Result { get; set; } // ----- MovingAverage MA20; // ------------------------------------------------------ protected override void Initialize() { MA20 = Indicators.MovingAverage(MarketSeries.Close, 20, MaType); } // ------------------------------------------------------ public override void Calculate(int index) { MA20Result[index] = MA20.Result[index]; } } }
@MaVe
Rod_Sands
15 Sep 2015, 05:32
LOL why not go to 10 decimal places, say an EMA of 20.0000000003.
Decimal places on an EMA would be about as useful as a hip pocket on a singlet.
Brings a new meaning to useless scope creep.
@Rod_Sands
Spotware
14 Sep 2015, 08:26
Dear Trader,
We are not sure we understand what you are trying to do.
You cannot change the values calculated in the EMA indicator. However you could add them to an IndicatorDataSeries and add/subtract/roundup the values you like.
The following code snippet illustrates it:
We hope this helps you.
@Spotware