Help time frame issues iRSI , iOpen i...Etc

Back to topics list To post a new topic, please log in or register
avatar
7
walomx 2016.08.08 16:22
 

 i can't get anything related to another timeframe plot correctly in my time frame i am using. Lets say i am in the 1 min chart and want to plot data from the 5 min, i want 5 min upbars plot as up arrow in 1min chat and

5min < 30 RSI, plot as down arrow in my 1 min chart, here is my code (not doing what it should):

#property version   "1.0"
#property strict
#property copyright "me"
#property description "demo timeframe"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red   
#property indicator_color2 Lime 

// Buffers
double UP[];
double DN[];


double RSI[];
datetime Crono;
string Color;
extern bool SoundAlert=False;

int init()

  {



   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW,NULL,0);
   SetIndexArrow(0,234); // UP arrow
   SetIndexBuffer(0,UP);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,NULL,0);
   SetIndexArrow(1,233); //DN Arrow
   SetIndexBuffer(1,DN);
   SetIndexEmptyValue(1,0.0);

   return(INIT_SUCCEEDED);

  }


int start()

  {



   int    limit;
   int counted_bars=IndicatorCounted();

   ArrayResize(RSI,Bars);

   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

   int lookback=100;



   for(int i=Bars-1-MathMax(lookback,counted_bars); i>=1; --i) 

     {

      RSI[i]= iRSI(NULL,5,6,PRICE_CLOSE,i);

      if(Crono<Time[0])
        {
         SoundAlert=True;
         Crono=Time[0];
        }


      if(iUpBar(i)== True)
        {
         DN[i]=Low[i]-17*Point;
         if(SoundAlert==True && i<3)
           {

            Alert(Symbol()," Go Long ",Period());
            SoundAlert=False;
            Crono=TimeCurrent();
           }

        }

      else{DN[i]=0.0;}


      if(RSI[i] < 30)
        {
         UP[i]=High[i]+17*Point;
         if(SoundAlert==True && i<3)
           {
            Alert(Symbol()," Go Short ",Period()); //PlaySound("alert2.wav")
            SoundAlert=False;
            Crono=TimeCurrent();
           }

        }
      else{UP[i]=0.0;}
     }


   return(0);

  }



bool iDownBar(int bar)

  {
   return (iClose(NULL,PERIOD_M5,bar)<iOpen(NULL,PERIOD_M5,bar));
  }


bool iUpBar(int bar)
  {
   return (iClose(NULL,PERIOD_M5,bar)>iOpen(NULL,PERIOD_M5,bar));
  }

 

 

Any ideas?

 

Thanks!! 

avatar
12985
WHRoeder 2016.08.08 21:28 #
 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. RSI[i]= iRSI(NULL,5,6,PRICE_CLOSE,i);
    You are mixing apples and oranges
avatar
7
walomx 2016.08.08 22:02 #
 
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. You are mixing apples and oranges

Thanks for your answer 

1.- Got it and edited 

2.- Why?  RSI[] is just an array,  It is supposed to keep the values of the M5 charts

  

avatar
12985
WHRoeder 2016.08.09 03:14 #
 
walomx: - Why?  RSI[] is just an array,  It is supposed to keep the values of the M5 charts
    if(RSI[i] < 30){
         UP[i]=High[i]+17*Point;
The RSI[i] controls UP[i] on the current chart. If i is 2 (2 minutes ago) why would you care about the RSI 10 minutes ago (2 on the M5?) If i is 6 why would you care about the RSI 30 minutes ago?
avatar
7
walomx 2016.08.09 06:43 #
 
WHRoeder:
The RSI[i] controls UP[i] on the current chart. If i is 2 (2 minutes ago) why would you care about the RSI 10 minutes ago (2 on the M5?) If i is 6 why would you care about the RSI 30 minutes ago?

It's just an example, i am trying to develop an strategy based on longest time frames, but the question is not why is how?,  if the condition is true on the M5, and i  is 2 and 2 is placed on 8:00 hrs  i should have 5 down arrows on the M1 chart, from 8:00 to 8:04, but it plot me nonsense.

Or lets say on the M5 i have an UpBar on the last closed bar or on the last bar developing, i can plot M1 price action long with up arrow for each corresponding M1 bar with the Up Bar on M5

How? 

Back to topics list  

To add comments, please log in or register