How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem
We can't see your broken code.
As the title say, some symbols don't have return code so I get this error and I have no idea how to solve it. Support is appreciated
there is nothing wrong with my code some orders return retcode some simply dont have it and some symbols info tick dont have bid attribute. It might be from the broker. I am in contact with him now
In your first post you claimed that some symbols don't have return code. Which is utter nonsense as William has explained.
Now you are referring to orders (which makes more sense).
Please be absolutely clear when asking for assistance.
yes, sorry for confusion. I am new to meta trader and it only happen on some symbol orders. In fact it have no return at all
Any way to fix it? I am writing in Python
-
“Any way to fix it?” You just said “there is nothing wrong with your code.” Make up your mind.
-
Your calls have return values. Stop saying they “no return at all”
-
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problemFor the second time: We can't see your broken code.
try: if not symbol_info.visible: if not mt5.symbol_select(symbol, True): mt5.symbol_select(symbol, True) order = { 'action': mt5.TRADE_ACTION_DEAL, 'symbol': symbol, 'volume': quantity, 'type': mt5.ORDER_TYPE_SELL, "position": pos_id, 'price': price, 'deviation': 20, 'magic': 369369369, 'comment': "python script close", 'type_time': mt5.ORDER_TIME_GTC, "type_filling": mt5.ORDER_FILLING_IOC, } ## print('We pas second block in sell function') result = mt5.order_send(order) ## print(result) except Exception as e: print("Error code =",mt5.last_error()) print(e, 'error ', traceback.format_exc()) pass try: if result.retcode != mt5.TRADE_RETCODE_DONE: print("Order_send failed, retcode={}".format(result.comment)) pass else: print("Position #{} closed, {}".format(result.comment)) change_pos(symbol, order, pos_id) ## print('We pas third block in sell function') except Exception as e: print("Error code =",mt5.last_error()) print(e, 'error ', traceback.format_exc()) passThis is my code
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use