Wick Reject MA Indicator... Code issues need expert advice..... - page 2

 
Mohammad Rizal Bin Rahmat:
This doesn't solve the issues.. the alert still keep popping up....
Then it must be a bug in your code.
 
string mess_data[][9];
color mess_color[][9];
bool alert[][9];

ArrayResize(mess_data,NumPair+1,20);
ArrayResize(mess_color,NumPair+1,20);
ArrayResize(alert,NumPair+1,20);


      if(iHigh(pair[k],Trend_Timeframe[j],0)>=MAL &&
         iOpen(pair[k],Trend_Timeframe[j],0)<=MAL &&
         iClose(pair[k],Trend_Timeframe[j],0)<=MAL &&
         iLow(pair[k],Trend_Timeframe[j],0)<=MAL) 
        {
         mess_data[k][j]="D";mess_color[k][j]=clrRed;
         if(k>0 && use_alert && !alert[k][j])
           {
            Alert(pair[k]," ",Trend_Timeframe[j]," ",down_alert);
            alert[k][j]=true;
           }
        } 
      else if(iHigh(pair[k],Trend_Timeframe[j],0)>=MAL &&
         iOpen(pair[k],Trend_Timeframe[j],0)>=MAL &&
         iClose(pair[k],Trend_Timeframe[j],0)>=MAL &&
         iLow(pair[k],Trend_Timeframe[j],0)<=MAL)
        {
         mess_data[k][j]="U";mess_color[k][j]=clrLime;
         if(k>0 && use_alert && !alert[k][j])
           {
            Alert(pair[k]," ",Trend_Timeframe[j]," ",up_alert);
            alert[k][j]=true;
           } 
        }
      else 
        {
         mess_data[k][j]="X";mess_color[k][j]=clrGray;
         alert[k][j]=false;
        }      
 
Ernst Van Der Merwe:

Hi Sir,

THis does partly solve the issues but thank you sir... just want to ask u, is there any code that can actually prioritise a alert? for example i have 2 rules which gave the same alert, but i want 1 of it to be priority over the other?

         if(MAH>BBUp)
           {mess_data[k][j]="S";mess_color[k][j]=clrRed;}
         else if(MAL<BBDn)
           {mess_data[k][j]="B";mess_color[k][j]=clrLime;}
         else if(MAH>BBUp && iHigh(pair[k],Trend_Timeframe[j],0)>MA20 &&
         iOpen(pair[k],Trend_Timeframe[j],0)<MA20 &&
         iClose(pair[k],Trend_Timeframe[j],0)<MA20 &&
         iLow(pair[k],Trend_Timeframe[j],0)<MA20)
           {mess_data[k][j]="D";mess_color[k][j]=clrRed;
                 if(k>0 && use_alert && !alert[k][j])
           {
            Alert(pair[k]," ",Trend_Timeframe[j]," ",down_alert);
            alert[k][j]=true;
           }
        }        
         else if(MAL<BBDn && iHigh(pair[k],Trend_Timeframe[j],0)>MA20 &&
         iOpen(pair[k],Trend_Timeframe[j],0)>MA20 &&
         iClose(pair[k],Trend_Timeframe[j],0)>MA20 &&
         iLow(pair[k],Trend_Timeframe[j],0)<MA20)
           {mess_data[k][j]="U";mess_color[k][j]=clrLime;
                 if(k>0 && use_alert && !alert[k][j])
           {
            Alert(pair[k]," ",Trend_Timeframe[j]," ",up_alert);
            alert[k][j]=true;
           }
        }        
         else {mess_data[k][j]="X";mess_color[k][j]=clrGray;
         alert[k][j]=false;}
        }
     }

 

 K so here it is. So i have few rules. i just take 2 of it. 

IF
(code a)

         if(MAH>BBUp)
           {mess_data[k][j]="S";mess_color[k][j]=clrRed;}

 and
