Buffer7[i] = Bid; //Set indicator value at Price
Your "believe" is wrong. Bid is the price of bar zero. Shouldn't you be drawing using a price of bar i?
if (i >= MathMin(LookBackBars-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
Do your lookbacks correctly. Your lookback, per iCustom(...Shift+i) is Shift.if(iCustom(NULL, PERIOD_CURRENT, "MiracleBand", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, true, true, false, true, true, true, false, false, 3, Shift+i)
- You should encapsulate your
iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
Your "believe" is wrong. Bid is the price of bar zero. Shouldn't you be drawing using a price of bar i?
- Do your lookbacks correctly. Your lookback, per iCustom(...Shift+i) is Shift.
- You should encapsulate your
iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
Thank you for your fast reply,
I will get to work trying to make those changes, in regards to the bid when drawing the histogram, the prices arnt important as im aiming for this style of histogram rather then like a macd style.
Thank you for your fast reply,
I will get to work trying to make those changes, in regards to the bid when drawing the histogram, the prices arnt important as im aiming for this style of histogram rather then like a macd style.
Solved, do not use a recalculating indicator!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
Ive created a historgram indicator that basically prints a colour when price is in an uptrend/downtrend, and out of a set of bands like BB bands.
After a couple of bars if i refresh the chart, the histogram changes in colours and is recalculating or redrawing. I have gone through my code alongside the mql4 doc
making sure i understand the code to see if i have done it right, however i cant stop this problem happening. I only need the histogram to print on the close of the current bar
and stay that colour without changing its value again. So its candle index -1 im interested in.
I beleive i the error could be around this part, //--- main loop
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(LookBackBars-1, rates_total-1-50)) continue;
but i have attached the bulk of the code.
Thank you