Download MetaTrader 5

So confused Help with modifying CCI+RSI

To add comments, please log in or register
Jonathan Troutt
26
Jonathan Troutt 2016.02.12 15:04 
So I am trying to add an alert function when CCI and RSI cross a certain level. I have been reading through the programming tutorial but I am lost at this point. I have a small amount of programming experience with embedded systems but this is totally different for me. I know I have to create function for the alert. I just need help is anyone willing?
Vasyl Nosal
18638
Vasyl Nosal 2016.02.12 15:51  
Have you written some code?
Jonathan Troutt
26
Jonathan Troutt 2016.02.12 16:15  
Vasyl Nosal:
Have you written some code?
lol yes but it is gone I delete and started all over. I think part of my issue is that I do not know what is going on withing the code of both the indicators. I did make a flow chart though to help me with the coding process
Vasyl Nosal
18638
Vasyl Nosal 2016.02.12 16:40  

Look to my template of arrow indicator with alert.

 https://www.mql5.com/ru/code/14173

Arrows Template
Arrows Template
  • votes: 17
  • 2015.11.16
  • Vasyl Nosal
  • www.mql5.com
Индикатор-шаблон который рисует на графике стрелки.
Vasyl Nosal
18638
Vasyl Nosal 2016.02.12 16:48  

Than change "main" to this

//main
   double rsi,rsi_prev;
   
 for(int i=all-counted;i>=0;i--)
 {
 if(i>Bars-20) i=Bars-20; 

 if(i==0)
 {
 up_arr[i]=EMPTY_VALUE;
 down_arr[i]=EMPTY_VALUE;
 }
 
 rsi=iRSI(Symbol(),0,14,PRICE_CLOSE,i);
 rsi_prev=iRSI(Symbol(),0,14,PRICE_CLOSE,i+1);
 if(rsi_prev<=20 && rsi>20) up_arr[i]=Low[i]-arrow_indent*Point; //up arrow
 if(rsi_prev>=80 && rsi<80) down_arr[i]=High[i]+arrow_indent*Point; //down arrow
 }
Vasyl Nosal
18638
Vasyl Nosal 2016.02.12 16:49  

You will have arrows on rsi crossing+alert.

Hope you will deal and understand logic of crossing. You nned to compare previous data of rsi and current with level. 

Jonathan Troutt
26
Jonathan Troutt 2016.02.13 04:01  
Ok thank you just got home and saw this I will give this a look and get back to you with questions. Thank you again.
Jonathan Troutt
26
Jonathan Troutt 2016.02.13 05:03  

This is exactly what I was looking for. I was trying to add the alert and crossover detection within the code for the RSI. Now here is another question for you. I was thinking if I had the base start I could add the other part in of what I want since it is just another alert upon crossing but it is also dependent on the RSI. So this is what I added to MAIN. I keep getting errors naturally. So what is going on here I apologize for my inexperience. My programming experience dealt with microprocessors and low level languages. I obviously am having a difficult time with Object oriented languages, this on in particular.

The idea here is the have the arrow and/or the alert when both the RSI and CCI cross a certain range at a certain time.

//main
      double rsi,rsi_prev,cci,cci_prev;
      
   
 for(int i=all-counted;i>=0;i--)
 {
 if(i>Bars-20) i=Bars-20; 

 if(i==0)
 {
 up_arr[i]=EMPTY_VALUE;
 down_arr[i]=EMPTY_VALUE;
 }
 
 rsi=iRSI(Symbol(),0,14,PRICE_CLOSE,i);
 rsi_prev=iRSI(Symbol(),0,14,PRICE_CLOSE,i+1);
 cci=iCCI(Symbol(),0,14, PRICE_CLOSE1,i);
 cci_prev=iCCI(Symbol(),0,14,PRICE_CLOSE1,i+1);
 if(rsi_prev<=45 && rsi>=50) && (cci_prev<=-5 && cci>=0) up_arr[i]=Low[i]-arrow_indent*Point; //up arrow
 if(rsi_prev>=55 && rsi<50) && (cci_prev>=5 && cci<=0) down_arr[i]=High[i]+arrow_indent*Point; //down arrow
 }
Vasyl Nosal
18638
Vasyl Nosal 2016.02.13 10:57  

You need to show errors.

 

CLOSE1

delete "1" 

Jonathan Troutt
26
Jonathan Troutt 2016.02.13 16:57  
'arrows_template2.mq4'    arrows_template2.mq4                     Line 1  Column  1
'&&' - operand expected    arrows_template2.mq4                     Line 102   Column 30
'up_arr' - some operator expected    arrows_template2.mq4       Line  102   Column 58
expression has no effect    arrows_template2.mq4                     Line  102   Column 47
expression has no effect    arrows_template2.mq4                     Line 102   Column 74
'&&' - operand expected    arrows_template2.mq4                     Line 103  Column  29
'down_arr' - some operator expected    arrows_template2.mq4   Line 103    Column56
expression has no effect    arrows_template2.mq4                     Line 103    Column45
expression has no effect    arrows_template2.mq4                     Line103   Column 75
4 error(s), 4 warning(s)        5    5

Here are the errors. I've gotten a few to go away but still having issues with these. Is my thinking correct with what I have added in the last post to MAIN?
Vasyl Nosal
18638
Vasyl Nosal 2016.02.13 17:01  
Jonathan Troutt:

Here are the errors. I've gotten a few to go away but still having issues with these. Is my thinking correct with what I have added in the last post to MAIN?
Better attach file
12
To add comments, please log in or register