Make sure that h1 chart is open.
Try to comment returned value from GetLastError() function
Try to comment returned value from GetLastError() function
Not sure what you mean by "make sure h1 chart is open"
It is in strategy tester as i said, not in normal operation. Visual mode is on - that's how i can see the comments. As i said period is Daily or H4.
How do i open H1 chart in strategy tester when it is doing a daily or H4 test?
i added your getlasterror. it says it was error 4054
It is in strategy tester as i said, not in normal operation. Visual mode is on - that's how i can see the comments. As i said period is Daily or H4.
How do i open H1 chart in strategy tester when it is doing a daily or H4 test?
i added your getlasterror. it says it was error 4054
Make sure that h1 chart is open.
Try to comment returned value from GetLastError() function
Try to comment returned value from GetLastError() function
It means "just open h1 chart". And note that your h1 data can cover not all daily data. (for example daily data begins from 1999.01.01 and hourly data begins from 2004.01.01)
But doesn't the strategy tester user fractals to fill in the missing data so that it behaves like ticks?
If it works like you say then there must be another function that will tell you if you have enough data to call an indicator.
If it works like you say then there must be another function that will tell you if you have enough data to call an indicator.
It means "just open h1 chart". And note that your h1 data can cover not all daily data. (for example daily data begins from 1999.01.01 and hourly data begins from 2004.01.01)
Did You read our articles about testing?
"MQL4: Strategy Tester: Modes of Modeling during Testing"
"MQL4: Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance"
"MQL4: Strategy Tester: Modes of Modeling during Testing"
"MQL4: Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance"
These articles do not answer the question that this issue has led me to which is:
In an ea how do i test if an indicator will have enough data to succeed?
In an ea how do i test if an indicator will have enough data to succeed?
Did You read our articles about testing?
"MQL4: Strategy Tester: Modes of Modeling during Testing"
"MQL4: Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance"
"MQL4: Strategy Tester: Modes of Modeling during Testing"
"MQL4: Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance"
Attach this EA:
//+------------------------------------------------------------------+ //| thebts.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/forum/3132//" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { string CommString; int err; //---- double cci = iCCI(NULL, PERIOD_H1, 7, PRICE_TYPICAL, 1); CommString=DoubleToStr(cci,4); err=GetLastError(); if (err!=0) CommString=StringConcatenate(CommString," error code = ", err); Comment(CommString); //---- return(0); } //+------------------------------------------------------------------+
And do what?
I already did this. That's how i knew it was error 4054.
It does not answer my question unless you are suggesting that i check the get last error every time i call an indicator. This is a very bad anti pattern.
I should either be able to test the data somehow or i should be able to do a try/catch (yes i know try/catch is not part of the language).
I already did this. That's how i knew it was error 4054.
It does not answer my question unless you are suggesting that i check the get last error every time i call an indicator. This is a very bad anti pattern.
I should either be able to test the data somehow or i should be able to do a try/catch (yes i know try/catch is not part of the language).
Attach this EA:
//+------------------------------------------------------------------+ //| thebts.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/forum/3132//" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { string CommString; int err; //---- double cci = iCCI(NULL, PERIOD_H1, 7, PRICE_TYPICAL, 1); CommString=DoubleToStr(cci,4); err=GetLastError(); if (err!=0) CommString=StringConcatenate(CommString," error code = ", err); Comment(CommString); //---- return(0); } //+------------------------------------------------------------------+

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If I put the ea on daily period in the tester and i use a 1 hour timeframe in iCCI then it allways returns 0. It does the same for 4 hour as well.
I am using build 206 dated 6th June.
here is a cut down version of what i do that reproduces the problem: