Lev_A[i]=iCustom(TradePair[i],0,"ICWR_Chirag",ExtDepth,ExtDeviation,ExtBackstep,WaveHeight,0,0);
Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum- On MT4: Unless the current chart is the specific pair/TF referenced, you must handle
4066/4073 errors.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum if(Point==0.0001 || Point==0.01) { PairPip=MarketInfo(TradePair[i],MODE_POINT);pipsfactor=1;} else if(Point==0.00001 || Point==0.001) {PairPip=MarketInfo(TradePair[i],MODE_POINT)*10; pipsfactor=10;}
The predefine variable Point is only for the current pair. Rewrite using the actual symbol's PairPip.- Do not assume that a bar index on the current chart is the same on other charts. (Other chart may have started a new bar, but the current chart hasn't yet received a new tick.) Always use iBarShift.
- You should encapsulate your
iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
- Why did you post your MT4 question in the
Root /
MT5 EA section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum - On MT4: Unless the current chart is the specific pair/TF referenced, you must handle
4066/4073 errors.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum - The predefine variable Point is only for the current pair. Rewrite using the actual symbol's PairPip.
- Do not assume that a bar index on the current chart is the same on other charts. (Other chart may have started a new bar, but the current chart hasn't yet received a new tick.) Always use iBarShift.
- You should encapsulate your
iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
Hello,
Thanks for your reply.
1. I'm truly sorry, I didn't mean to do that. In my haste and frustration I must have overlooked this small but important detail. Once again I apologize.
2. I have the chart on the correct TF but being that it handles trades for 28 pairs, I do not have all the charts open. I have not been getting any errors in the Journal or Experts tab though.
3. Do you mean by making PairPip an array for example PairPip[i] or are you saying i shouldnt use Point and should go directly with something like:
if(MarketInfo(TradePair[i],MODE_POINT)==.0001 || MarketInfo(TradePair[i],MODE_POINT)==.01){ PairPip[i]=MarketInfo(TradePair[i],MODE_POINT); pipsfactor=1; } else if(MarketInfo(TradePair[i],MODE_POINT)==0.00001 || MarketInfo(TradePair[i],MODE_POINT)==0.001){ PairPip[i]=MarketInfo(TradePair[i],MODE_POINT)*10; pipsfactor=10; }
4. That sounds like great and logical advice, but I am afraid that I don't really know how to implement what you are saying. Could you give me an example, of how to do it. I understand the iBarShift format etc, but I don't really understand how to use it properly.
5. How do I do this? Just by adding { } like.....
Lev_A[i]={iCustom(TradePair[i],0,"ICWR_Chirag",ExtDepth,ExtDeviation,ExtBackstep,WaveHeight,0,0);}
I looked at the link under your 2nd point and I can see that I am probably having errors without even knowing it as the charts i need may not be updating. since i use the 5m, 1h, 4h and daily charts for 28 pairs.
I tried to follow through your post but couldn't make it work for me. I put:
void OnTick(){ while(!download_history(PERIOD_M15) ){ Sleep(1000); RefreshRates(); } }
into the Ontick() section of my EA.
I then copied this section into the top portion of my EA. It looks like I am supposed to replace THIS_SYMBOL with my TradePair[i] variable, but my variable is calculated much further down in my OnTimer() function.
#define HR2400 PERIOD_D1 * 60 // 86400 = 24 * 3600 int TimeOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when % HR2400 ); } datetime DateOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when - TimeOfDay(when) ); } #define SYMBOL string #define THIS_SYMBOL "" bool download_history(ENUM_TIMEFRAMES period=PERIOD_CURRENT){ return download_history(_Symbol, period); } bool download_history( SYMBOL symbol=THIS_SYMBOL, ///< The symbol required. ENUM_TIMEFRAMES period=PERIOD_CURRENT /**< The standard timeframe.*/){ if(symbol == THIS_SYMBOL) symbol = _Symbol; if(period == PERIOD_CURRENT) period = _Period; datetime today = DateOfDay(); ResetLastError(); datetime other = iTime(symbol, period, 0); if(_LastError == 0 && today == DateOfDay(other)) return true; if(_LastError != ERR_HISTORY_WILL_UPDATED && _LastError != ERR_NO_HISTORY_DATA) // the ")" after DATA was missing, I thought I had to add it. Please confirm Print(StringFormat("iTime(%s,%i) Failed: %i", symbol, period,_LastError)); return false; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I am having issues with grabbing data from an indicator and saving/using that in a multi currency EA. I made loops and used array's for each currency and the numbers all come in and work but every tick or update on timer a few of the values are duplicates of the preceding currency's value. I am using iRSI and iMA for the mutli-currency and those values don't duplicate or anything so I know that I am using the array's and loops properly. It's just that when the data updates some values from the indicator duplicate, so I can only assume it's an issue with my use of iCustom or that the indicator needs to be adapted somehow to work with all the currencies (which I thought natively happens anyway).
This is the relevant parts of the EA.
Any ideas? I can provide any other information that you may need to help me.
Thanks