Bars can only fetch latest 200 bars

Created at 21 Aug 2024, 05:00
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!
RA

raypang

Joined 28.02.2024

Bars can only fetch latest 200 bars
21 Aug 2024, 05:00


Bars.Count() always about 200, is there anyway to get more recent bars?


@raypang
Replies

PanagiotisCharalampous
21 Aug 2024, 06:12

Hi there,

You can use Bars.LoadMoreHistory() method to load more bars.

Best regards,

Panagiotis


@PanagiotisCharalampous

raypang
21 Aug 2024, 11:51

RE: Bars can only fetch latest 200 bars

PanagiotisCharalampous said: 

Hi there,

You can use Bars.LoadMoreHistory() method to load more bars.

Best regards,

Panagiotis

protected override void OnStart()

{

    Print(Bars.Count); //200

    Bars.LoadMoreHistory();

    Print(Bars.Count); //200

}

it seems not work


@raypang

PanagiotisCharalampous
21 Aug 2024, 14:50

RE: RE: Bars can only fetch latest 200 bars

raypang said: 

PanagiotisCharalampous said: 

Hi there,

You can use Bars.LoadMoreHistory() method to load more bars.

Best regards,

Panagiotis

protected override void OnStart()

{

    Print(Bars.Count); //200

    Bars.LoadMoreHistory();

    Print(Bars.Count); //200

}

it seems not work

Can you tell us the broker and the symbol?


@PanagiotisCharalampous

raypang
21 Aug 2024, 15:32

RE: RE: RE: Bars can only fetch latest 200 bars

PanagiotisCharalampous said: 

raypang said: 

PanagiotisCharalampous said: 

Hi there,

You can use Bars.LoadMoreHistory() method to load more bars.

Best regards,

Panagiotis

protected override void OnStart()

{

    Print(Bars.Count); //200

    Bars.LoadMoreHistory();

    Print(Bars.Count); //200

}

it seems not work

Can you tell us the broker and the symbol?

EURUSD  backtest  timeframe 1min  ICMarkets


@raypang

PanagiotisCharalampous
22 Aug 2024, 05:08

RE: RE: RE: RE: Bars can only fetch latest 200 bars

raypang said: 

PanagiotisCharalampous said: 

raypang said: 

PanagiotisCharalampous said: 

Hi there,

You can use Bars.LoadMoreHistory() method to load more bars.

Best regards,

Panagiotis

protected override void OnStart()

{

    Print(Bars.Count); //200

    Bars.LoadMoreHistory();

    Print(Bars.Count); //200

}

it seems not work

Can you tell us the broker and the symbol?

EURUSD  backtest  timeframe 1min  ICMarkets

This method does not work on backtesting at the moment. If you need more bars for backtesting, you can start your bactesting at a previous date.


@PanagiotisCharalampous

Shares4us
23 Aug 2024, 11:42

RE: RE: RE: RE: RE: Bars can only fetch latest 200 bars

PanagiotisCharalampous said: 

This method does not work on backtesting at the moment. If you need more bars for backtesting, you can start your bactesting at a previous date.

That's not a good solution you will have to change your code just for the sake of backtesting & optimizing if you use duration based calculations.
 


@Shares4us

PanagiotisCharalampous
23 Aug 2024, 13:44

RE: RE: RE: RE: RE: RE: Bars can only fetch latest 200 bars

Shares4us said: 

PanagiotisCharalampous said: 

This method does not work on backtesting at the moment. If you need more bars for backtesting, you can start your bactesting at a previous date.

That's not a good solution you will have to change your code just for the sake of backtesting & optimizing if you use duration based calculations.
 

It's a solution when there is no other option. This will be enabled in backtesting in future releases.


@PanagiotisCharalampous