iBarShift trouble

 

Why do:

int bars = iBarShift(Symbol(),0,iTime(Symbol(),PERIOD_MN1,24));

AND

int bars = iBarShift(Symbol(),0,iTime(Symbol(),PERIOD_MN1,3));

BOTH return bars = 1000??? (On Daily chart in tester)

If i change period to PERIOD_W1 the return is still 1000.

I have tried to execute it on different dates and months.

While searching i found some posts complaining that the iBarShift is bugged, but I would need a second on that from someone more experienced before I call it a bug.

Any clues?

/ McKeen

 

i assume in your options you have MaxBars On chart set to 1000..

am i right?

 
zzuegg:

i assume in your options you have MaxBars On chart set to 1000..

am i right?


Good suggestion, but unfortunately it is maxed out to 2147483647 :(

I can see all bars within the range on the chart... (All the way back to 2006 actually and I am only requesting from about december 2008).

/ McKeen

 

i didn't saw that you use this code in the tester.. I am not at home now, but i will test it as soon i have access to my pc.

my assumption would be that the tester loads only up to X (maybe 200) bars before startdate. You could test to set the startdate in the tester to 2006 and include something like

if(TimeYear(Time[0])<2008) return (0);
just a thought.
 
zzuegg:

i didn't saw that you use this code in the tester.. I am not at home now, but i will test it as soon i have access to my pc.

my assumption would be that the tester loads only up to X (maybe 200) bars before startdate. You could test to set the startdate in the tester to 2006 and include something like

just a thought.



I just tried something similar,

Starting the test-run from 2007 and doing the iBarShift-command by the end of 2010.

Unfortunately it returns the same.

However I have changed the inputs for the ea now so that I now enter bars back (instead of months back) and thereby eliminating the need to run iBarShift to calculate no of bars.

Thanks for your inputs!

/ McKeen

 

zzuegg:

my assumption would be that the tester loads only up to X (maybe 200) bars before startdate.

100 bars
 
McKeen:

Why do:

BOTH return bars = 1000??? (On Daily chart in tester)

If i change period to PERIOD_W1 the return is still 1000.

I have tried to execute it on different dates and months.

While searching i found some posts complaining that the iBarShift is bugged, but I would need a second on that from someone more experienced before I call it a bug.

Any clues?

/ McKeen


PERIOD_MN1 should not be PERIOD_M1 ?
 
McKeen:


I just tried something similar,

Starting the test-run from 2007 and doing the iBarShift-command by the end of 2010.

Unfortunately it returns the same.

However I have changed the inputs for the ea now so that I now enter bars back (instead of months back) and thereby eliminating the need to run iBarShift to calculate no of bars.

Thanks for your inputs!

/ McKeen

a worse solution:

iterate trough the history to find the matching bar..


//z

 
EADeveloper:

PERIOD_MN1 should not be PERIOD_M1 ?

Ah, sorry .. Month not Minutes :-) MN_1
Reason: