Ashomid7: what's wrong with it???
int limit=Bars-counted_bar-InpMAPeriod;
After the first run counted equals bars and your loop does nothing.
How to do your lookbacks correctly #9 - #14 & #19
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[]) { //--- check for bars count if(rates_total<InpMAPeriod-1 || InpMAPeriod<2) return(0); //--- first calculation or number of bars was changed if(prev_calculated==0) ArrayInitialize(ExtLineBuffer,0); //--- calculation limit=rates_total-prev_calculated; for(i=0; i<limit; i++) { datetime now = Time[i], bod = now - now % 86400; //---Beginning of the day int iBod = iBarShift(NULL,0, bod); HH[i] = iHigh(Symbol(),PERIOD_CURRENT,iHighest(NULL,0, MODE_HIGH,iBod-i,i)); //---InpMAPeriod's high calculation LL[i] = iLow(Symbol(),PERIOD_CURRENT,iLowest(NULL,0, MODE_LOW,iBod-i,i)); //---InpMAPeriod's low calculation if ((Close[i] >= Close[iBod] && Close[i] >= Open[iBod]) || (Close[i] <= Close[iBod] && Close[i] <= Open[iBod])) //---InpMAPeriod's close calculation tClose[i] = Close[i]; else tClose[i] = Close[iBod]; hlc3[i]=(HH[i]+LL[i]+tClose[i])/3; //---InpMAPeriod's hlc3 calculation } CalculateEMA(rates_total,prev_calculated,hlc3); //---Set calculated hlc3 as EMA input price //--- return value of prev_calculated for next call return(rates_total); }
William Roeder:
After the first run counted equals bars and your loop does nothing.
How to do your lookbacks correctly #9 - #14 & #19
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
Hi
I coded a custom indicator, it work on the chart without any problem, EA gives its values by iCustome, everything's ok until EA opens first trade, after first trade opening Indicator stops calculating therefore EA can't modify or close the position
what's wrong with it???