• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 2:51pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 2:51pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Timeframe inside current timeframe - is that possible? 2 replies

Seeing higher timeframe indicators on lower timeframe 4 replies

Referencing custom indicator data 2 replies

Referencing Indicator Arrays. 4 replies

IB referencing to my account 12 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Referencing higher timeframe data in an indicator
Cancel

Referencing higher timeframe data in an indicator

  • Post #1
  • Quote
  • First Post: Edited 10:30pm Nov 30, 2012 10:28pm | Edited 10:30pm
  •  drofwarc
  • | Joined Dec 2009 | Status: Member | 105 Posts
Hi all,

I'm coming along pretty well in my efforts to learn to code in mql4, but I'm stumped about something. I can't understand whether it's possible to create an indicator that references higher timeframes, and use that information to plot data on a lower timeframe chart.

For instance, I would like to plot an arrow on an hourly bar at the cross of the hourly MACD -- if the H4 MACD is already crossed in the same direction. This is for research purposes. The H4 cross would have been completed in the past, so I don't understand why there should be a problem.

However, after a great deal of searching, I have yet to find a single example of an indicator that does this correctly. Over at the MQL4 forum, I found several discussions on the topic, but all the coders who were attempting it seemed to have ended in failure.

From these discussions, I'm aware that I would need to specify the period, as in the following.

Inserted Code
[font=&quot]double macd = [url="http://docs.mql4.com/indicators/iMA"]iMACD [/url](NULL ,PERIOD_H4, fastema, slowema, PRICE_CLOSE, MODE_MAIN , i+1);
double sig= [/font][font=&quot][font=&quot][url="http://docs.mql4.com/indicators/iMA"]iMACD [/url][/font](NULL, PERIOD_H1, fastema, slowema, PRICE_CLOSE, MODE_SIGNAL ,i+1);[/font]
And I'm able to create a working indicator with this approach that plots arrows. But the arrows do not accurately reflect the higher timeframe MACD, only the current timeframe.

I'm not looking for someone to code my indicator for me. Just please enlighten me. This must be a well-trodden path for experienced coders. Is it possible to do this or am I on a wild goose chase?

regards,

drofwarc
  • Post #2
  • Quote
  • Dec 1, 2012 2:41am Dec 1, 2012 2:41am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
You are possibly referencing the wrong higher TF bar.
The i+1 refers to the current TF of the chart.

You would need to use iBarShift for the higher TF.

HTH

M.
If you think I'm mad, I must be mad
 
 
  • Post #3
  • Quote
  • Last Post: Edited 5:44pm Dec 1, 2012 3:23pm | Edited 5:44pm
  •  drofwarc
  • | Joined Dec 2009 | Status: Member | 105 Posts
Quoting futurespec
Disliked
You are possibly referencing the wrong higher TF bar.
The i+1 refers to the current TF of the chart.

You would need to use iBarShift for the higher TF.

HTH

M.
Ignored
futurespec,

Thank you for your response. That did the trick!

Have a great weekend,

drofwarc
 
 
  • Platform Tech
  • /
  • Referencing higher timeframe data in an indicator
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023