darwinex / dwxconnect

Seamlessly link any Trading Strategy in ANY programming language to Darwinex liquidity via MetaTrader 4 or 5. DWX Connect is your very own, fully customizable Trading API!
BSD 3-Clause "New" or "Revised" License
166 stars 88 forks source link

Could not open order: trade is not allowed in the expert properties #12

Closed l736k closed 2 years ago

l736k commented 2 years ago

Hi, I'm testing your solution but I often receive the error in the object. Check out the following log:

open_order BTCUSD. buy 44182.04
ERROR | OPEN_ORDER | Could not open order: trade is not allowed in the expert properties
open_order BTCUSD. buy 44175.0
INFO | Successfully sent order 20360199: BTCUSD., buy, 0.01, 44175.00
New order:  {'magic': 0, 'symbol': 'BTCUSD.', 'lots': 0.01, 'type': 'buy', 'open_price': 44175.0, 'open_time': '2022.04.06 17:01:58', 'SL': 0.0, 'TP': 0.0, 'pnl': -0.48, 'commission': 0.0, 'swap': 0.0, 'comment': ''}
on_order_event. open_orders: 1 open orders
open_order BTCUSD. sell 44094.47
ERROR | OPEN_ORDER_MAXIMUM_NUMBER | Number of orders (1) larger than or equal to MaximumOrders (1).
ERROR | CLOSE_ORDER_TICKET | Could not close position 20360199: trade is not allowed in the expert properties
open_order BTCUSD. buy 44150.46
ERROR | OPEN_ORDER | Could not open order: trade is not allowed in the expert properties

Obviously I've triple checked that trade is allowed for the EA and generally for the platform...as you can see sometimes the position gets opened. Am I missing something? What can I check?

handgun50 commented 2 years ago

It might be that you put dwx connect EA to several graphs and there is EA settings on one or some graphs that you haven't modify. But well that is only my assumption

elvinex commented 2 years ago

Hi,

Three things come to mind that I would check:

1) The issue that handgun50 pointed out, having multiple instances of the same EA.

2) The OPEN_ORDER_MAXIMUM_NUMBER refers to the EA setting, which by default only allows 1 order. So you would have to increase the number in the EA settings.

3) It often happens to me that I add an EA and only afterwards turn off auto trading. In this case MT4 will not overwrite the setting of already added EAs. So you always have to first allow auto trading and only initialize the EA afterwards.

I hope that helps. Please let us know if the issue still occurs.