How to get crossed arrow from this indicator ?

 
//+------------------------------------------------------------------+
//|                                            Special_RSI_ARROW.mq4 |
//|                                          Copyright 2009, leMai |
//+------------------------------------------------------------------+
#property  copyright "Copyright 2009, leMai"
//----
#property  indicator_separate_window
#property  indicator_buffers 5
#property  indicator_color1  Green//Green
#property  indicator_color2  White
#property  indicator_color3  Blue
#property  indicator_color4  LimeGreen
#property  indicator_color5  Red//Red Reverse
//----
extern int RSIPeriod1=17;
extern int RSIPeriod2=3;
extern int Cross1=10;
extern double difference=2.0;

double   ind_buffer1[];
double   MABuffer1[];
double   Cross[];
double   UpArrow[];
double   DnArrow[];

double now=1,last=0;
int direction=0;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 234);//233
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 233);//234 reverse
//----   
   SetIndexBuffer(0, ind_buffer1);
   SetIndexBuffer(1, MABuffer1);
   SetIndexBuffer(2, Cross);
   SetIndexBuffer(3, UpArrow);
   SetIndexBuffer(4, DnArrow);
//----   
   IndicatorShortName("Special RSI ARROW");
   Comment("leMai");
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double RSI1,RSI2;

   int  Limit, i, counted_bars = IndicatorCounted();
//----
   if(counted_bars < 0) 
       return(-1);
//----
   if(counted_bars > 0) 
       counted_bars--;
   Limit=ArraySize(MABuffer1);
   for(i=Limit; i>=0; i--) 
   {
     RSI1 = iRSI(NULL, 0, RSIPeriod1, PRICE_CLOSE, i);
     RSI2 = iRSI(NULL, 0, RSIPeriod2, PRICE_CLOSE, i);

     MABuffer1[i] = (RSI1-RSI2);
     
   }
   
   
      
   for(i=Limit; i>=0; i--)
   {
     ind_buffer1[i] = iMAOnArray(MABuffer1,0,14,0,MODE_EMA,i);   
   }    
   
   for(i=Limit; i>=0; i--)
     {
      Cross[i]=iMAOnArray(ind_buffer1,Bars,Cross1,0,MODE_EMA,i);
      now=Cross[i];
     
    
      if(now>(last+(difference/1000)))
      {
        if(direction<1)
        {
         UpArrow[i]=Cross[i];
         direction=1;
        } 
      }
        else  
          if(now<(last-(difference/1000)))
          {
            if(direction>-1)
            {
             DnArrow[i]=Cross[i];
             direction=-1;
            }        
          } 
         
      last=Cross[i];
     } 
   
   for(i=Limit; i>=0; i--)
      {
        MABuffer1[i]=0;
      }
   
   
   return(0);
}
//+------------------------------------------------------------------+

Hi

This  indicator shows arrow up and down when it crossed

How can I use iCustom to get crossed arrow value ?

I try

   string sRSISignal;

   double sRSICross = iCustom(NULL, 0, "Special RSI ARROW",2,1);

   if(sRSICross == EMPTY_VALUE ) { sRSISignal = "Cross"; }

But it return nothing

Can anyone please suggest what I missed ?

The cross buffer should be 2 isn't it ?

 

Thanks in advance :) 


            
 
naruponk:

Hi

This  indicator shows arrow up and down when it crossed

How can I use iCustom to get crossed arrow value ?

I try

   string sRSISignal;

   double sRSICross = iCustom(NULL, 0, "Special RSI ARROW",2,1);

   if(sRSICross == EMPTY_VALUE ) { sRSISignal = "Cross"; }

But it return nothing

Can anyone please suggest what I missed ?

The cross buffer should be 2 isn't it ?

 

Thanks in advance :) 

No calculation buffer with result EMPTY_VALUE in your code.
Should you creat 2 iCustom for cross: sRSICross0 and sRSICross1.
If sRSICross1<0 and sRSICross0>0 = CrossUp, and vice versa

 
3rjfx:

No calculation buffer with result EMPTY_VALUE in your code.
Should you creat 2 iCustom for cross: sRSICross0 and sRSICross1.
If sRSICross1<0 and sRSICross0>0 = CrossUp, and vice versa

Thanks for reply it does not work, Any other way to get the cross signal ?

:)

 
naruponk:

Thanks for reply it does not work, Any other way to get the cross signal ?

:)

I've changed to

 

   if(sRSIG2 != EMPTY_VALUE ) { sRSIColor = "Green"; }

   if(sRSIR2 != EMPTY_VALUE ) { sRSIColor = "Red"; } 

 

I was wrong when putting != and ==

Crossed buffer not work but get value of arrow up and down works!

 
naruponk:

I've changed to

 

   if(sRSIG2 != EMPTY_VALUE ) { sRSIColor = "Green"; }

   if(sRSIR2 != EMPTY_VALUE ) { sRSIColor = "Red"; } 

 

I was wrong when putting != and ==

Crossed buffer not work but get value of arrow up and down works!

How do you know that your code "sRSIColor" does not work ?.

To view the results string sRSIColor string, you must create a script to print sRSIColor "Green" or "Red".
Because the string variable might not be seen on the screen if it is not printed or "ObjectCreate"

 
naruponk:

Hi

This  indicator shows arrow up and down when it crossed

How can I use iCustom to get crossed arrow value ?

I try

   string sRSISignal;

   double sRSICross = iCustom(NULL, 0, "Special RSI ARROW",2,1);

   if(sRSICross == EMPTY_VALUE ) { sRSISignal = "Cross"; }

But it return nothing

Can anyone please suggest what I missed ?

The cross buffer should be 2 isn't it ?

 

Thanks in advance :) 

The cross buffer is in buffer 3 and 4 which is UpArrow[] and DnArrow[] so the statements might be like this :

 

if(iCustom(NULL, 0, "Special RSI ARROW",3,1)!=EMPTY_VALUE || iCustom(NULL, 0, "Special RSI ARROW",4,1)!=EMPTY_VALUE)
{ sRSISignal = "Cross"; }
 
Irwan Adnan:

The cross buffer is in buffer 3 and 4 which is UpArrow[] and DnArrow[] so the statements might be like this :

 

Works fine, thanks a lot :)

Reason: