EA works fine live but not in backtest mode

 
Hello,

I have a real simple program "testcmeter" that basically should use icustom to return a value from a custom indicator called "CCFp" (both are attached).

Before I build the program further I want to make sure it's giving me the right values. When I run the EA ("testcmeter") in the strategy tester to backtest it, the journal entries show values of 2147483647, which are too big and I've heard that these correspond to "empty data" or something.

I get the correct values (i.e. 0.0529ish) when I run it in real time and watch the alert window.

Could someone please tell me why this is happening and how to fix it? Thanks so much!

Kris

Files:
ccfp.mq4  18 kb
 
move back one candle for yr analysis, other words: access your indicator with ccfp[1], and not ccfp[0]. i had this issue when i was scanning the current candle, when you move back one candle, the value should be there.
 

Hi c0d3,

Thanks for your help. I tried that and I got a few more realistic numbers but not quite yet. Someone told me that I had to have the custom indicator on the chart as well as the EA so that the indicator would be compiled. That helped but the problem is, every time I run the EA above in the strategy tester and watch the journal, the numbers start out good but then when a weekend is hit, the numbers don't progress anymore, and when the 2nd weekend is hit, they go to 2147483647.000000- that's obviously an unreal value. I attached a copy of the journal so you can see what I mean. Watch carefully for the values of the data from 2010.01.08 to 2010.01.11 and from 2010.01.15 to 2010.01.18. Anyone's help is appreciated.

Kris

 
kristophm:

Someone told me that I had to have the custom indicator on the chart as well as the EA so that the indicator would be compiled. That helped but the problem is, every time I run the EA above in the strategy tester and watch the journal, the numbers start out good but then when a weekend is hit, the numbers don't progress anymore, and when the 2nd weekend is hit, they go to 2147483647.000000- that's obviously an unreal value. I attached a copy of the journal so you can see what I mean. Watch carefully for the values of the data from 2010.01.08 to 2010.01.11 and from 2010.01.15 to 2010.01.18. Anyone's help is appreciated. Kris

---------------------------------------------

Hi Kristophm,

I ran the code and was able to duplicate the results you got.

1) The value 2147483647 does represent an "empty buffer" (2147483647=0) and depending on the code and purpose, this can be a valid value to use for various strategies. In this case however it appears something is not right. The values display and then stop....with the empty buffers as the result.

2) I reviewed the code for CCFp and found 2 variables that seem to affect the problem.

It appears a problem with the Bars and counting functions. I don't quite understand what this code is trying to do, but it does allow for user settings for these two variables.

They are set default as:
int All_Bars = 0;
int Last_Bars = 0;

The default values work for a few cycles and then it stops.

I changed the settings to:
int All_Bars = 1000;
int Last_Bars = 1000;

I used the '1000' for both inputs and the Strategy Tester displayed values all the way to the end of the test. The problem was that with both these set at '1000'... the tester was soooo slow...but it worked!

Suggestions:

1) Try different combinations for these two settings to get the best results for what you need.

2) Work with a shorter timeframe (like H1) so you can see the values changing quicker (waiting a virtual week W1 to see the values change was waaaay too long...lol!)

4) I used 0 bar for my tests. That showed the current values of the bar without any problem (no need to do past bars unless you have other strategies to implement).

3) The EA can use the CCFp indicator without needing to place the indicator on the chart, unless you like to watch the lines and values while testing.

Please let us know if this works for you. I'm interested in the CCFp indicator and what you are trying to do with it.

Hope this helps you,
Robert





Reason: