Ploting IndicatorDataSeries Result with cBot
Created at 25 Oct 2019, 15:05
Ploting IndicatorDataSeries Result with cBot
25 Oct 2019, 15:05
Hi Support,
I'm trying to plot EMA line on the chart with cBot. Values are being calculated properly but cbot is not plotting line nor showing any errors in the Log.
Just to test the values i used Chart.DrawText with Hyphnes and cBot is printing properly on chart at the right spot.
Could you please assist.
Thanks in advance
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class Plot_EMA : Robot { [Output("EMA", PlotType = PlotType.Line,Color = Colors.Red,Thickness = 1)] public IndicatorDataSeries Result { get; set; } private ExponentialMovingAverage EMA; protected override void OnStart() { Result = CreateDataSeries(); EMA = Indicators.ExponentialMovingAverage(MarketSeries.Close, 10); } protected override void OnBar() { int index = MarketSeries.Close.Count - 1; Result[index - 1] = EMA.Result[index - 1]; //To draw hyphens instead of Line //Chart.DrawText(index.ToString(), "--", index - 1, Result[index - 1], Color.Red); } protected override void OnStop() { } } }
PanagiotisCharalampous
25 Oct 2019, 15:29
Hi RayAdam,
IndicatorDataSeries can only be used as an output of an indicator. Try creating an indicator instead.
Best Regards,
Panagiotis
@PanagiotisCharalampous