Indiicator values for each minute

 
Hello

I encountered this problem, could any one please help?

I'm working on MAs of m30 or H1 or H4. As we all know, the value of last bar is obtained online from current bid price before the bar is closed. so before this bar is closed, the value of indicator(here MA) is changed many times. What should I do to obntain the exact value of MA on M30 time frame on each minute.

For example : Assume I'm working on data from 2005,April,20 to 2005, March, 20 (This is in history , not online). history data of all time frames loaded on Meta Trader station. My time frame is H1 and using SMA-100. I can see the value of MA at close of each bar (say 13:00), how can I find the value on certain minutes (e. g. 13:37)?

One way may be using MA-60x100=6000 on m1 data. I don't know if this is acceptable or not? or what is the other way, specially if I'm working with other indicators this way defenetly is not possible. Please help.

Thanks
 
how can I find the value on certain minutes (e.g. 13:37)?


double MA; 
int frame = 1  // Timeframe M1
string XTime  = "14:30";
 
if (TimeToStr(CurTime(), TIME_MINUTES)== XTime)  MA=iMA(NULL,frame,13,8,MODE_SMMA,PRICE_MEDIAN,0);
 
 
if (MA!=0) Print( "MA value", XTime,"=",MA);
 
You may see this values(MA(100) on H1 every minute ) only using back-testing, for example:

start()
{
double value=iMA(NULL,PERIOD_H1,100,...0)
Print ("MA(100)=",value);
}
 

Thanks FinGeR and thanks Rosh.

Rosh, I think your answer could better solve my problem. Let me ask you some more questions about backtesting later.

Regards

 

FinGeR

Your way is good but I think that may work only in current time, not in history. Any how thanks.

Reason: