Get Symbol Bars seems limited

Created at 07 Jul 2020, 22:44
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!
TP

tperalta82

Joined 07.07.2020

Get Symbol Bars seems limited
07 Jul 2020, 22:44


Hey guys, i'm having a hard time getting more than 198 Bars.

I'm trying with ,

 

Bars c = MarketData.GetBars(TimeFrame, SymbolName);

which gets me up to 127, and then with loadmorebars, can get up to 198, this is totally not optimal, so i went on another approach that is also not optimal.

a for loop that tries to get the bars I need for my code, but gets to a point where NaN exists in the array and it's unusable.

So, let's say I need to get 1000 Bars, how do I achieve this? Any idea?

Or what am I missing here?

 

Thanks in advance!!

 

 


@tperalta82
Replies

PanagiotisCharalampous
08 Jul 2020, 08:24

Hi tperalta82,

You should be calling the method until the desired amount of bars is retrieved. See below

            var bars = MarketData.GetBars(TimeFrame, SymbolName);
            while (bars.Count < 1000)
            {
                bars.LoadMoreHistory();
            }

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

tperalta82
08 Jul 2020, 16:30

RE:

Thanks a lot for your reply, that was one of my first tries, doesn't work, some pairs go to 128 others 120, got one to 198.

 

After the while the strategy stops due to a timeout because of this.

I even connected VS to make proper debug with breakpoints, and no, doesn't add more bars

 

PanagiotisCharalampous said:

Hi tperalta82,

You should be calling the method until the desired amount of bars is retrieved. See below

            var bars = MarketData.GetBars(TimeFrame, SymbolName);
            while (bars.Count < 1000)
            {
                bars.LoadMoreHistory();
            }

Best Regards,

Panagiotis 

Join us on Telegram

 

 


@tperalta82

PanagiotisCharalampous
08 Jul 2020, 16:51

Hi tperalta82,

Can you please provide the symbol, timeframe and broker?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

tperalta82
09 Jul 2020, 15:15

RE:

Hey PanagiotisCharalampous,

 

Tried EURUSD and GBPUSD, on both 15m and 1h, on ctrader demo and icmarkets demo, same results.

 

PanagiotisCharalampous said:

Hi tperalta82,

Can you please provide the symbol, timeframe and broker?

Best Regards,

Panagiotis 

Join us on Telegram

 


@tperalta82

PanagiotisCharalampous
09 Jul 2020, 15:18

Hi tperalta82,

Works fine for me

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

tperalta82
09 Jul 2020, 16:35 ( Updated at: 21 Dec 2023, 09:22 )

RE:

Interesting... are you backtesting? haven't tried without backtesting though

PanagiotisCharalampous said:

Hi tperalta82,

Works fine for me

Best Regards,

Panagiotis 

Join us on Telegram

 


@tperalta82

PanagiotisCharalampous
09 Jul 2020, 16:40

Hi tperalta82,

Interesting... are you backtesting? haven't tried without backtesting though

No, you did not mention anywhere that this happens on backtesting. On backtesting this method is not supported at the moment. If you want to get more bars during backtesting, you need to start testing from an earlier date.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

tperalta82
09 Jul 2020, 16:45

RE:

Ahh I see, thank you, will try and post results

PanagiotisCharalampous said:

Hi tperalta82,

Interesting... are you backtesting? haven't tried without backtesting though

No, you did not mention anywhere that this happens on backtesting. On backtesting this method is not supported at the moment. If you want to get more bars during backtesting, you need to start testing from an earlier date.

Best Regards,

Panagiotis 

Join us on Telegram

 


@tperalta82