MqlDateTime dt; string name1,name2; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| 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[]) { //--- int begin=rates_total-prev_calculated; if(prev_calculated<1) begin--; for(int i=begin;i>=0;i--) { //---Alternative 1 TimeToStruct(time[i],dt); if(dt.hour==9 && dt.min==0) { name1="high"+(string)time[i]; name2="low"+(string)time[i]; ObjectCreate(0,name1,OBJ_ARROW,0,time[i],high[i]); ObjectSetInteger(0,name1,OBJPROP_ARROWCODE,217); ObjectSetInteger(0,name1,OBJPROP_COLOR,clrBlue); ObjectCreate(0,name2,OBJ_ARROW,0,time[i],low[i]); ObjectSetInteger(0,name2,OBJPROP_ARROWCODE,217); ObjectSetInteger(0,name2,OBJPROP_COLOR,clrRed); } //---Alternative 2 if(TimeHour(time[i])==9 && TimeMinute(time[i])==0) { name1="high"+(string)time[i]; name2="low"+(string)time[i]; ObjectCreate(0,name1,OBJ_ARROW,0,time[i],high[i]); ObjectSetInteger(0,name1,OBJPROP_ARROWCODE,217); ObjectSetInteger(0,name1,OBJPROP_COLOR,clrBlue); ObjectCreate(0,name2,OBJ_ARROW,0,time[i],low[i]); ObjectSetInteger(0,name2,OBJPROP_ARROWCODE,217); ObjectSetInteger(0,name2,OBJPROP_COLOR,clrRed); } } //--- return value of prev_calculated for next call return(rates_total); }
Ernst Van Der Merwe:
Thank you Ernst.. Very much appreciated.. GT...
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
Greetings All,
Looking for a code to find a candle high and low based on the candle formation time. Eg. 9:00
Any help greatly appreciated...
GT.. mpfx