here is coding of the original indicator
#property indicator_chart_window extern int EST=7; extern int CountBars=500; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- int shift=0; for (shift=Bars-1;shift>=0;shift--) { ObjectDelete("EST"+shift); ObjectDelete("Broker"+shift); } //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int shift, NumBars=500; double CloseTime,OpenTime; if (Bars<CountBars) { NumBars=Bars-1; } else { NumBars=CountBars; } for (shift=Bars-1;shift>=0;shift--) { // OpenTime=StrToTime(TimeDay(Time[shift])+" "+EST+":"+OpenTimeMin); // CloseTime=StrToTime(TimeDay(Time[shift])+" "+MST+":"+CloseTimeMin); if (TimeHour(Time[shift])== EST && TimeMinute(Time[shift])==0) { if(ObjectFind("EST"+shift) != 0) { ObjectCreate("EST"+shift, OBJ_VLINE, 0, Time[shift], 0); ObjectSet("EST"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("EST"+shift, OBJPROP_COLOR, Blue); } } if (TimeHour(Time[shift])== 0 && TimeMinute(Time[shift])==0) { if(ObjectFind("Broker"+shift) != 0) { ObjectCreate("Broker"+shift, OBJ_VLINE, 0, Time[shift], 0); ObjectSet("Broker"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("Broker"+shift, OBJPROP_COLOR, White); } } } return(0); } //+------------------------------------------------------------------+
I'm seeking something a bit simper, I just need the code to count each bar, each day. From bar one to the last bar that day.
MqlRates rates[]; int bars = CopyRates(_Symbol, PERIOD_CURRENT, iTime(_Symbol, PERIOD_D1, 0), TimeCurrent(), rates); int bull = 0; for (int i=0; i<bars; i++) if (rates[i].close > rates[i].open) bull++; printf("Bulls(%d) vs. Bears(%d)", bull, bars - bull);
Hello
Did you manage to get the counter working in the end?
Regards

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
thanks a lot guys