# Getting indicator values from a specified time

22

Dears,

I need to get value of iMA from a specified time, how I do this?

thanks

15580

Convert the "specified time" to a bar shift, use that in iMA
22

WHRoeder:
Convert the "specified time" to a bar shift, use that in iMA

I'm sorry, but I don't know that I do. could you give me an example?
Moderator
10569

https://forum.mql4.com/61669

Has an example

22

What is wrong with this script and how to fix?

<SRC by Moderator: Ubzen>

```//+------------------------------------------------------------------+
//| test.mq4 |
//| Copyright 2013, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//---- indicators
shift = iBarShift(NULL, PERIOD_H1, 13 : 00)
iMA(NULL, 0, 13, 8, MODE_SMMA, PRICE_MEDIAN, shift);
//----
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
//----
//----
return (0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int counted_bars = IndicatorCounted();
//----
//----
return (0);
}
//+------------------------------------------------------------------+```
Moderator
10569

unless this is something new in mql4, I don't think that you can input datetime like that

`shift = iBarShift(NULL, PERIOD_H1, 13 : 00)`

You can use

`shift = iBarShift(NULL, PERIOD_H1, D'2014.03.09 13:00');`
22

This is the errors

'iMA' - an operator expected C:\Program Files (x86)\FXDD Malta - MetaTrader 4\experts\indicators\teste.mq4 (16, 5)
'=' - assignment expected C:\Program Files (x86)\FXDD Malta - MetaTrader 4\experts\indicators\teste.mq4 (15, 11)
'iMA' - semicolon expected C:\Program Files (x86)\FXDD Malta - MetaTrader 4\experts\indicators\teste.mq4 (16, 5)
'}' - semicolon expected C:\Program Files (x86)\FXDD Malta - MetaTrader 4\experts\indicators\teste.mq4 (18, 1)

Moderator
10569

if you double click the error report line, the cursor will go to the problem area, makes them easier to find

I've inserted the missing ; I'm still not sure about the 13:00

```int init() {
//---- indicators
shift = iBarShift(NULL, PERIOD_H1, 13 : 00) ;
iMA(NULL, 0, 13, 8, MODE_SMMA, PRICE_MEDIAN, shift);
//----
}```