Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
macpee
287
macpee 2016.04.11 10:23 
I tried to execute a transaction to open a pending order on the SGDJPY, but the terminal returned an error "Trade is disabled". I checked the market watch and realized that the currency pair in question has been removed therein. I want to program my EA not to execute any transaction on disabled trade. I tried the IsTradeAllowed() but it did not work. Any help please. Thank you in advance.
macpee
287
macpee 2016.04.11 10:37  
In fact I guess that trade is not disabled for the pair SGDJPY. It is not just listed on the market watch. But again the chart window is open (I must have opened it sometime earlier) from the market watch of course. I think the function I need is the one to indicate whether SGDJPY exists in the market watch, and avoid trading it if it does not exist. Somebody can help here.
Fernando Carreiro
1439
Fernando Carreiro 2016.04.11 10:43  

In the earlier days of my coding, I had on many previous occasions had both the "IsTradeAllowed()" and the "IsTradeContextBusy()" not report correctly about the state of a symbol.

So I ended up, just keeping track of Error codes when executing trade functions and have the EA react accordingly if the Error persisted.

Has anyone else also had this kind of misbehavior with these functions? Or maybe a solution to have them report correctly?

Fernando Carreiro
1439
Fernando Carreiro 2016.04.11 10:48  
macpee:
In fact I guess that trade is not disabled for the pair SGDJPY. It is not just listed on the market watch. But again the chart window is open (I must have opened it sometime earlier) from the market watch of course. I think the function I need is the one to indicate whether SGDJPY exists in the market watch, and avoid trading it if it does not exist. Somebody can help here.
Maybe use some of the "Symbol...()" functions? https://docs.mql4.com/marketinformation
Carl Schreiber
5938
Carl Schreiber 2016.04.11 10:55  
macpee:
I tried to execute a transaction to open a pending order on the SGDJPY, but the terminal returned an error "Trade is disabled". I checked the market watch and realized that the currency pair in question has been removed therein. I want to program my EA not to execute any transaction on disabled trade. I tried the IsTradeAllowed() but it did not work. Any help please. Thank you in advance.
Maybe you logged in using the Investor-password instead of the other one?
Alain Verleyen
Moderator
28535
Alain Verleyen 2016.04.11 11:13  
macpee:
I tried to execute a transaction to open a pending order on the SGDJPY, but the terminal returned an error "Trade is disabled". I checked the market watch and realized that the currency pair in question has been removed therein. I want to program my EA not to execute any transaction on disabled trade. I tried the IsTradeAllowed() but it did not work. Any help please. Thank you in advance.

If the error is 133 "Trade is disabled", that means the broker disabled trading on this symbol.

You can check that with something like :

         if(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_MODE)==SYMBOL_TRADE_MODE_DISABLED)
            return;
macpee
287
macpee 2016.04.11 12:01  
Thank you all, I will take the right action from what you have all suggested.
/
To add comments, please log in or register