(code b)

         else if(MAH>BBUp && iHigh(pair[k],Trend_Timeframe[j],0)>MA20 &&
         iOpen(pair[k],Trend_Timeframe[j],0)<MA20 &&
         iClose(pair[k],Trend_Timeframe[j],0)<MA20 &&
         iLow(pair[k],Trend_Timeframe[j],0)<MA20)
           {mess_data[k][j]="D";mess_color[k][j]=clrRed;
                 if(k>0 && use_alert && !alert[k][j])
           {
            Alert(pair[k]," ",Trend_Timeframe[j]," ",down_alert);
            alert[k][j]=true;
           }
        }  

 shows together, i would want "code b" to be priority.... it will show the "code b" instead of the "code a"... is there any code for this?

 
if(MAH>BBUp)
  {
   if(iHigh(pair[k],Trend_Timeframe[j],0)>MA20 &&
      iOpen(pair[k],Trend_Timeframe[j],0)<MA20 &&
      iClose(pair[k],Trend_Timeframe[j],0)<MA20 &&
      iLow(pair[k],Trend_Timeframe[j],0)<MA20)
        {mess_data[k][j]="D";mess_color[k][j]=clrRed;
            if(k>0 && use_alert && !alert[k][j])
              {
               Alert(pair[k]," ",Trend_Timeframe[j]," ",down_alert);
               alert[k][j]=true;
              }
        }
   else
        {mess_data[k][j]="S";mess_color[k][j]=clrRed;}
  }
 
Ernst Van Der Merwe:
If i use "else" for that, what will happen to the code 

else {mess_data[k][j]="X";mess_color[k][j]=clrGray;
         alert[k][j]=false;}

Since i'm showing "X" when there isn't showing anything. The one showing "S" there is a rules for it. So doubt so can use "else" for it.

 
Thank you sir for the guidance
 

Hi Sir,

 

i tried to include on iMAOnArray..... having issues on this part,

         double MAofMACD=iMAOnArray(MACDM,pair[k],Trend_Timeframe[j],5,0,MODE_EMA,0);

 it stated, iMAOnArray wrong parameters count... i believe it has got t do with the "MACDM". this refer to the MACD. indicator part, working find. this for the dashboard area. thank you

 
Mohammad Rizal Bin Rahmat:

Hi Sir,

 

i tried to include on iMAOnArray..... having issues on this part,

 it stated, iMAOnArray wrong parameters count... i believe it has got t do with the "MACDM". this refer to the MACD. indicator part, working find. this for the dashboard area. thank you

what code can i use if i need the following,

double MAofMACD=********(MACD,SYMBOL,TIMEFRAME,PRIOD,MA SHIFT,MA METHOD,int SHIFT)

is there any?
 
Mohammad Rizal Bin Rahmat:

Hi Sir,

 

i tried to include on iMAOnArray..... having issues on this part,

 it stated, iMAOnArray wrong parameters count... i believe it has got t do with the "MACDM". this refer to the MACD. indicator part, working find. this for the dashboard area. thank you

double  iMAOnArray( 
   double       array[],          // array with data 
   int          total,            // number of elements 
   int          ma_period,        // MA averaging period 
   int          ma_shift,         // MA shift 
   int          ma_method,        // MA averaging method 
   int          shift             // shift 
   );
 
double MAofMACD=iMAOnArray(MACDM,pair[k],Trend_Timeframe[j],5,0,MODE_EMA,0);


So Your array is called MACDM, you have pair[k] elements, the period of your ma is trend_timeframe[j], your ma shift is 5, your ma mode is 0 (MODE_SMA) your shift is 1 (MODE_EMA), and then there is a zero left at the end ?

 
Marco vd Heijden:


So Your array is called MACDM, you have pair[k] elements, the period of your ma is trend_timeframe[j], your ma shift is 5, your ma mode is 0 (MODE_SMA) your shift is 1 (MODE_EMA), and then there is a zero left at the end ?

Hi Sir,

 

correct sir as to what you have mention... so i have to input the info first before i can put the array stand alone? 

Reason: