Is this possible?

 

I have an indicator which looks for the cross of 2 variables - the tenken-sen and kijun-sen. Once they cross, an arrow is drawn on my chart and notifications sent etc.

I would like it to also check the timeframe 'above' to see if a cross in the same direction has already occured - i.e. if it's on M1, it'll check M5 (note: I'm only using MT4's standard timeframes - no custom ones).

My problem is that I use PERIOD_CURRENT, and so I don't see how I could program it to check the timeframe 'above' the current one.

pls help...


 tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
  
   if(upCloseArrowEnable && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2)
   { 
     buffer3[i] = iLow(Symbol(),PERIOD_CURRENT, i) - distance *  Point;
     if(i == 0 && IsCrossNewBar() )
     {
       if (SendAlertByNotification) SendNotification((string)Period()+" "+(string)Symbol()+" - Bullish TK Crossover: " 
       + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
     }
   }
 
WTM:

I have an indicator which looks for the cross of 2 variables - the tenken-sen and kijun-sen. Once they cross, an arrow is drawn on my chart and notifications sent etc.

I would like it to also check the timeframe 'above' to see if a cross in the same direction has already occured - i.e. if it's on M1, it'll check M5 (note: I'm only using MT4's standard timeframes - no custom ones).

My problem is that I use PERIOD_CURRENT, and so I don't see how I could program it to check the timeframe 'above' the current one.

pls help...


Try creating new values with the specific timeframe. say for example:  

tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_M5,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_M5,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
  
   if(upCloseArrowEnable && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2)
   { 
     buffer3[i] = iLow(Symbol(),PERIOD_CURRENT, i) - distance *  Point;
     if(i == 0 && IsCrossNewBar() )
     {
       if (SendAlertByNotification) SendNotification((string)Period()+" "+(string)Symbol()+" - Bullish TK Crossover: " 
       + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
     }
   }

Hope this will help you

 
jaffer wilson:

Try creating new values with the specific timeframe. say for example:  

Hope this will help you

Yeah, I thought of doing it this way, but this would mean creating a new indicator for every timeframe i want to apply it to? Is there no way of keeping period_current, and do it?

 
It only has to be multi-time frame specification.
But it is impossible to make it by only changing "PERIOD_CURRENT".
I upload the sample to refer it.
 
void SendCrossAlert()
{
  double tenkan_senValue1 = 0;
  double kijun_sen_Value1 = 0;
  double tenkan_senValue2 = 0;
  double kijun_sen_Value2 = 0;
  
  for(int i = 0;i < 300;i++)
  {
    tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
  
   if(upCloseArrowEnable && iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,0) > iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,0) && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2)
   { 
     buffer3[i] = iLow(Symbol(),PERIOD_CURRENT, i) - distance *  Point;
     if(i == 0 && IsCrossNewBar() )
     {
       if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bullish TKC: " 
       + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
     }
   }

I've done this, but it doesn't work how I want it to :(

 
jaffer wilson:

Try creating new values with the specific timeframe. say for example:  

Hope this will help you

void SendCrossAlert()
{
  double tenkan_senValue1 = 0;
  double kijun_sen_Value1 = 0;
  double tenkan_senValue2 = 0;
  double kijun_sen_Value2 = 0;
  
  for(int i = 0;i < 300;i++)
  {
    tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
    double tenkan_senAbove = iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    double kijun_sen_Above = iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
  
   if(upCloseArrowEnable && tenkan_senAbove >= kijun_sen_Above && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2)
   { 
     buffer3[i] = iLow(Symbol(),PERIOD_M15, i) - distance *  Point;
     if(i == 0 && IsCrossNewBar() )
     {
       if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bullish TKC: " 
       + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
     }
   }

I did this, but again, it doesn't work how i want. Can you see the problem?

 

It can not work out without using "iBarShift" to align the time of each time frame.

 
Naguisa Unada:

It can not work out without using "iBarShift" to align the time of each time frame.

After looking at iBarShift, I don't see how I can use it to help, can you give an example of what you mean? 

Also, why do the timeframes need aligning, when I specify that for the higher timeframe (H1) it uses the current candle to check

 
void SendCrossAlert()
{
  double tenkan_senValue1 = 0;
  double kijun_sen_Value1 = 0;
  double tenkan_senValue2 = 0;
  double kijun_sen_Value2 = 0;
  double High_Tenk = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,36,0));
  double Low_Tenk = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,36,0));
  double High_Kij = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,104,0));
  double Low_Kij = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,104,0));
  double Tenkan = (High_Tenk + Low_Tenk)/2;
  double Kijun = (High_Kij + Low_Kij)/2;
  
  for(int i = 0;i < 300;i++)
  {
    tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_CURRENT,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
   
  
   
      if(upCloseArrowEnable && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2 && Tenkan > Kijun)
      { 
      buffer3[i] = iLow(Symbol(),PERIOD_CURRENT, i) - distance *  Point;
      if(i == 0 && IsCrossNewBar() )
      {
         if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bullish TKC: " 
         + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
      }
      }
     
   else if(downCloseArrowEnable && tenkan_senValue1 < kijun_sen_Value1 && tenkan_senValue2 >= kijun_sen_Value2 && Tenkan < Kijun)
      
         buffer4[i] = iHigh(Symbol(),PERIOD_CURRENT, i) + distance *  Point;
      if(i == 0 && IsCrossNewBar())
      {
         if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bearish TKC: " 
         + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
      }
      

I also tried this. Basically i tried to recreate the tenkan-sen and kijun-sen, then looked for the conditions of the hourly timeframe but on the M15 timeframe. It is still not working though :(

 

For example, to display a chart of the 5-minute time frame on the chart of the 1-minute time frame.
Times of each array on the 1-minute chart are 0, 1, 2, 3, 4, 5 ..., but on the 5-minutes, chart they are 0, 5, 10, 15, 20, 25 ...

for (i = 0; i < 300; i++)
{
    M1_Buffer[i] = M1_data[i];
    M5_Buffer[i] = M5_data[i];
}

In this case, M1_Buffer[1] has data at 1 minute, but M5_Buffer[1] has data at 5 minutes.
In other words, you are referring to data at different times.
But you can adjust both times by using "iBarshift".

for (i = 0; i < 300; i++)
{
    y = iBarShift(NULL, PERIOD_M5, Time[i]);
    M1_Buffer[i] = M1_data[i];
    M5_Buffer[i] = M5_data[y];
}
 
Naguisa Unada:

For example, to display a chart of the 5-minute time frame on the chart of the 1-minute time frame.
Times of each array on the 1-minute chart are 0, 1, 2, 3, 4, 5 ..., but on the 5-minutes, chart they are 0, 5, 10, 15, 20, 25 ...

In this case, M1_Buffer[1] has data at 1 minute, but M5_Buffer[1] has data at 5 minutes.
In other words, you are referring to data at different times.
But you can adjust both times by using "iBarshift".

But the tenkan-sen and kijun-sen get updated with every tick. This happens on whatever timeframe, why would I need to adjust one, when they both 'get' data every tick?