This thread
https://forum.mql4.com/61669
Has an example
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 copyright "Copyright 2013, MetaQuotes Software Corp." #property link "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); } //+------------------------------------------------------------------+
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');
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)
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); //---- }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dears,
I need to get value of iMA from a specified time, how I do this?
thanks