//+------------------------------------------------------------------+ //| test2012.mq5 | //| Copyright 2012, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2012, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_plots 1 #property indicator_buffers 1 double myhigh=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { datetime opentime = D'2012.04.25 13:25'; // I want to get the High price of this bar if(opentime<time[rates_total-1]) { for(int i=1;i<rates_total;i++) { if(time[i-1]<opentime && time[i]>=opentime) { myhigh=high[i];} } } else {myhigh=high[rates_total-1];} Print ("Myhigh=",(string)myhigh); return(rates_total); } //+------------------------------------------------------------------+
Karlson:
Thank you Karlson !
I see now.

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
How to get the High price of a bar specified with an open time ?
Thanks in advance.