molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Mon May 13, 2024 6:07 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Tue Aug 13, 2013 9:45 pm 
Offline

Joined: Mon Dec 26, 2011 5:41 am
Posts: 46
This is a follow up from the topic I created in custom indicator builder at http://www.molanis.com/forum/viewtopic.php?f=9&t=5942&p=10952#p10952

As I notice what I observed from the custom indicator when I attach to chart both one that changes with the timeframe of chart and one that is fixed to a period,

The conditions I plan to look at are two parts, first comparison is between current chart timeframe, and the other comparison is using the custom indicator of a higher hardcoded timeframe.

So really I mean

custom 1: period based on current chart
custom 2: hardcoded period on higher timeframe

TA custom 1 comparison with something on current timeframe
AND
TA custom 2 comparison with something on higher timeframe
THEN
BUY as an example

Once EA is attach to the lower timeframe indicator, how can I be sure that the TA block calculations from the higher timeframe is calculated with the correct values ?


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Wed Aug 14, 2013 8:18 am 
Offline

Joined: Mon Dec 26, 2011 5:41 am
Posts: 46
I've added extra debugging information in code to see the values of interest from within the experts tab, if they are correct as per the charts for the higher timeframe.

If not, will try the following

1. attach EA to lower timeframe;
2. switch to higher timeframe of interest;
3. switch back to the lower timeframe

and then see the printed values again.


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Wed Aug 14, 2013 9:26 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Quote:
how can I be sure that the TA block calculations from the higher timeframe is calculated with the correct values ?

Printing the values is a good idea. Keep in mind that you cannot backtest it in mt4 so you need live testing.
When using muti time frame the main issue is the timing for the signal.
For example you have 2 signals, one in a 5 min, the other one in the 1 hr chart. You attach the ea to the 5 min chart. If you trade bars, the ea will evaluate the signals value (indicators) every 5 min bar. So every 5 min, the ea will check the value on the 5min and on the 1 hr chart. This means that after the fact, you can see the indicator values in the 5 min chart but not on the 1 hr chart - the 1 hr chart produces 12 signals per bar (5 min bar times 12 equals 60 min).

Quote:
If not, will try the following

1. attach EA to lower timeframe;
2. switch to higher timeframe of interest;

Not a good idea, when you switch timeframes the ea restarts. It is like attaching it again to the new timeframe
You may want to open 2 charts at the same time


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Sat Aug 17, 2013 6:09 pm 
Offline

Joined: Mon Dec 26, 2011 5:41 am
Posts: 46
Well I am testing in real time on demo account printing the values of the hardcoded period custom indicator for [0], [1], and [2] or [i], [i+1], [i+2]. Right now being higher [i+1] or [i+2] values of hardcoded PERIOD from present lower timeframe is fine for me.

If I do not initialize the hardcoded PERIOD with it's respective timeframe it works with, by going to that chart, at times it does not show the correct shapes.

For past data of charts that say I do not open that chart, when I put a hardcoded higher PERIOD, in an indicator from a lower timeframe, does this force a download of that chart for the higher ?

From what you say by open the higher one as well, is that to make sure hardcoded period from lower will remain in sync ?


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Sun Aug 18, 2013 5:06 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Not sure I understand your questions. I think is better that you ask one by one.

Quote:
For past data of charts that say I do not open that chart, when I put a hardcoded higher PERIOD, in an indicator from a lower timeframe, does this force a download of that chart for the higher ?


Probably. If you trade multi time frame it is better to open all charts so you see that the info is being updated in all charts.


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Mon Aug 19, 2013 6:31 am 
Offline

Joined: Mon Dec 26, 2011 5:41 am
Posts: 46
Quote:
Not sure I understand your questions. I think is better that you ask one by one.


This is what I mean.

Step 1. Have a custom indicator that uses the period of higher timeframe, say H1, hardcoded as PERIOD_H4, and the same indicator that uses period 0;
Step 2. Open a chart for a currency, that by default uses H1. Now on the same chart, attach both the custom indicator with period 0 and it's hardcoded H4 as well on the H1 chart;

From above I have not open the H4 chart for the pair, and just attached the hardcoded custom indicator. From MT4 File->Open Offline, I can see that the H4 chart is not on the list, while the custom indicator shows data. So it's reading something, and the indicator plots, in this case it's a line chart custom indicator.

However now that I open another chart for the pair and go to H4, and then attach the same custom indicator with period 0, i see slight differences between how it slopes looks and how the hardcoded PERIOD_H4 one attached to H1 chart looks.

I tried the same things after your response using the built in MT4 indicator. I imported the Accelerator Oscillator indicator as custom and set period to PERIOD_H4 creating a hardcoded custom H4 for AC.

I repeat the same steps with H1 first as above, and then open the H4 chart, but with this one both the hardcoded custom H4 from lower looks the same as the AC period 0 on H4.

This tells me the custom indicator am using has some odd problems with it.

When the hardcoded period is attached without even loading the period H4 chart separately, I can confirm that Mt4 does download the data in the background. After adding hardcoded H4 for another pair from H1, and checked from File->Open Offline, saw no H4 chart, while data does show on the custom indicator. I closed MT4 and re-opened it, and this time from File->Open Offline, I can see the H4 chart for the pair, and I never opened the chart myself.


Top
 Profile  
 
 Post subject: Re: Multitimeframe Custom Indicator in Strategy Builder
PostPosted: Tue Aug 20, 2013 8:22 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
If you use timeframe 0 it will take the timeframe from the chart so attaching it to H1 will give you H1 values for the calculation using timeframe 0 and H4 for the other calculation.
If you attach the same indicator to H4, both signals will use H4.

If you want to check the values for the signals, I think is best that you build normal indicators to see the values.Also open separated chart fro h1 and h4.

If I did not answer your question, post your indicator moi files and the custom indicator, and an explanation of your signals.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009