- It is likely your code. Remember that all Predefined variables (Ask, Bars, Bid, Close[], High[], Low[], Open[], Point, Time[], Volume[]) are for the current chart symbol.
-
On MT4: Unless the current chart is that
specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.
- It is likely your code. Remember that all Predefined variables (Ask, Bars, Bid, Close[], High[], Low[], Open[], Point, Time[], Volume[]) are for the current chart symbol.
- On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.
Thanks William,
I'm not sure if your solution will be useful for my case.
I went in deep about the problem and, for example, what happened
today is:
1. I try to open a order on CAC index
2. The market was open but short selling was proibited by the broker
3. The
EA returned the error #133
So my question is, Is there the possibility to check and avoid problems in situation like this?
BR
Diego
Thanks William,
I'm not sure if your solution will be useful for my case.
I went in deep about the problem and, for example, what
happened today is:
1. I try to open a order on CAC index
2. The market was open but short selling was proibited by the broker
3.
The EA returned the error #133
So my question is, Is there the possibility to check and avoid problems in situation like this?
BR
Diego
Try this reference.
For more information about symbols properties https://docs.mql4.com/constants/environment_state/marketinfoconstants#enum_symbol_info_string
if(SymbolInfoString(Symbol(),ENUM_SYMBOL_TRADE_MODE) == SYMBOL_TRADE_MODE_FULL) { ................................... }
- docs.mql4.com
Try this reference.
For more information about symbols properties https://docs.mql4.com/constants/environment_state/marketinfoconstants#enum_symbol_info_string
Hi Nikolaos and thanks for the answer.
I had to modify your code because on MQL4 the syntax you wrote isn't working, I created a function like the one below but unfortunatly the problem is not solved, the function returns true, but the order fails again with error #133
bool CheckIfTradeIsAllowed(string s1, string s2) { if (SymbolInfoInteger(s1, SYMBOL_TRADE_MODE) != SYMBOL_TRADE_MODE_FULL) { Alert("Trade for symbol " + s1 + " is not allowed"); return false; } if (SymbolInfoInteger(s2, SYMBOL_TRADE_MODE) != SYMBOL_TRADE_MODE_FULL) { Alert("Trade for symbol " + s2 + " is not allowed"); return false; } return true; }
- 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 to all
I built an EA for the strategy that I'm used to use.
This EA always open two orders for two different symbols.
In normal conditions all works fine, but, if for some reason due to the broker the second symbol is not tradable, the EA open succesfully the first order but not the second one and this is not acceptable by my strategy.
Is there a way in MQL4 to check if trades are allowed by the broker?
Thanks and regards
Diego