SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Questions about MultiCharts and user contributed studies.
TraderJ
Posts: 46
Joined: 14 Jul 2009
Location: Germany
Has thanked: 4 times

SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby TraderJ » 15 Feb 2023

In automated trading mode, my orders defined via SetProfitTarget and SetStopLoss get rejected by IB's Trader Workstation (TWS).

The error message reads "The Price Does Not Conform To The Minimum Price Variation For This Contract".
I have read https://www.multicharts.com/trading-sof ... _Rejection, and my settings look correct to me (see below).

* Automated Strategy.
* Broker: Interactive Brokers (IB).
* Broker Software: Trader Workstation (TWS)
* Instrument: EUR/USD FOREX CFD at IB SMART.
* Strategy works in backtest.
* Enter orders work in live trading.
* Exit orders (Profit Target and Stop Loss) do not work in live trading
* Are Instrument settings in QuoteManager correct?
- Price Scale: 1/100000
- Min Move: 1
- Big Point Value: 1

My Take Profit Code:

Code: Select all

SetStopContract; SetProfitTarget(0.0003);
Who can help?
Last edited by TraderJ on 16 Feb 2023, edited 1 time in total.

User avatar
ABC
Posts: 721
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby ABC » 16 Feb 2023

TraderJ,

SetProfitTarget expects a currency amount and you do not issue a stop loss with the code you posted. What you posted would translate to trying to issue a target for each unit of 0.0003 $.

Regards,
ABC

TraderJ
Posts: 46
Joined: 14 Jul 2009
Location: Germany
Has thanked: 4 times

Re: SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby TraderJ » 16 Feb 2023

SetProfitTarget expects a currency amount and you do not issue a stop loss with the code you posted. What you posted would translate to trying to issue a target for each unit of 0.0003 $.
Yes, this is a take profit code - for stop loss it would be the same. I fixed the description. And this is exactly what I am trying to do: a profit target of 0.0003 units (of the currency traded). It works in backtest, but not in live trading. Why?

User avatar
ABC
Posts: 721
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby ABC » 16 Feb 2023

TraderJ,

you could try if the situation is different when you use SetProfitTarget_pt and SetStopLoss_pt.

Before that I would however double check your symbol settings, as they might be incorrect. According to the IB website the minimum increment for
EUR.USD is 0.00005. For a CFD it might be different as well. Your configuration is using a minimum move of 1 * 1 / 100000 and this could trigger the rejection with the error message you are experiencing.

Regards,

ABC
SetProfitTarget expects a currency amount and you do not issue a stop loss with the code you posted. What you posted would translate to trying to issue a target for each unit of 0.0003 $.
Yes, this is a take profit code - for stop loss it would be the same. I fixed the description. And this is exactly what I am trying to do: a profit target of 0.0003 units (of the currency traded). It works in backtest, but not in live trading. Why?

TraderJ
Posts: 46
Joined: 14 Jul 2009
Location: Germany
Has thanked: 4 times

Re: SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby TraderJ » 16 Feb 2023

Before that I would however double check your symbol settings, as they might be incorrect. According to the IB website the minimum increment for
EUR.USD is 0.00005. For a CFD it might be different as well. Your configuration is using a minimum move of 1 * 1 / 100000 and this could trigger the rejection with the error message you are experiencing.
Hey ABC,

I have a feeling that you found out the problem. I just checked the IB documentation again. In the CFD EUR/USD description, there is no statement about a minimum price move. However, in the CASH EUR/USD description there is a minimum price move of 0.00005 stated. This is quite odd, especially because in TWS prices are displayed in 0.00001 precision and you can manually send orders with it. Maybe for API orders it is not allowed to use 0.00001 precision.

Anyway, I will try that out soon :-)
Update: That's it. It works. Thank you!

Kind regards,
TraderJ

Eric1704
Posts: 21
Joined: 29 Nov 2022
Has thanked: 9 times

Re: SetProfitTarget/SetStopLoss rejected in FOREX live trading at IB

Postby Eric1704 » 20 Feb 2023

Wish MultiCharts would allow SetStopLoss and SetProfitTarget using Highs and Lows instead of just currency or points.


Return to “MultiCharts”