So confused Help with modifying CCI+RSI - page 2

 
You forgot (    )
 
Jonathan Troutt:

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.

for starters, check your "if" statements. All the conditions must be in one set of brackets, like

if (................ ) then ............

 
//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_CLOSE,i);
 cci_prev=iCCI(Symbol(),0,14,PRICE_CLOSE,i+1);
 if((rsi_prev<50 && rsi>50) && (cci_prev<0 && cci>0)) up_arr[i]=Low[i]-arrow_indent*Point; //up arrow
 if((rsi_prev>50 && rsi<50) && (cci_prev>0 && cci<0)) down_arr[i]=High[i]+arrow_indent*Point; //down arrow
 }

//new bar
   if(Bars==prev_bars) return(rates_total);
   prev_bars=Bars;

//Alerts
   if(use_alert)
     {
      if(up_arr[1]!=EMPTY_VALUE) Alert(Symbol()," ",Period()," ",up_alert);
      if(down_arr[1]!=EMPTY_VALUE) Alert(Symbol()," ",Period()," ",down_alert);
     }

   return(rates_total);
  }
//+------------------------------------------------------------------+
So I think I got it now where it is not missing any crossings. What I would like to do next is make it to where it alerts depending on a range. So the rsi range would be 45-55 and the cci range would be -5 to 5. I have an idea how to do it. Create a variable for both the RSI and CCI and then have the alert use that. Would that be correct?
if (rsi >45 && <50) rsiVariable == TRUE
    else (rsiVariable == FALSE);
if (cci >-5 && <5) cciVariable == TRUE
    else (cciVariable == FALSE); 
 
David Raine:

for starters, check your "if" statements. All the conditions must be in one set of brackets, like

if (................ ) then ............

Thanks David I discovered that after starting at it for 15 minutes....lol. I figure the best way to learn this stuff is just to do it. So I am trying to do simple things at first and work my way up to more challenging algorithms. I do use Microsoft visio to help with program flow. I have been using that since I was taking classes in embedded programming.
Reason: