Bug: Indicators rely on new tick data to display
Bug: Indicators rely on new tick data to display
03 Aug 2022, 09:49
I have just updated to 4.2.17.7598
When trying to develop new indicators, it has become very laborious as it now appears as though the indicators are only refreshed upon receiving new tick data. This is not great for testing, especially on a market which is closed. Refreshing the screen seems to do something as the indicators appear for a split second but then disappear.
Replies
PureForm
06 Aug 2022, 12:01
Ok, so I stripped down a working indicator line by line to see what makes it update and found the following workaround.
for (int i=1; i<=500; i++)
{
double j = Bars.MedianPrices.LastValue - Bars.MedianPrices.Last(i);
}
Add this code to the Calculate() function. It seems to wake up the indicator or feeds it bar data.
As you can see this is unnecessary taxing. I haven't found a solution that works with the Initialize() function.
This bug should be fixed ASAP.
@PureForm
katorian
06 Aug 2022, 17:08
Thanks for this. I also tried a few things like a dummy indicator fed in as a source. But like you showed it just seems to need a "wake up". It doesn't even need to be anything meaningful by the looks of it. The following works too:
for (int i = 0; i <= 100; i++) { _ = Bars.LastBar; }
Can this please be fixed so we don't have to add useless bits of code?
@katorian
katorian
06 Aug 2022, 17:08
Thanks for this. I also tried a few things like a dummy indicator fed in as a source. But like you showed it just seems to need a "wake up". It doesn't even need to be anything meaningful by the looks of it. The following works too:
for (int i = 0; i <= 100; i++) { _ = Bars.LastBar; }
Can this please be fixed so we don't have to add useless bits of code?
@katorian
firemyst
07 Aug 2022, 08:38
RE:
PureForm said:
Ok, so I stripped down a working indicator line by line to see what makes it update and found the following workaround.
for (int i=1; i<=500; i++) { double j = Bars.MedianPrices.LastValue - Bars.MedianPrices.Last(i); }
Add this code to the Calculate() function. It seems to wake up the indicator or feeds it bar data.
As you can see this is unnecessary taxing. I haven't found a solution that works with the Initialize() function.
This bug should be fixed ASAP.
You will want to change your code to be more like the following so it's not running through that loop when the markets are open:
if (!Symbol.MarketHours.IsOpened())
{
for (int i=1; i<=500; i++)
{
double j = Bars.MedianPrices.LastValue - Bars.MedianPrices.Last(i);
}
}
And it's completely ridiculous that a version of cTrader would even get released with a bug like this... Spotware definitely needs to fix it asap!
@firemyst
evgrinaus
07 Aug 2022, 09:58
RE: RE:
firemyst said:
PureForm said:
Ok, so I stripped down a working indicator line by line to see what makes it update and found the following workaround.
for (int i=1; i<=500; i++) { double j = Bars.MedianPrices.LastValue - Bars.MedianPrices.Last(i); }
Add this code to the Calculate() function. It seems to wake up the indicator or feeds it bar data.
As you can see this is unnecessary taxing. I haven't found a solution that works with the Initialize() function.
This bug should be fixed ASAP.You will want to change your code to be more like the following so it's not running through that loop when the markets are open:
if (!Symbol.MarketHours.IsOpened()) { for (int i=1; i<=500; i++) { double j = Bars.MedianPrices.LastValue - Bars.MedianPrices.Last(i); } }
And it's completely ridiculous that a version of cTrader would even get released with a bug like this... Spotware definitely needs to fix it asap!
Cannot add code as the indicators I use are moving averages and CCI
@evgrinaus
PureForm
06 Aug 2022, 10:56
This is very critical. I am on version 4.2.18.7728 and the problem still persists.
Thanks for figuring out the new tick data causes the problem. I was wondering why on friday night almost all indicators stopped working.
Even the simplest indicator doesn't work. I'm still wondering why some indicators still work, even when I change their code. I copied code from a non-working indicator into a working indicator and both get plotted.
@PureForm