Need more code.
Marco vd Heijden:
Need more code.
OK. Here is the function:Need more code.
void OrderCheckBeginn ()
{
double ADXmain,ADXplus,ADXminus;
double ADXmain_old;
double rsi_1 = iRSI(Symbol(), PERIOD_CURRENT, periodRSI, PRICE_CLOSE, 1);
//---- get indicators
ADXmain = iADX(0,0,14,0,0,1);
ADXplus = iADX(0,0,14,0,1,1);
ADXminus = iADX(0,0,14,0,2,1);
ADXmain_old = iADX(0,0,14,0,0,2);
//---- sell conditions
if( (ADXplus<ADXminus) && (rsi_1 > RSI_Sell) && (ADXmain>=25) && (ADXmain>ADXmain_old))
all of the iADX lines are egtting the same warning. BTW I just changed the notation from text to numbers thinking I might have misspelled something.
The code is correct. Perhaps the error is on other line that correlated with ADXmain.
I can compile this
double ADXmain = iADX(0,0,14,PRICE_CLOSE,MODE_MAIN,1);
Without errors.
Are there any includes?
Irwan Adnan:
Thanks for the help. I just tried that but it didn't work. Try to change function type as double not void.
I've been trying to find the error now for 4 days now, looking at the help file one more time I found it! It works when I change it to:
ADXmain = iADX(NULL,0,14,0,0,1);
"NULL" instead of "0".
Again Proof that the hardest problems to find are the ones you cause yourself.
datas_brother:
Thanks for the help. I just tried that but it didn't work.
I've been trying to find the error now for 4 days now, looking at the help file one more time I found it! It works when I change it to:
ADXmain = iADX(NULL,0,14,0,0,1);
"NULL" instead of "0".
Again Proof that the hardest problems to find are the ones you cause yourself.
Thanks for the help. I just tried that but it didn't work.
I've been trying to find the error now for 4 days now, looking at the help file one more time I found it! It works when I change it to:
ADXmain = iADX(NULL,0,14,0,0,1);
"NULL" instead of "0".
Again Proof that the hardest problems to find are the ones you cause yourself.
But it is still incorrect.
The reason it warned you about implicit conversion from number to string is that the first position is a string and its the symbolname.
double iADX(
string symbol, // symbol
int timeframe, // timeframe
int period, // averaging period
int applied_price, // applied price
int mode, // line index
int shift // shift
);
string symbol, // symbol
int timeframe, // timeframe
int period, // averaging period
int applied_price, // applied price
int mode, // line index
int shift // shift
);
You should use
double ADXmain=iADX(Symbol(),.....
To match the chart symbol to the indicator call or use a string value like "EURUSD" instead.
Marco vd Heijden:
Yes but acc. to help "NULL" means current symbol. After changing, the warnings went away.
But it is still incorrect.
The reason it warned you about implicit conversion from number to string is that the first position is a string and its the symbolname.
double iADX(
string symbol, // symbol
int timeframe, // timeframe
int period, // averaging period
int applied_price, // applied price
int mode, // line index
int shift // shift
);
string symbol, // symbol
int timeframe, // timeframe
int period, // averaging period
int applied_price, // applied price
int mode, // line index
int shift // shift
);
You should use
double ADXmain=iADX(Symbol(),.....
To match the chart symbol to the indicator call or use a string value like "EURUSD" instead.
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
I'm working on my first complete EA and when compiling I get the following warning:
The line it refers to is:
where ADXMain is declared as a double. According to the help file iADX is type double so I don't understand why MetaEditor wants to convert it to a string. Can anyone tell me what I'm doing wrong?
Thanks.