Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2007, 10:40 AM
Junior Member
 
Join Date: Dec 2006
Posts: 13
Flirrrt is on a distinguished road
Calculating indicator in other timeframes than the one visualized?

A few months ago I saw a system/indicator that calculated it's values based on other timeframes, than the one present for visualization. Ex. I'm looking on H4-charts, but I want to know the value for H1 avg true range.

(yes, I can do this manually, but its for an ea)

I don't remember how they solved this, anyone got any ideas? It seems very complex to me to save all pricedata within the H4 bar of 1m, and then convert to H1 within the indicator. I think (hope) there's an easier way..

/Johan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-19-2007, 11:36 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
Quote:
Originally Posted by Flirrrt
A few months ago I saw a system/indicator that calculated it's values based on other timeframes, than the one present for visualization. Ex. I'm looking on H4-charts, but I want to know the value for H1 avg true range.

(yes, I can do this manually, but its for an ea)

I don't remember how they solved this, anyone got any ideas? It seems very complex to me to save all pricedata within the H4 bar of 1m, and then convert to H1 within the indicator. I think (hope) there's an easier way..

/Johan
Well, it is quite simple.
Take a look : double iATR( string symbol, int timeframe, int period, int shift)

I bolded 2 important parameters to do it. First is the timeframe which you want to read. Second is the shift of value ON REQUIRED timeframe according to current timeframe.
eg. if you wish to read m1 current bar atr on h4 timeframe you should write it like that :
double iATR(Symbol(), 1, 14, 0);
if you wish to read closed m1 bar atr:
double iATR(Symbol(), 1, 14, 1);
Hovever if you want to do somethig like read h4 value on m1 timeframe then you need to use iBarShift function as last param.
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-19-2007, 11:43 AM
zupcon's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Malta
Posts: 201
zupcon is on a distinguished road
Quote:
Originally Posted by Flirrrt
A few months ago I saw a system/indicator that calculated it's values based on other timeframes, than the one present for visualization. Ex. I'm looking on H4-charts, but I want to know the value for H1 avg true range.

(yes, I can do this manually, but its for an ea)

I don't remember how they solved this, anyone got any ideas? It seems very complex to me to save all pricedata within the H4 bar of 1m, and then convert to H1 within the indicator. I think (hope) there's an easier way..

/Johan
If you want to do this in real time in an EA, just do what Kalenzo suggests, and pass the appropriate timeframe parameter to each function. If your looking to do this with an indicator, then take a look at the various MTF indicators available by searching this site, and reference them using iCustom.

regards
zu
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
several timeframes in one MTF indicator fxbs Indicators - Metatrader 4 0 05-18-2007 06:46 AM
Calculating a moving average of an indicator in EA? forex123 Expert Advisors - Metatrader 4 1 05-05-2006 12:28 PM


All times are GMT. The time now is 10:08 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.