Topics
Replies
lbellego
27 Sep 2024, 11:52
RE: Found a bug using Indicators.. in Initialize method
PanagiotisCharalampous said:
Hi there,
It works fine for me.
Can you try recreating the indicator?
Best regards,
Panagiotis
Hi Panagiotis,
I can't reproduce the bug too. It was easy before the update yesterday. So it seems fixed.
Befeore the update I saw that it was more often with indices like NAS100.
Thanks for your help
Luc
@lbellego
lbellego
26 Sep 2024, 12:45
RE: Found a bug using Indicators.. in Initialize method
Hi,
this is the code and a print screen. I have to switch from tab to tab, change the timeframe, etc. This indicator is in all tabs. When the bug arrive in a cbot it's very annoying ;-)
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Cloud("MACD", "Signal", Opacity = 0.2, FirstColor = "FF7CFC00")]
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class LucHADeltaMacd0Lag : Indicator
{
[Output("MACD", LineColor = "DodgerBlue", LineStyle = LineStyle.Lines)]
public IndicatorDataSeries MACD { get; set; }
[Output("Signal", LineColor = "Red", LineStyle = LineStyle.Lines, Thickness = 1)]
public IndicatorDataSeries Signal { get; set; }
[Parameter(DefaultValue = 12, Group = "MacD 0 Lag")]
public int periodFast { get; set; }
[Parameter(DefaultValue = 26, Group = "MacD 0 Lag")]
public int periodSlow { get; set; }
[Parameter(DefaultValue = 9, Group = "MacD 0 Lag")]
public int periodSignal { get; set; }
private MovingAverage emaSlow;
private MovingAverage emaSlow2;
private MovingAverage emaFast;
private MovingAverage emaFast2;
private MovingAverage emaSignal;
private MovingAverage emaSignal2;
private IndicatorDataSeries closePrice;
private IndicatorDataSeries macd;
protected override void Initialize()
{
closePrice = CreateDataSeries();
macd = CreateDataSeries();
emaSlow = Indicators.MovingAverage(closePrice, periodSlow, MovingAverageType.Exponential);
emaSlow2 = Indicators.MovingAverage(emaSlow.Result, periodSlow, MovingAverageType.Exponential);
emaFast = Indicators.MovingAverage(closePrice, periodFast, MovingAverageType.Exponential);
emaFast2 = Indicators.MovingAverage(emaFast.Result, periodFast, MovingAverageType.Exponential);
emaSignal = Indicators.MovingAverage(macd, periodSignal, MovingAverageType.Exponential);
emaSignal2 = Indicators.MovingAverage(emaSignal.Result, periodSignal, MovingAverageType.Exponential);
}
public override void Calculate(int index)
{
/*if(emaSlow==null) emaSlow = Indicators.MovingAverage(closePrice, periodSlow, macd_ma_type);
if(emaSlow2==null) emaSlow2 = Indicators.MovingAverage(emaSlow.Result, periodSlow, macd_ma_type);
if(emaFast==null) emaFast = Indicators.MovingAverage(closePrice, periodFast, macd_ma_type);
if(emaFast2==null) emaFast2 = Indicators.MovingAverage(emaFast.Result, periodFast, macd_ma_type);
if(emaSignal==null) emaSignal = Indicators.MovingAverage(macd, periodSignal, macd_ma_type);
if(emaSignal2==null) emaSignal2 = Indicators.MovingAverage(emaSignal.Result, periodSignal, macd_ma_type);*/
// MacD Zero Lag
closePrice[index] = Bars.ClosePrices[index];
MACD[index] = (2 * emaFast.Result[index] - emaFast2.Result[index]) - (2 * emaSlow.Result[index] - emaSlow2.Result[index]);
macd[index] = MACD[index];
Signal[index] = (2 * emaSignal.Result[index] - emaSignal2.Result[index]);
}
}
}
Is it possible due to the cloud ? …
Thanks for your help
Luc
@lbellego
lbellego
28 Aug 2024, 12:09
( Updated at: 29 Aug 2024, 05:15 )
RE: IndicatorDataSeries not available in Plugin
PanagiotisCharalampous said:
Hi there,
You can create an indicator that would output the relevant data through the output data series.
Best regards,
Panagiotis
right !! thanks !
@lbellego
lbellego
02 Oct 2024, 11:47
RE: RE: Found a bug using Indicators.. in Initialize method
lbellego said:
The problem is still there this morning. It's random.
@lbellego