Forex



Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-17-2006, 06:29 AM
ycomp's Avatar
Member
 
Join Date: Jan 2006
Posts: 93
ycomp is on a distinguished road
MT4 gurus: How do I access an indicator of a different time frame?

Hi,

I came across this problem before and gave up.

Now I've encountered it again while trying to code another indicator. It is a common problem so I'm sure someone must know the answer.

The question is, using iCustom or built in iIndicator functions, how do I access data from another time frame? I know that there is a time frame parameter, and I use it but the problem is that the shift is still from the current chart.

I tried dividing shift by the ratio of the time frames (e.g. 4 for accessing H1 from M15) but that didn't seem to work for me.

example:

CoolIndicator1 is running on M15. It wants to read the value of RSI for current time frame... no problem call iRSI with timeframe of 0 or PERIOD_M15.

But how do I get the value of RSI for this point in time for M30? or H1?

I tried using iBarShift( ) but that didn't work out for me. Sounds like it is the right thing to use though.

So if anyone has any code that could be of use or simply any comments that could point me in the right direction, please post.

thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 02-17-2006, 07:40 AM
FloFri's Avatar
Junior Member
 
Join Date: Sep 2005
Posts: 23
FloFri is on a distinguished road
Smile

I had the same problem with some indicator's that wouldn't let me read data with iCustom.
There's a way to access all data from anywhere, that is if you are able to locate the variable(s) in the indicator that provide the data. I've been using this method for several months now, and I never missed any data with it. It sounds like a cludge and of course it is, but at least for testing purposes it works. By then you could decide if it's worth while to code a more robust solution.
Simply write te value of the indicator to a file. Then read it with the other indicator or expert. There's an example of this in the standard samples. Name the file with a combination of the indicators name with the timeframe and the symbol to keep them apart.
Maybe this helps (a bit).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 02-17-2006, 08:22 AM
ycomp's Avatar
Member
 
Join Date: Jan 2006
Posts: 93
ycomp is on a distinguished road
thanks... that should come in handy for something in the future, I'm sure.

I think I found the answer to my Q. just now.

http://www.metaquotes.net/forum/1290/

I tried this earlier but my mind was tied up in a knot and I realize now the mistake I made. I was using Open[shift] instead of Time[shift] for the open time parameter in iBarShift.

My brain was kind of on autopilot and in a nosedive :-)

So I'll read the article, try it again and hopefully should work.

Last edited by ycomp; 02-17-2006 at 08:23 AM. Reason: sp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 02-17-2006, 08:23 AM
keris2112's Avatar
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 130
keris2112 is on a distinguished road
Take a look at the code in the Price Channel Stop indicator that Igorad made. It should help you with what you are trying to accomplish.

http://www.forex-tsd.com/suggestions...p_v1-help.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 02-17-2006, 10:36 AM
Administrator
 
Join Date: Sep 2005
Posts: 20,059
Blog Entries: 241
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by ycomp
Hi,

I came across this problem before and gave up.

Now I've encountered it again while trying to code another indicator. It is a common problem so I'm sure someone must know the answer.

The question is, using iCustom or built in iIndicator functions, how do I access data from another time frame? I know that there is a time frame parameter, and I use it but the problem is that the shift is still from the current chart.

I tried dividing shift by the ratio of the time frames (e.g. 4 for accessing H1 from M15) but that didn't seem to work for me.

example:

CoolIndicator1 is running on M15. It wants to read the value of RSI for current time frame... no problem call iRSI with timeframe of 0 or PERIOD_M15.

But how do I get the value of RSI for this point in time for M30? or H1?

I tried using iBarShift( ) but that didn't work out for me. Sounds like it is the right thing to use though.

So if anyone has any code that could be of use or simply any comments that could point me in the right direction, please post.

thanks!
Just create an other indicator with this iRSI((NULL,period, ...) and in the beginning of the indicator (or EA) wrote like this;
extern int period = PERIOD_H1;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 02-17-2006, 03:49 PM
ycomp's Avatar
Member
 
Join Date: Jan 2006
Posts: 93
ycomp is on a distinguished road
Hi newdigital,

thanks but that won't work for me... I think that metaquotes link I posted holds the key, I'll find out when I get back to working on this indicator.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative Time Frame in MT4 -Please ! highway3000 Indicators - Metatrader 4 3 09-05-2007 08:03 AM
How to get an indicator value for another time frame ? yaniv_av Expert Advisors - Metatrader 4 2 10-31-2006 07:05 PM
Multiple Time frame Indicator rbowles Metatrader 4 9 06-22-2006 04:09 AM
2 EA in Same Pair at different time frame?? Could it possible? surya4trade General Discussion 5 06-15-2006 11:26 AM


All times are GMT. The time now is 12:04 PM.



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