IB error 168  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

IB error 168

Postby darob » 08 Jul 2016

Hi, there's an OCO bracket I've been using in IB's Trader Workstation without any problem but when I apply the same bracket in a strategy in MultiCharts.net I get the error "Discretionary amount does not conform to the minimum price variation for this contract." The entry and stop order are accepted but the target is rejected. I've re-mapped the symbols and googled this but haven't come up with anything.

What do I need to do to fix this?

Thanks

note I'm setting the bracket with the MC _Stops_And_Targets signal.

eroleyikan
Posts: 22
Joined: 01 Jun 2016
Has thanked: 4 times
Been thanked: 6 times

Re: IB error 168

Postby eroleyikan » 08 Jul 2016

Darob,
I use the OCO brackets and I had this issue as well. Easy to solve. make sure that your StopLossAmt and PRofitTragetAmt values are large enough to generate a large enough price change. The price difference must be larger than the "minimum move" allowed for the symbol you are trading .

You can use Bars.Info.ASymbolInfo2.MinMove to get to this number.

Each time CalcBar() runs, MC is sending your OCO order to the server again. If not, they would be cancelling on their own. When MC sends the new order, it is calculating a price that corresponds to your target rand limit amounts. If the price is different, it must be different enough for IB to accept it.

As an example, if you sent the same AUD.JPY order with a price 0.0001 higher than before, you would get the error you are getting.

I hope this helps. Let me know if you cannot resolve the issue.
Thanks
Erol

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: IB error 168

Postby darob » 08 Jul 2016

Hi Erol

The minimum appears to be .01 and I'm looking for .20+ so I'm not sure what the problem is. $10-30 securities. Again, I don't have any trouble when using TWS directly with a bracket preset.

Doesn't MC place native OCO's at the broker once? Not sure why this should have to keep updating. Sorry my technical knowledge is weak. In any case the target is being rejected from the get go.

Thanks

eroleyikan
Posts: 22
Joined: 01 Jun 2016
Has thanked: 4 times
Been thanked: 6 times

Re: IB error 168

Postby eroleyikan » 08 Jul 2016

Well, your OCO order is sent to the server each time CalcBar() runs. If you have

[IOGMode(IOGMode.Enabled)]

then your OCO order is being sent every tick, if any of the order parameters are changed. I know it is counter-intuitive, but that's how it works.

Each time CalcBar() runs, MC is sending your OCO order to the server again. If not, they would be cancelling on their own. When MC sends the new order, it is calculating a price that corresponds to your target rand limit amounts. If the price is different, it must be different enough for IB to accept it.

TWS front end and API can behave differently. Try making your stop loss and profit target amount values large enough. How are you calculating the amounts you are passing to the _Stops_And_Targets signal?
Erol

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: IB error 168

Postby darob » 08 Jul 2016

I see, IOG is enabled so of course MC has to keep checking in, this makes sense.

Entries are generated by MACD_LE/SE constrained by trend and I've manually entered the _Stop_And_Target input values.

Dave

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: IB error 168

Postby Henry MultiСharts » 11 Jul 2016

Hello darob,

Please follow these instructions:
https://www.multicharts.com/trading-sof ... s_Contract

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: IB error 168

Postby darob » 11 Jul 2016

Hi Henry, I have run through this procedure twice now. Don't know what I'm doing wrong. Also the message is the discretionary amount doesn't meet the minimum price move, but I'm not using a discretionary amount, at least not according to IB's definition of it.

https://www.interactivebrokers.com/en/s ... ionary.htm

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: IB error 168  [SOLVED]

Postby Henry MultiСharts » 12 Jul 2016

Hello darob,

Please upload the logs for this occurrence (Help tab->Support->Logs Collector) and specify the ID of the order in question in the Description window.
You can also come to our live chat Monday-Friday 6:30 am - 1 pm EST to demonstrate this behavior remotely. We will do our best to help you.

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: IB error 168

Postby darob » 12 Jul 2016

Just me being an idiot running the stops in contract mode not position.
Now working as it should, thanks Henry.

update below
Last edited by darob on 21 Jul 2016, edited 1 time in total.

darob
Posts: 207
Joined: 20 Nov 2014
Has thanked: 57 times
Been thanked: 32 times

Re: IB error 168

Postby darob » 19 Jul 2016

Been a frustrating exercise, MC found no issues on their side on the computer and IB was indicating a symbol problem.

I finally went to the TWS order preset configuration and changed the discretionary setting from 0.00 to 0.01 and this solved the problem. On a further whim I later tried just deleting the values from that field entirely and voila problem solved. Strange, bc no other settings on this page have any bearing whatsoever on API orders from MC.

Anyway, seems we're good, fingers crossed this is solved going forward.

Regards


Return to “MultiCharts .NET”