There is an interesting trading idea. Help me find errors in the code (mql4). - page 5

 
Corrected errors in conditions inGet_Signal()
Files:
 
Tweaked the multi-currency version
Files:
exp_cci_mt4.mq4  47 kb
 

my personal opinion - you can only use the very first signal to enter a trade or build a grid when there is a failure with a target at the opening price of the first order, subsequent ones often lie

not sure if these conditions are necessary

для бай
if(CCI_F1[index]>100.0 && CCI_F2[index]<100.0)return(OP_BUY);
if(CCI_F1[index]>100.0)return(OP_BUY);
для селл 
if(CCI_F1[index]<-100 && CCI_F2[index]>-100)return(OP_SELL);
if(CCI_F1[index]<-100)return(OP_SELL);

you should try to attach an alert to the first signal after a trend change

 
Juriy Iziymov:

my personal opinion - you can only use the very first signal to enter a trade or build a grid when there is a failure with a target at the opening price of the first order, subsequent ones often lie

not sure if these conditions are necessary

you should try to attach an alert to the first signal after a trend change

If you have the code, devise whatever conditions you like. There are as many people as there are opinions. If you find a good one, share it with the public).
 
Juriy Iziymov:

my personal opinion - you can only use the very first signal to enter a trade or build a grid when there is a failure with a target at the opening price of the first order, subsequent ones often lie

not sure if these conditions are necessary

you should try to attach an alert to the first signal after a trend change

These are the conditions for trend reversal, they were mentioned in the video too, if you think they are not necessary, just comment them out. In general, the function Get_Signal() is written in such a way that it leaves a lot of room for imagination
 

Oooh I missed the video, thanks

p.s. for ATR there is a TF daytime, but it's up to whoever wants it

 
I have created a little variant for MT5, of course it is raw, but it works in a demo, unfortunately I am not good at OOP. If anyone is able to make it work, I would be grateful to you. The strategy_cci.mqh file should be placed in folder Include. I wonder how it will work on futures and stocks.
Files:
 

The results of the run without optimisation over the last 2 years, the parameters were set at guesswork. I think you can already tell there is work to be done.

 
Sergey Gritsay:

The results of the run without optimisation over the last 2 years, the parameters were set at guesswork. I think it's safe to say there's already some work to be done.


And I finalised the Expert Advisor, which is at the bottom of page 1 of the topic. I have not got to your versions yet. On the chart testing H1 EURUSD from 28/01/2015 to date. Optimisation since 15/05/2015. this is around the 93rd trade. April is a failed month. The falling area to the left of the middle is summer(low volatility). It is better to rest in summer. From the second decade of September it starts to go up again. There is still a decent dip at the junction of November and December. The task is to determine the optimal length of the optimization period. I think we should not take more than 3 months. We should check it out.

 
Sergey Gritsay:
I have created a small v variant for MT5, it is too crude, but it works in demo mode. If anyone is able to modify it, I would be grateful to you. The strategy_cci.mqh file should be placed in folder Include. I wonder how it will work on futures and stocks.

I'm very grateful to you!!!) I'll try to understand the logic of the program. I think this system can be made into a reliable robot, the remarkable thing is that after the signal there is not often a drawdown (you can use a small stop) and the market continues for a long period of time to go in the right direction - maybe a trailing stop can be added?

Reason: