Did IsLastBar stop working after a few updates?

tperalta82 since: 07 Jul 2020;

  28 Jul 2021, 12:23
Did IsLastBar stop working after a few updates?

Hey guys,

After some time trying to debug, it seems that IsLastBar stopped working, not even working at its simplest form like

 public override void Calculate(int index)
 {
            if (IsLastBar)
            {
                Print("TEST");
            }

}

At least since a month ago.

Any ideas?

amusleh's avatar

amusleh since: 01 Mar 2021;

  28 Jul 2021, 14:42

Hi,

It works fine on my system, it works only if new ticks are coming and the market is open.

Community Developer | Spotware | Telegram: @algodeveloper

tperalta82 since: 07 Jul 2020;

  28 Jul 2021, 17:17
RE:

Interesting, which cTrader version? Have you tried on demo?

EDIT: Okay, it works if you just use the indicator as standalone, but if you include it in a bot as a custom indicator, it stops working, although i'm 100% sure it stopped working because i had this working in the past with 0 code changes

EDIT2:

Ended up with this and it works so far

public bool IsLastBar2(int index)
{
            return Bars[index].OpenTime == Bars.LastBar.OpenTime;
}

amusleh said:

Hi,

It works fine on my system, it works only if new ticks are coming and the market is open.

amusleh's avatar

amusleh since: 01 Mar 2021;

  29 Jul 2021, 10:37

Hi,

We were able to replicate this issue, we will investigate and update you as soon as possible.

Community Developer | Spotware | Telegram: @algodeveloper

tperalta82 since: 07 Jul 2020;

  16 Aug 2021, 05:56
RE:

amusleh said:

Hi,

We were able to replicate this issue, we will investigate and update you as soon as possible.

Thanks, my fix is working so far, but yeah for other users will be nice