Help Creating MTF EMA

 

I'm trying to build an indicator that displays the Period 1 daily open price on a 4 HOUR chart.

I've tried the following, but none of them work correctly

iOpen("GBPJPY",PERIOD_D1,i);
iMA("GBPJPY",PERIOD_D1,1,0,MODE_EMA,PRICE_OPEN,i); 

The Daily open price continues to change or elevate through out the day. The open price should always stay the open price, until the next day begins, no?

If I switch to daily charts, it's o.k. It's just the smaller time frames. Is metatrader not set up properly to plot larger time frame data on smaller time frame charts?

Thank you in advance

 

After days and hours of coding....I found my own solution

Others may want to take note of this, as it will save you days of coding and problem solving.

One can not simply create a single custom indicator and ask it to display 2 different MAs from 2 different time frames on a single chart at the same time. At least not accuratley!

You need to do the following:

1st: Create your custom indictator and give it a double that will allow you to enter a time frame value such as 1440,240,60, etc..

2nd: Create a second custom indicator and call your first indicator within it's code using iCustom (once for each MA) and set your time frame for each one accordingly.

You can plot 1 MA on a chart such as a daily ma on your 4 hour chart, but if creating a custom indicator that shows "BOTH" a 4 hour and daily MA, you must follow the instructions above using two custom indicators.

 

Seems two custom indicators is the only way to get accurate readings, but why is the memory consumption so high?

Anyone here familiar with building MTF indicators that can provide some help?

Thanks

 
I had a similar issue a while ago and as far as I remeber, ArrayCopyRates will work instead.
 
 
Thanks for the reply. I'll give them a try 
Reason: