Found a bug using Indicators.. in Initialize method
Found a bug using Indicators.. in Initialize method
25 Sep 2024, 15:04
Hi,
sometimes, randomly, the indicators used in another indicator and created in the overrided initialize method is not created ! In fact I use the indicator in Calculate method and this method is called when the method Indicators.. is called ! so the pointer is null.
So I have to use something like that in the calculate method and now it works.
if(_stoch ==null) _stoch = Indicators.StochasticOscillator(stochPeriodK, slowing, stochPeriodD, stoch_matype)
Is it a new change in ctrader ? I didn't have this error before.
Thanks
Luc
Replies
PanagiotisCharalampous
26 Sep 2024, 05:09
Hi there,
Please share source code and exact steps that will allow us to reproduce this problem.
Best regards,
Panagiotis
@PanagiotisCharalampous
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
PanagiotisCharalampous
27 Sep 2024, 05:23
Hi there,
It works fine for me.
Can you try recreating the indicator?
Best regards,
Panagiotis
@PanagiotisCharalampous
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
jim.tollan
28 Sep 2024, 21:31
( Updated at: 28 Sep 2024, 21:32 )
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
My apologies, I seem to be unable to create a new topic.
Quick question. Can you explain why there have been no new cBots or indicators on your Algorithms section since 8th September? Normally, both those areas are pretty busy, but just seems to have drawn to a halt abruptly without any company PR/explanation. I personlly think this is bad for platform morale (the lack of comms) and makes you guys seem a little disconnected.
Anyway, apologies if it's just my login for some reason that's only seeing back to 8th September and if so, can you fix it for me -thanks
@jim.tollan
PanagiotisCharalampous
30 Sep 2024, 05:34
RE: RE: Found a bug using Indicators.. in Initialize method
jim.tollan said:
PanagiotisCharalampous said:
Hi there,
It works fine for me.
Can you try recreating the indicator?
Best regards,
Panagiotis
My apologies, I seem to be unable to create a new topic.
Quick question. Can you explain why there have been no new cBots or indicators on your Algorithms section since 8th September? Normally, both those areas are pretty busy, but just seems to have drawn to a halt abruptly without any company PR/explanation. I personlly think this is bad for platform morale (the lack of comms) and makes you guys seem a little disconnected.
Anyway, apologies if it's just my login for some reason that's only seeing back to 8th September and if so, can you fix it for me -thanks
Hi there,
Now all new algorithms need to be uploaded to our store
Best regards,
Panagiotis
@PanagiotisCharalampous
jim.tollan
30 Sep 2024, 10:47
( Updated at: 30 Sep 2024, 16:02 )
RE: RE: RE: Found a bug using Indicators.. in Initialize method
PanagiotisCharalampous said:
jim.tollan said:
My apologies, I seem to be unable to create a new topic.
Quick question. Can you explain why there have been no new cBots or indicators on your Algorithms section since 8th September? Normally, both those areas are pretty busy, but just seems to have drawn to a halt abruptly without any company PR/explanation. I personlly think this is bad for platform morale (the lack of comms) and makes you guys seem a little disconnected.
Anyway, apologies if it's just my login for some reason that's only seeing back to 8th September and if so, can you fix it for me -thanks
Hi there,
Now all new algorithms need to be uploaded ..
Best regards,
Panagiotis
So Panagiotis, just to confirm. Is the Algorithms [Indicators/Bots/Plugins] section dead then??
I never saw any announcement mentioning this, nor was there anything on any of the Algo pages, so was a bit confused.
jim
@jim.tollan
PanagiotisCharalampous
01 Oct 2024, 06:12
RE: RE: RE: RE: Found a bug using Indicators.. in Initialize method
jim.tollan said:
PanagiotisCharalampous said:
jim.tollan said:
My apologies, I seem to be unable to create a new topic.
Quick question. Can you explain why there have been no new cBots or indicators on your Algorithms section since 8th September? Normally, both those areas are pretty busy, but just seems to have drawn to a halt abruptly without any company PR/explanation. I personlly think this is bad for platform morale (the lack of comms) and makes you guys seem a little disconnected.
Anyway, apologies if it's just my login for some reason that's only seeing back to 8th September and if so, can you fix it for me -thanks
Hi there,
Now all new algorithms need to be uploaded ..
Best regards,
Panagiotis
So Panagiotis, just to confirm. Is the Algorithms [Indicators/Bots/Plugins] section dead then??
I never saw any announcement mentioning this, nor was there anything on any of the Algo pages, so was a bit confused.
jim
It's not dead but no new uploads are allowed.
@PanagiotisCharalampous
jim.tollan
01 Oct 2024, 08:42
RE: RE: RE: RE: RE: Found a bug using Indicators.. in Initialize method
PanagiotisCharalampous said:
jim.tollan said:
PanagiotisCharalampous said:
jim.tollan said:
My apologies, I seem to be unable to create a new topic.
Quick question. Can you explain why there have been no new cBots or indicators on your Algorithms section since 8th September? Normally, both those areas are pretty busy, but just seems to have drawn to a halt abruptly without any company PR/explanation. I personlly think this is bad for platform morale (the lack of comms) and makes you guys seem a little disconnected.
Anyway, apologies if it's just my login for some reason that's only seeing back to 8th September and if so, can you fix it for me -thanks
Hi there,
Now all new algorithms need to be uploaded ..
Best regards,
Panagiotis
So Panagiotis, just to confirm. Is the Algorithms [Indicators/Bots/Plugins] section dead then??
I never saw any announcement mentioning this, nor was there anything on any of the Algo pages, so was a bit confused.
jim
It's not dead but no new uploads are allowed.
got it.. thanks…
@jim.tollan
MehranM
01 Oct 2024, 12:57
( Updated at: 02 Oct 2024, 04:57 )
RE: Found a bug using Indicators.. in Initialize method
PanagiotisCharalampous said:
Hi there,
Please share source code and exact steps that will allow us to reproduce this problem.
Best regards,
Panagiotis
Hi Dear Panagiotis
I have the same problem in the latest update. Please find the details in the video I sent to the Telegram group: https://t.me/cTrader_Official/131603
@MehranM
PanagiotisCharalampous
02 Oct 2024, 05:03
RE: RE: Found a bug using Indicators.. in Initialize method
MehranM said:
PanagiotisCharalampous said:
Hi there,
Please share source code and exact steps that will allow us to reproduce this problem.
Best regards,
Panagiotis
Hi Dear Panagiotis
I have the same problem in the latest update. Please find the details in the video I sent to the Telegram group: https://t.me/cTrader_Official/131603
Please create a new thread regarding this issue
@PanagiotisCharalampous
lbellego
02 Oct 2024, 11:47
RE: RE: Found a bug using Indicators.. in Initialize method
lbellego said:
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
The problem is still there this morning. It's random.
@lbellego
lbellego
25 Sep 2024, 15:12
forgot to add an information, it's mainly on Tick view
Put the view on Tick1000, switch to another tab, come back, switch to Tick250, etc…
@lbellego