[MQL4] How to access the value of MACD H1 on M15 chart ??? - page 2

 
whroeder1:
  1. limit = Bars - counted_bars;
    for(int i=limit; i>=0; i--){
       :
       mainL1=  iMACD(Symbol(),PERIOD_H1,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,i);
    You are mixing apples and oranges
  2. Don't double post.

On your link, I found the code to find the LowerTimeFlame (with me is the LargerTimeFlame) & I think the switch loop could do it (?). But my trouble is want to know the value of indicator of LargerTF at that time to draw the the arrow on the past. I know my trouble & I'm still finding the way to solve its.

Or on your link I misunderstand something (?)

int LowerTimeFrame(int timeFrame)
{
   static int validTFs[] = { 0, PERIOD_M1,
                                PERIOD_M1, PERIOD_M5, PERIOD_M15, PERIOD_M30,
                                PERIOD_H1, PERIOD_H4, PERIOD_D1,  PERIOD_W1   };
   for(int iTF = ArraySize(validTFs)-1; iTF > 1; iTF--)
      if(timeFrame == validTFs[iTF]) break;
   return( validTFs[iTF-1] );
}
 
Mladen Rakic:
mainL1=  iMACD(NULL,PERIOD_H1,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,iBarShift(NULL,PERIOD_H1,Time[i]));
And so on for each time frame you use, but you shall have to adjust your "limit" too in order to avoid repainting
mrsunftu:
Tks, I'll try. & report again.

Tks, It's work OK. But, I'll check again with the "limit" at next day..



 
mrsunftu:

On your link, I found the code to find the LowerTimeFlame (with me is the LargerTimeFlame) & I think the switch loop could do it (?). But my trouble is want to know the value of indicator of LargerTF at that time to draw the the arrow on the past. I know my trouble & I'm still finding the way to solve its.

Or on your link I misunderstand something (?)

int LowerTimeFrame(int timeFrame)
{
   static int validTFs[] = { 0, PERIOD_M1,
                                PERIOD_M1, PERIOD_M5, PERIOD_M15, PERIOD_M30,
                                PERIOD_H1, PERIOD_H4, PERIOD_D1,  PERIOD_W1   };
   for(int iTF = ArraySize(validTFs)-1; iTF > 1; iTF--)
      if(timeFrame == validTFs[iTF]) break;
   return( validTFs[iTF-1] );
}

And, by your suguest (link: https://www.mql5.com/en/forum/110170/page3#comment_3055330), I'll testing to using more buffer (2buf for the 2value of indicators on LargerTF).

Tks you so much.

T.Son

Previous Day High-Low
Previous Day High-Low
  • www.mql5.com
Hi, I am new to MetaTrader and to its programming language, I have some experience with VB and WealthLab, anyway is not the same...
 
Mehmet Bastem:
Do you mean that get the real time by funtion iTime[] -> then check the value of indicator on the LargerTF ?
 
William Roeder #:
  1. I gave you a link to learn what is wrong and how to fix it. You ignored it.
  2. Mladen Rakic shows you how to fix it. You ignored that also.

Dear my old kind instructors,

After a long, intermittent period, I searched again from 2023, and learned more MQL4 code...

Currently I can use the iBarShift function like Mr. Mladen Rakic & Mr. William Roeder. told

Thanks for all your guilding.
Mladen Rakic
Mladen Rakic
  • 2023.03.06
  • www.mql5.com
Trader's profile
Reason: