It seems Bars.LoadMoreHistory() has been recently broken and doesn't work

Created at 20 Aug 2024, 00:57
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Waxy's avatar

Waxy

Joined 12.05.2015

It seems Bars.LoadMoreHistory() has been recently broken and doesn't work
20 Aug 2024, 00:57


Hello Spotware,

It seems Bars.LoadMoreHistory() has been recently broken, not sure since when but it no longer seems to work, it never seems to load anything, anywhere.

I've tried both these ways below, and using LoadMoreHistoryAsync() as well.

The broker I'm using is scandinavian markets/demo.
 

using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo;

[Indicator(AccessRights = AccessRights.None)]
public class DebugHistoricalDataIssue : Indicator
{
    public bool Initialized { get; set; }

    protected override void Initialize()
    {
        if (Bars.LoadMoreHistory() <= 0)
        {
            MessageBox.Show("NO MORE HISTORY HAS BEEN LOADED.", "",
                MessageBoxButton.OK, MessageBoxImage.Warning);
        }
    }

    public override void Calculate(int index)
    {
        if (!Initialized && IsLastBar)
        {
            Initialized = true;
            
            if (Bars.LoadMoreHistory() <= 0)
            {
                MessageBox.Show("NO MORE HISTORY HAS BEEN LOADED.", "", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
           
        }
    }
}

@Waxy
Replies

firemyst
20 Aug 2024, 01:19 ( Updated at: 20 Aug 2024, 04:33 )

Have you considered that there might not be any more history to be loaded, especially if you're not scrolling to the left on the charts? 

See this thread:

https://ctrader.com/forum/cbot-support/38020/

 


@firemyst

PanagiotisCharalampous
20 Aug 2024, 04:56

Hi Waxy,

Can you please also share symbol and timeframe?

Best regards,

Panagiotis


@PanagiotisCharalampous

Waxy
20 Aug 2024, 04:59 ( Updated at: 20 Aug 2024, 07:29 )

RE: It seems Bars.LoadMoreHistory() has been recently broken and doesn't work

firemyst said: 

Have you considered that there might not be any more history to be loaded, especially if you're not scrolling to the left on the charts? 

See this thread:

https://ctrader.com/forum/cbot-support/38020/

 

Hello Firemyst,

Thanks for your reply.

This function obviously has changed its behavior, because I had an indicator and source control of it and it had working fine for a long time, debugging it led me to find this problem. Regardless of the broker or pair it returns zero and another user had this issue too but check more on this.

See video attached, first it counts bars without using the function on AUDNZD, then I run it again using the function, it turns into a locked refresh loop (doesn't even print the bars until after it loads the data, doesn't even print the initial bar count), at the end it does increase the number of bars but the function still returns zero.

Before this problem, we were able to control how many bars to load in a simple while loop synchronously without issues.

(9+) cTrader - 2024-08-19_23-47-08 - TechSmith Screencast

Regards,
 


@Waxy

PanagiotisCharalampous
20 Aug 2024, 07:33

RE: RE: It seems Bars.LoadMoreHistory() has been recently broken and doesn't work

Waxy said: 

firemyst said: 

Have you considered that there might not be any more history to be loaded, especially if you're not scrolling to the left on the charts? 

See this thread:

https://ctrader.com/forum/cbot-support/38020/

 

Hello Firemyst,

Thanks for your reply.

This function obviously has changed its behavior, because I had an indicator and source control of it and it had working fine for a long time, debugging it led me to find this problem. Regardless of the broker or pair it returns zero and another user had this issue too but check more on this.

See video attached, first it counts bars without using the function on AUDNZD, then I run it again using the function, it turns into a locked refresh loop (doesn't even print the bars until after it loads the data, doesn't even print the initial bar count), at the end it does increase the number of bars but the function still returns zero.

Before this problem, we were able to control how many bars to load in a simple while loop synchronously without issues.

(9+) cTrader - 2024-08-19_23-47-08 - TechSmith Screencast

Regards,
 

Hi Waxy,

The behavior is as expected on an indicator. As soon as more bars are loaded the indicator needs to be reinitialized and recalculated. Therefore this leads to a loop until all bars are loaded. Probably you are comparing this with the way it behaves in a cBot which is a different behavior.

Best regards,

Panagiotis


@PanagiotisCharalampous

Waxy
20 Aug 2024, 18:01

RE: RE: RE: It seems Bars.LoadMoreHistory() has been recently broken and doesn't work

Hello Panagiotis,

Understood, I'll take it as it is, I'm pretty sure something changed here because it was working fine for a long time.

Thanks for your support.
Regards,


@Waxy