I created this CCI and EMA EA and i compiled it and there was no error only for me to backtest it and it seems its not backtesting at the same time its not giving me any error in the journal. The EA buys when CCI is above level 0 and price is above EMA. please help guys.
This is the code thanks guys
Hello,
make sure the expert call all functions.
I see CalculateCurrentOrders function not called of code.
Maby need to add it on OnTick function to call expert and open orders.
Continue uses this code....
- Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
-
int _Sell; int _Buy; return _Buy; return _Sell;
What values are you returning?
You forgot to define the signal values _Sell and _Buy. I suggest to use it like this:
string CheckForTrade() { double x1 = iCCI(Symbol(),_Period,14,PRICE_TYPICAL,0); double x2 = iCCI(Symbol(),_Period,14,PRICE_TYPICAL,1); if(x2>0 && x2!=EMPTY_VALUE) return "Buy"; if(x1<0 && x2!=EMPTY_VALUE) return "Sell"; return ""; }
And check with if(signal=="Buy") etc.
Then you need to watch your conditions, that does not look right, at least the place where you mixed x1 and x2 is buggy.
You forgot to define the signal values _Sell and _Buy. I suggest to use it like this:
And check with if(signal=="Buy") etc.
Then you need to watch your conditions, that does not look right, at least the place where you mixed x1 and x2 is buggy.
its telling me implicit conversion from string to number
- Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
- What values are you returning?
int _Sell= -1;
int _Buy = 1;
Hello,
make sure the expert call all functions.
I see CalculateCurrentOrders function not called of code.
Maby need to add it on OnTick function to call expert and open orders.
Continue uses this code....
Thanks a lot for this i appreciate but i hasve one more issue with this code, the closing condition is supposed to be with CCI not EMA that is it closes a trade when the CCI crosses 0 level back down in a buy trade or when it crosses zero to the upside in a sell trade, but the code here it closes the trade when the price crosses the EMA. The EA opens a trade with confirmation from CCI and EMA but closes the trade with confirmation from only CCI then when the CCI crosses again and the EMA still aligns it takes another trade. I would really appreciate if you can modify thanks a lot
Thanks a lot for this i appreciate but i hasve one more issue with this code, the closing condition is supposed to be with CCI not EMA that is it closes a trade when the CCI crosses 0 level back down in a buy trade or when it crosses zero to the upside in a sell trade, but the code here it closes the trade when the price crosses the EMA. The EA opens a trade with confirmation from CCI and EMA but closes the trade with confirmation from only CCI then when the CCI crosses again and the EMA still aligns it takes another trade. I would really appreciate if you can modify thanks a lot
Hello,
I've deleted some function because I can't to understand how it works.
Please check all operations of experts.
You can to continue with this code....
Hello,
I've deleted some function because I can't to understand how it works.
Please check all operations of experts.
You can to continue with this code....
Hello Nikolaos I really appreciate it is working well now. Im trying to convert it to mt5 EA but it is giving me serious issues do you have any idea on that?
Hello Nikolaos I really appreciate it is working well now. Im trying to convert it to mt5 EA but it is giving me serious issues do you have any idea on that?
The open and close orders functions are totally different in MT5.
And way to call and uses indicators have different.
Not simple to convert mq4 to mq5 a code.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I created this CCI and EMA EA and i compiled it and there was no error only for me to backtest it and it seems its not backtesting at the same time its not giving me any error in the journal. The EA buys when CCI is above level 0 and price is above EMA. please help guys.
This is the code thanks guys