How can I get the exact values of Multiple Time Frames

 

Hello,
It's very glad to contact with you, first.
The followings below is my difficulties, and hope you to read and help.

I have a pre-made indicator that shows simple arrows for Buy / Sell Entry.
This pre-made indicator does not read the values of the 1st previous (closed) candle properly.
And the main chart (trading time frame) is M1 chart, and it uses HFT (Higher Time Frame) likely as M5 and H1.
At this time, calculations in M5 and H1 are for the trend.
But it does not calculate the conditons in a right way.
For example, the calculation is right, and sometimes not right.
I think it misses the calculation of M5 and H1.
It does not work properly even if there are only simple 4 conditions in Buy Entry.
I don't know exactly why it happens.
So, I hope it to read the values of the 1st previous (closed) candle exactly.
Could you please fix this simple indicator to work properly?

Best,
David


P.S. - attached the issued code below

 
if(iCustom(NULL, PERIOD_H1, "OIH_TDI_SSA_Simple_v1.0", PRICE_CLOSE, 10, 2, 20, 500, 2, MODE_LWMA, 7, MODE_LWMA, 10, MODE_LWMA, 98, 0, -0.40, 0.0, 0.40, 2, 1+h1_bar)
  1. Name your file extensions properly (.MQ4 not .TXT)

  2. Why did you post your MT4 indicator question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  3. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors.
              Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

 
whroeder1:
if(iCustom(NULL, PERIOD_H1, "OIH_TDI_SSA_Simple_v1.0", PRICE_CLOSE, 10, 2, 20, 500, 2, MODE_LWMA, 7, MODE_LWMA, 10, MODE_LWMA, 98, 0, -0.40, 0.0, 0.40, 2, 1+h1_bar)
  1. Name your file extensions properly (.MQ4 not .TXT)

  2. Why did you post your MT4 indicator question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  3. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors.
              Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

Firstly, thanks for your rapid and great answers.

1. Yes, I'll upload it in formation of mql4.

2. Sorry for this posting here, I didn't know where to post exactly

3. I'll check it more.

Thanks,

David

 

Hello whroeder1,

I have a simple question.

In the attached code, there are functions likely as belows.

//-- Stair Bars
   int m1_bar=0,m5_bar=0,h1_bar=0;



void GetBars(int bar,int &m1_bar,int &m5_bar,int &h1_bar)
{
   m1_bar = iBarShift(NULL,PERIOD_M1,Time[bar]);
   m5_bar = iBarShift(NULL,PERIOD_M5,Time[bar]);
   h1_bar= iBarShift(NULL,PERIOD_H1,Time[bar]);
}


Above 2 functions are for getting values of few higher time frames, but it does not work well.

And I have read the article that you linked in -  Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

To get the exact values of 1st previous (closed) bar of few higher time frames like M5 and H1, the way of downloading history is better than above 2 functions?

In other words, no need to use above 2 functions, but only download history function?

Thanks,

David


P.S. - Thanks for your help, especially for the links, and thanks to you, I think my post is right place now.

  

 
  1. You make sure history has been updated for the various TFs.
  2. Your iBarShift just finds the appropriate shift, for the updated TFs.
  3. You still have to get the values.
 
whroeder1:
  1. You make sure history has been updated for the various TFs.
  2. Your iBarShift just finds the appropriate shift, for the updated TFs.
  3. You still have to get the values.

Great thanks for your reply, MR. whroeder1.

And very sorry, but I have some difficulties to follow your answers.

1. How can I check if the history has been updated or not?

2. How can I check if iBarShift finds appropriate shift in updated TFs?

3. "Still having to get the values" means that I have to use "Void GetBars"?

4. I'm wondering if it is possible to resolve this issue by using current "Void GetBars" and extra functions to check if history has been updated or not and if iBarShift can find appropriate shift or not.

5. Or a way of "downloading history" alone can resolve this issue?

6. How about "Stair Bars?

    Is it useful to get the stair typed values of the 1st previous (closed) bar from few time frames?

    Or is it not necessary to use when the function of "downloading history" used?


My questions are very long, I think... sorry for that..

Actually, I want to learn and study this skills to resolve this issue.

I hope you not to feel any burdens in mind to answer...because I'm just trying to learn it. :)

Thanks,

David 

 
davidoh: And very sorry, but I have some difficulties to follow your answers.

1. How can I check if the history has been updated or not?

2. How can I check if iBarShift finds appropriate shift in updated TFs?

3. "Still having to get the values" means that I have to use "Void GetBars"?

4. I'm wondering if it is possible to resolve this issue by using current "Void GetBars" and extra functions to check if history has been updated or not and if iBarShift can find appropriate shift or not.

5. Or a way of "downloading history" alone can resolve this issue?

6. How about "Stair Bars?

    Is it useful to get the stair typed values of the 1st previous (closed) bar from few time frames?

    Or is it not necessary to use when the function of "downloading history" used?

  1. I gave you the link. Go and reread it.
  2. If the chart is update, it always works.
  3. GetBars just computes the shift. It doesn't get any values.
  4. GetBars just computes the shift. It doesn't get any values. #1 #2
  5. DownloadHistory doesn't get values #1
  6. Your variables near comment Stair Bars are variables containing shifts. They are not market values. How do you know which shift for the multiple TFs so you want for bar? DownloadHistory has nothing to do with values.
  7. learn to code it or or pay (Freelance) someone to code it. Your questions are moronic. Stop wasting our time.
 
whroeder1:
  1. I gave you the link. Go and reread it.
  2. If the chart is update, it always works.
  3. GetBars just computes the shift. It doesn't get any values.
  4. GetBars just computes the shift. It doesn't get any values. #1 #2
  5. DownloadHistory doesn't get values #1
  6. Your variables near comment Stair Bars are variables containing shifts. They are not market values. How do you know which shift for the multiple TFs so you want for bar? DownloadHistory has nothing to do with values.
  7. learn to code it or or pay (Freelance) someone to code it. Your questions are moronic. Stop wasting our time.

Thanks for the reply.

I'll try to...

Reason: