Indicator readings from H1 to M15

 

Hello to eveyone,

I am facing a problem, i don't know if there is a solution. I am creating a custom indicator and i want the readings of this indicator from the timeframe H1 to dispalyed in the timeframe M15.

For examlpe:

if ( iMA(NULL, PERIOD_H1,.....,i)  > iMA(NULL, PERIOD_H1,.....,i)

   { Buffer1[i] = ..........; }


I want this <<Buffer1>> reading to dispalyed in the timeframe M15. 

Thank you.


Greetings,

Ioannis

 
Ioannis Karamintzios: I am creating a custom indicator and i want the readings of this indicator from the timeframe H1 to dispalyed in the timeframe M15.
if ( iMA(NULL, PERIOD_H1,.....,i)  > iMA(NULL, PERIOD_H1,.....,i){ 
   Buffer1[i] = ..........; }
  1. No you don't. You want the H1 moving average to be used in calculating on the current chart's display (what ever TF it is.)
  2. That is different than a MTF indicator which uses itself on one TF to display on another (much harder.)
  3. Don't mix apples and oranges.
 
Ioannis Karamintzios:

Hello to eveyone,

I am facing a problem, i don't know if there is a solution. I am creating a custom indicator and i want the readings of this indicator from the timeframe H1 to dispalyed in the timeframe M15.

Try the attached indicator as example. You can place it on M15 and select H1 in the parameter TF (timeframe). You'll get something like this.


Files:
matf.mq4  3 kb
 
Stanislav Korotky: You'll get something like this.
You will initially. But after that, the stair step effect will be gone because it doesn't redraw the source bar zero, only the chart bar zero. See How to do your lookbacks correctly.
 

Ok guys i got it.


Thank you!

 
Hi, Can you get the indicator to change color to red in a down market ?
 
Richard Peschel Can you get the indicator to change color to red in a down market ?
Same as any colored line.

One buffer has the value, color set to CLR_NONE so not shown on chart, (but in data window and pop up.)

Two buffers, one color each, with SetIndexLabel(i, NULL) so they don't show in data window.

if down: downBuffer[i]=value[i]; if(downBuffer[i+1]==EMPTY_VALUE) downBuffer[i+1]=value[i].

 
Stanislav Korotky:

Try the attached indicator as example. You can place it on M15 and select H1 in the parameter TF (timeframe). You'll get something like this.



Just curious... shouldn't the limit be the Minium of the (Current_Period_iBarShift of the Higher_TF_Bars - Higher_TF_MA_Period) and the (rates_total)? 

int _limit = Limit == 0 ? rates_total - Period : Limit;


int transition_barshift = iBarShift(_Symbol,Period(),iTime(_Symbol,TF,Bars(_Symbol,TF)-Period));
int limit = transition_barshift >= rates_total ? rates_total : transition_barshift;
Reason: