Timeframe Help

 

Lets say you wanted to have the moving average from the 1H chart placed on the 1M chart with the 1H results how would you do that... and could that work with all indicators, probably very easy would like to know how its written Thank you very much

 

http://lmgtfy.com/?q=mtf+moving+average+mql

there are lots of indicators which show indicators, by convenience they are mostly named MTF_indicatorName. but be warned, in visual backtesting by scrolling back trough chart they look way better then in realtime. to get a feel of the behaviour i suggest tu use the backtester in visual mode..

//z

 

Thanks for the reply but im talking about placing and indicator with one time frame (1H) and the results, into the timeframe of another (1M), not neccessarily a clusterd indicator...maybe a clusted timeframe.. if thats what your talking about how is this written into the code....Lets use this easy code for an example...what do we insert into the code, for the 1H CCI to show up on the 1M chart, Thank you

//+------------------------------------------------------------------+
//| CCI.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net//"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 LightSeaGreen
//---- input parameters
extern int CCIPeriod = 14;
//---- buffers
double CCIBuffer[];
double RelBuffer[];
double DevBuffer[];
double MovBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 3 additional buffers are used for counting.
IndicatorBuffers(4);
SetIndexBuffer(1, RelBuffer);
SetIndexBuffer(2, DevBuffer);
SetIndexBuffer(3, MovBuffer);
//---- indicator lines
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, CCIBuffer);
//----
if(CCIPeriod <= 0)
CCIPeriod = 14;
//----
SetIndexDrawBegin(0, CCIPeriod);

//---- name for DataWindow and indicator subwindow label
short_name="CCI(" + CCIPeriod + ")";
IndicatorShortName(short_name);
SetIndexLabel(0, short_name);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Commodity Channel Index |
//+------------------------------------------------------------------+
int start()
{
int i, k, counted_bars = IndicatorCounted();
double price, sum, mul;
if(CCIPeriod <= 1)
return(0);
if(Bars <= CCIPeriod)
return(0);
//---- initial zero
if(counted_bars < 1)
{
for(i = 1; i <= CCIPeriod; i++)
CCIBuffer[Bars-i] = 0.0;
for(i = 1; i <= CCIPeriod; i++)
DevBuffer[Bars-i] = 0.0;
for(i = 1; i <= CCIPeriod; i++)
MovBuffer[Bars-i] =0.0;
}
//---- last counted bar will be recounted
int limit = Bars - counted_bars;
if(counted_bars > 0)
limit++;
//---- moving average
for(i = 0; i < limit; i++)
MovBuffer[i] = iMA(NULL, 0, CCIPeriod, 0, MODE_SMA, PRICE_TYPICAL, i);
//---- standard deviations
i = Bars - CCIPeriod + 1;
if(counted_bars > CCIPeriod - 1)
i = Bars - counted_bars - 1;
mul = 0.015 / CCIPeriod;
while(i >= 0)
{
sum = 0.0;
k = i + CCIPeriod - 1;
while(k >= i)
{
price =(High[k] + Low[k] + Close[k]) / 3;
sum += MathAbs(price - MovBuffer[i]);
k--;
}
DevBuffer[i] = sum*mul;
i--;
}
i = Bars - CCIPeriod + 1;
if(counted_bars > CCIPeriod - 1)
i = Bars - counted_bars - 1;
while(i >= 0)
{
price = (High[i] + Low[i] + Close[i]) / 3;
RelBuffer[i] = price - MovBuffer[i];
i--;
}
//---- cci counting
i = Bars - CCIPeriod + 1;
if(counted_bars > CCIPeriod - 1)
i = Bars - counted_bars - 1;
while(i >= 0)
{
if(DevBuffer[i] == 0.0)
CCIBuffer[i] = 0.0;
else
CCIBuffer[i] = RelBuffer[i] / DevBuffer[i];
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+

 

i i understand you correctly,

you have open the M1 timeframe, and you want a cci of H1 timeframe printed on that chart?

if this is correct then the MTF_* indicators are what you are searching. in this indicators you can modify a parameter (period) to the timeframe you want.

you can drag a MTF_CCI on the M1 timeframe changen parameter period to 60 and then you have the CCI Period_H1 drawn on your M1 chart.

 

Thank you very much thats excatly what i wanted to know, This is what i found from you guys for whoever else wants to change there indicators to MTF Multi Time Frame

  • TimeFrame

Default value is 0 - means current timeframe. For other timeframes: 1=M1, 5=M5, 15=M15, 30=M30, 60=H1, 240=H4, 1440=D1, 10080=W1, 43200=MN1

Find

//---- input parameters
extern int TimeFrame=0;

so for CCI you would change this to 60 =H1

Thanks

 
no, you have to change the TimeFrame value to 60, CCIPeriod is for the period of the cci, not for the timeframe
 
Then where is the TimeFrame value in the code can you highlight that or copy paste
 

thats, the defauld CCI from metaquotes, as i sayed you have to use a MTF version. maybe use google?

http://lmgtfy.com/?q=MTF_CCI+mql

 

Then is there a way to change your regular indicators to MTF? like if i wanted to the code obove or do you have to find everyone you want.

Thank you

 
shure can you change any indicator to mtf, but i have nerver done. download MTF_CCI and compare it with normal CCI. see what is alterd. but i think it is not that easy. give it a try.
 

Ill take a look at it and tell you what i find Thank you for all the help Zzuegg

Reason: