顶级护肤品牌排行:MT4 gurus: How do I access an indicator of a ...
来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 06:56:42
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!
- Share
- Digg
- Del.icio.us
- Technorati
- Join Date
- Sep 2005
- Posts
- 42
- Points
- 5,971
- Level
- 8
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).
- Share
- Digg
- Del.icio.us
- Technorati
- Join Date
- Jan 2006
- Posts
- 93
- Points
- 13,059
- Level
- 14
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 07:23 AM. Reason: sp
- Share
- Digg
- Del.icio.us
- Technorati
- Join Date
- Dec 2005
- Location
- California, US
- Posts
- 130
- Points
- 126,521
- Level
- 51
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
- Share
- Digg
- Del.icio.us
- Technorati
- Join Date
- Sep 2005
- Posts
- 26,740
- Blog Entries
- 1026
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;
- Share
- Digg
- Del.icio.us
- Technorati
- Join Date
- Jan 2006
- Posts
- 93
- Points
- 13,059
- Level
- 14
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.
- Share
- Digg
- Del.icio.us
- Technorati
MT4 gurus: How do I access an indicator of a ...
MT4 gurus: How do I access an indicator of a ... aaa
The Arctic as an Indicator of World Climate C...
I Can Do with a Small Apartment
Using Custom Indicator in EA (MT4)
I am a rock, I am an island. ? 关于Kindle
How To Make a Youtube Video Into an Animated GIF
How To Export Data from a DLL or an Application
Lunar history: How do you solve a problem like maria?
双语诗歌 记住我是多爱你Remember how I do love you
How do managers
How Do You Do歌谱简谱网
How do you do?用法解说
How to be an expert
人教版九年级英语:Unit 1 How do you study for a test?
人教版九年级英语:Unit 1 How do you study for a test?-...1
人教版九年级英语:Unit 1 How do you study for a test?-...2
人教版新目标英语9年级Unit 1 How do you study for a test ?小测验
I Want! I Do! I Get!
“慢速英语” ·Let's do business: I made a sweetheart deal last week
How to Create an HTML Editor Application
How to Create an HTML Editor Application1
But i do 阿甘正传插曲
奥斯卡金曲everything i do