Plotting averages on the price chart.
            
                 14 Feb 2021, 17:08
            
                    
Hello, I would like help with the following plot:
EMA 21 (close) calculated on price
EMA 3 (close) calculated on EMA 21 (close)
I can build a code but I can't plot.
If anyone can help me I am grateful!
Follow code:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
    [Indicator(override void = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights)]
    public class BOLA DE CRISTAL : Indicator
    {
        private ExponentialMovingAverage _emaFast;
        private ExponentialMovingAverage _emaSlow;
        [Parameter("Data Source")]
        public DataSeries Price { get; set; }
        [Parameter("Slow Periods", DefaultValue = 21)]
        public int SlowPeriods { get; set; }
        [Output("Main", LineColor = "lime")]
        [Parameter("Fast Periods", DefaultValue = 3)]
        public int FastPeriods { get; set; }
        [Output("Main", LineColor = "red")]
        protected override void Initialize()
        {
            // initialize new instances of ExponentialMovingAverage Indicator class 
            _emaFast = Indicators.ExponentialMovingAverage(Price, FastPeriods);
            // _emaSlow is the exponential moving average of the emaFast 
            _emaSlow = Indicators.ExponentialMovingAverage(_emaFast.Result, SlowPeriods);
        }
        public override void Calculate(int index)
        {
            // If the index is less than SlowPeriods don't calculate
            if (index <= SlowPeriods)
            {
                // Print the index at which the fast ema crossed the slow ema
                Print("Fast EMA  index = {get,set}", index);
            }
        }
    }
}

PanagiotisCharalampous
15 Feb 2021, 09:44
Hi there,
Here is an example of how to plot values on the chart
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous