ejtraderLabs / ejtraderCT

The best Python Ctrader FIX API Perfect for HFT
MIT License
59 stars 20 forks source link

Even if I use api.sell(), it still place a buy order. #28

Open wds33817 opened 10 months ago

wds33817 commented 10 months ago

symbol = "EURUSD" volume = 1 # position size: stoploss = round(price - 0.00010, 6) takeprofit = round(price + 0.00020, 6)

id = api.sell(symbol, volume, stoploss, takeprofit)

traderpedroso commented 5 months ago

symbol = "EURUSD" volume = 1 # position size: stoploss = round(price - 0.00010, 6) takeprofit = round(price + 0.00020, 6)

id = api.sell(symbol, volume, stoploss, takeprofit)

Disclosure Due to certain limitations of the FIX API, there's a specific issue that arises when both the Stop Loss (SL) and Take Profit (TP) features are used concurrently. This issue occurs when one of them is triggered, the other remains open and will execute when the price reaches the specified level again, causing it to open another order. This issue needs to be addressed either within the ejtraderCT library or the application itself.

However, you can avoid this problem by using either the SL or TP, but not both simultaneously.