- for(int i=limit; i>=1; i--)Why didn't you show how limit is calculated? See How to do your lookbacks correctly, which includes how to update the indicator in groups.
- double minusdi1 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MINUSDI,i);Why are you getting those values when you don't use them?
double plusdi1 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_PLUSDI,i);
double adx2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MAIN,i+1);
double minusdi2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MINUSDI,i+1);
double plusdi2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_PLUSDI,i+1); - double AVGADXNorm = NormalizeDouble(AVGADX,1);Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrongIn this case IndicatorDigits - Custom Indicators - MQL4 Reference
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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, in the full code attached and segment below I don't understand why it takes a long time to load when placed onto the 5m and 1m chart but is okay on the larger charts?
Reference says that it might be something to do with too many physical memory locations? But I'm not sure?
{
//+------------------------------------------------------------------+
// DMI
//+------------------------------------------------------------------+
double adx1 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MAIN,i);
double minusdi1 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MINUSDI,i);
double plusdi1 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_PLUSDI,i);
double adx2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MAIN,i+1);
double minusdi2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_MINUSDI,i+1);
double plusdi2 = iADX(_Symbol,_Period,ADXPeriod,DMIPrice,MODE_PLUSDI,i+1);
AvgADX[i] = adx1; // WHY WHEN I PLACE ON 1HR ITS OKAY BUT 5M IT TAKES ITS TIME
// might be something to do with too many physical memory locations
double AVGADX = iMAOnArray(AvgADX,0,MaADXPeriod,0,MaADXMethod,i); // calculates the ma of data stored in array
double AVGADXNorm = NormalizeDouble(AVGADX,1);
AvgADXLine[i]=AVGADXNorm;
}