Help relate data

 

Hi,

I have a slight problem and would appreciate if someone can help me.

I want to study an arrow indicator on a given period of time (2 years for example, M1). The study is done by the script.

For this reason I write the following settings to Metatrader 4:

Max bars in history: 634000
Max bars in window: 634000

(2 years * 220 working days * 24 hours * 60 minutes = 633,600 ~ 634,000 candles)

In my script I wrote the following code:

int lookback = 634000;

for (int i = Bars - 1 - MathMax(lookback, prev_calculated); i >= 0; --i){

   ... // The code to make decision and put arrow on the chart 

}

But this does not work if I try to expand the search to more than 1000 candles: arrows appear on a chart only on last 4 days.

Where is my misunderstanding?

 
llaabbss:

Where is my misunderstanding?

Given that your lookback is fixed, at 634000, MathMax(lookback,prev_calculated) will always give you >=lookback, right from the start... and so your i will always be quite small, if not negative (since you also have a -1 there).

I suggest for testing purposes, let i = Bars-1 and see what happens, then consider incorporating prev_calculated once you confirmed that your codes within the for loop works as expected.

 

No, it didn't help.

I printed the initial information to console, here are the numbers:

[lookback = 1,000] 2019.06.17 16:05:10.064 ... EURUSD,M1: Bars:5936, lookback:1000, prev_calculated:5936
[lookback = 10,000] 2019.06.17 16:06:22.899 ... EURUSD,M1: Bars:5939, lookback:10000, prev_calculated:5939
[lookback = 364,000] 2019.06.17 16:07:18.822 .. EURUSD,M1: Bars:5940, lookback:364000, prev_calculated:5940
[lookback = 100] 2019.06.17 16:08:00.709 ... EURUSD,M1: Bars:5941, lookback:100, prev_calculated:5941

Why Bars is so small number? It is smaller than expected.

5936 bars / 60 minutes / 24 hours = 4.1 days (what I actually see).

I pressed F2 and downloaded the history of EURUSD M1: database 5000 / 7215058 records.

But it didn't help as well.



 
llaabbss:

No, it didn't help.

I printed the initial information to console, here are the numbers:

[lookback = 1,000] 2019.06.17 16:05:10.064 ... EURUSD,M1: Bars:5936, lookback:1000, prev_calculated:5936
[lookback = 10,000] 2019.06.17 16:06:22.899 ... EURUSD,M1: Bars:5939, lookback:10000, prev_calculated:5939
[lookback = 364,000] 2019.06.17 16:07:18.822 .. EURUSD,M1: Bars:5940, lookback:364000, prev_calculated:5940
[lookback = 100] 2019.06.17 16:08:00.709 ... EURUSD,M1: Bars:5941, lookback:100, prev_calculated:5941

Why Bars is so small number? It is smaller than expected.

5936 bars / 60 minutes / 24 hours = 4.1 days (what I actually see).

How to increase the Bars?



Probably your broker does not provide more than 4 days of m1 data. You can verify by turning off chart auto-scroll, then press the 'home' key. Keep repeating until your chart stops scrolling to the right - that'll be the maximum bars you can get from the broker... If you want more, you have to look at other data sources... 
 
Seng Joo Thio:
Probably your broker does not provide more than 4 days of m1 data. You can verify by turning off chart auto-scroll, then press the 'home' key. Keep repeating until your chart stops scrolling to the right - that'll be the maximum bars you can get from the broker... If you want more, you have to look at other data sources... 

It's Alpari-Demo...

Which providers would you recommend to get data from exceeding 5000 records?

Is it a limitation of MT4 copy shared by a broker itself? Can other brokers offer copies of MT4 having no such limitation?

 
llaabbss:

It's Alpari-Demo...

Which providers would you recommend to get data from exceeding 5000 records?

Is it a limitation of MT4 copy shared by a broker itself? Can other brokers offer copies of MT4 having no such limitation?

Yes, other brokers offer 65000 bars to be displayed in a window. Alpari offers much less quantity.

 
llaabbss:

Yes, other brokers offer 65000 bars to be displayed in a window. Alpari offers much less quantity.

There is difference between brokers (i just happen to come across HotForex demo recently, and it provides EURUSD M1 data from 9th Aug 2018, not sure about other pairs though), there are also 3rd party data provider (you can do a search online).

But i'm not sure that you really need so much data though... 

Reason: