Rules for IB Ideal Pro Forex trading  [SOLVED]

Questions about MultiCharts and user contributed studies.
dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 15 Feb 2013

Hello,

I am facing serious problems with the logic for Bracket Orders with Currency Pairs at Ideal Pro.
In general Stop Levels in Ticks should be equivalent to minimal movement of the respective instrument. Ideal Pro at IB in general has 6 post decimal separator digits, the last digit always being 5 or 0 so the minimal movement is 0.00005, e.g. for EUR.USD and EUR.CAD.
Assuming this I set the stop levels for x ticks away for EUR.CAD trading but these were not filled as "the price does not conform to the minimum price variation for this contract". I learned by trial and error that the program uses 0.00001 instead of 0.00005 as tick multiplier for the bracket orders.
I therefore considered this for EUR.CAD and subsequently in worked OK.
Today trading the EUR.JPY (125.xxx) with minimum movement of 0.005 I fell into the same trap (see attached log) and changing the parameter digits did not help. I was unprotected twice.
The really bad thing is (I asked for storing the Bracket parameters associated with the chart and not with the workspace) that within a given workspace any change for any chart in the bracket parameters is automatically propagated to all other charts with different instruments and different minimum movements.
Please advice for the correct number of digits for EUR.JPY to avoid errors and please implement a correct minimal movement implementation in the not to distant future.

Any help is really apprciated.
Attachments
EURJPY.PNG
(15.13 KiB) Downloaded 1422 times

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

Re: Rules for IB Ideal Pro Forex trading

Postby Henry MultiСharts » 15 Feb 2013

Hello Dahmen,

"The price does not conform to the minimum price variation for this contract" error appears due to incorrect symbol parameters.
If you are using IB data feed and IB broker then you need to add IB symbol from the data source to get the correct symbol parameters:QuoteManager->Add symbol->From data source-> IB.
If your data vendor is different from your broker then please follow this short guide.

There is no need to save the parameters for each chart. The bracket order parameters are specified in ticks where 1 tick = price scale/min mov. As instrument parameters are incorrect-the bracket orders with such prices are not accepted by the broker. Once you have correct symbol parameters-your exit bracket strategy will work the same way for all symbols.

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 15 Feb 2013

Hello Dahmen,
There is no need to save the parameters for each chart. The bracket order parameters are specified in ticks where 1 tick = price scale/min mov. As instrument parameters are incorrect-the bracket orders with such prices are not accepted by the broker. Once you have correct symbol parameters-your exit bracket strategy will work the same way for all symbols.
I have IQFeed as Data Source and IB as Broker and both were in disagreement regarding the parameters - I erroneously assumed MC is looking at the broker symbol and not at the chart symbol. I have corrected this. Thanks for your quick help and have a nice weekend.

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 20 Feb 2013

Hello Henry,

unfortunately making settings for IQ Feed Datasource and IB Broker identical only solved a part of the problem. While before this measure bracket orders were rejected due to incompatible minimum fluctuation now the process [this is an adviser account using allocation profiles for varying distribution (For Forex always 80 % account 1 and 20 % account 2] is as follows as confirmed by audit trail and by interview with IB TWS staff.

Order is
placed,
acknowledged,
distributed to subaccounts,
Bracket Orders are sent and accepted

now within 1 to 10 seconds the profit target order is eliminated by a cancel request and subsequently both Bracket Parts are canceled. This is reproducible and quite disturbing. As I know from a friend working on the same subject with a normal, non FA account, IQ Feed data and IB Broker without any problems, there must be something or some events associated with the FA part - I have the following settings in
Server 127.0.0.1 / Port 7500 / Client ID: 8020
Time in Force: GTC
Flag active for Use Outside RTH tag for orders
OCO Group: Flag active for Use NAtive OCO Group

Finacial Advisor Settings set to manual allocation
Profile is set to xxx80_yy20

The audit trail is attached for your convenience. IB is willing to assist in solving this problem. html file was renamed to.txt as upload was rejected and again not not accepted - therefore see screenshot

Thank you in advance for taking care.
Attachments
AuditTrail.PNG
(326.56 KiB) Downloaded 1413 times

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

Re: Rules for IB Ideal Pro Forex trading

Postby Henry MultiСharts » 20 Feb 2013

Hello Walter,

Are you referring to automated trading or manual trading?
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)
What is the version of TWS you are running ? (TWS Help tab->About)

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 20 Feb 2013

Hello Walter,

Are you referring to automated trading or manual trading?
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)
What is the version of TWS you are running ? (TWS Help tab->About)
1) I am using manual trading
2) MultiCharts64 Version 8.0 Release (Build 5622)
3) TWS Build 932.2, Oct 24, 2012
Java version 1.70_13

Windows 7 64 Bit 6.1 all Patches always installed

CPU i3770, 16 GB RAM, 250 GB Crucial M4 SSD

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 21 Feb 2013

OCO Group working correctly ?

To my knowledge all OCO orders at IB should have the same Base ID, with indexes incrementes for associated stop and / or profit target. This is described as well in https://www.multicharts.com/trading-sof ... rt_Trading in the last sentence in OCO-Orders "All OCO-orders of the same group will have the same OCO-ID. You may check it in the Orders tab of the Order and Position Tracker window".

Although OCO is checked this is not followed
PlaceOrder 20130220-10:11:58 147092830.0
Filled 20130220-10:11:59 147092830.0
PlaceOrder 20130220-10:11:59 147092831.0 instead of 830.1
PlaceOrder 20130220-10:11:59 147092832.0 instead of 830.2
Now cancelling orders starts with extensions ???
CancelOrder 20130220-10:12:09 147092832.1
CancelOrder 20130220-10:12:09 147092831.1

It seems to me as if there is something implemented wrong in the order workflow in regard to the allocation of transmitting an OCO order - my own implementation for Ordermanagement uses this logic:

0) set transmit = false
1)Use initial Order ID from System as ParentOrderID
2) Set Initial OrderObject Parameters (action, LMT / MKT, clientID)
3)a)If there is neither STOP not PROFITTAKE Order set transmit to True and place placeOrderEX(OrderID, ContractObject, OrderObject)
b)If there is a STOP order and no PROFITTAKE Order set transmit = True and adapt the other StopOrder Object parameters with parentID = ParentOrderID and
placeOrderEX(OrderID, ContractObject, OrderObject)
c)If there is a STOP order and PROFITTAKE Order let transmit = False and adapt the other StopOrder Object parameters with parentID = ParentOrderID and
set transmit = true and adapt the other ProfitOrder parameters with parentID = ParentOrderID and
placeOrderEX(OrderID, ContractObject, OrderObject)

resulting in
parentOrder = ID.0
STOP Order = ID.1
TARGET Order = ID.2 if stop and target is selected, ID.1 if only target is selected


It looks to me as if transmit = false is omitted initially resulting in different IDs for Initial Order, Stop and Target - heaven knows what causes the cancellation of the target and subsequently the associated stop (not being part of this regular OCO [OCA] logic with the same parent ID)

In contrast to this the attached screens however shows identical Broker OCO Orders for the cancelled orders, filled broler orders being 21 and 24
Attachments
BrokerOCO_1.PNG
(25.53 KiB) Downloaded 1423 times
BrokerOCO.PNG
(6.62 KiB) Downloaded 1418 times

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

Re: Rules for IB Ideal Pro Forex trading

Postby Henry MultiСharts » 22 Feb 2013

Hello Walter,

We were unable to replicate this behavior in our environment. Our engineers would like to have a closer look at the situation on your PC. Please come to our live chat Monday and Friday 6:30 am - 10 am EST, Tuesday-Thursday 6:30 am - 12 pm EST for remote connection with our IB specialists.

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 22 Feb 2013

Hello Henry,

this morning I started sending orders with brackets with FA allocation to a single account with my own program and it worked fine.
Next I changed MC settings from Client ID 8020 to 0 and removed check mark for use native OCO and it worked as intended with sending from FA account to one sub-account. Thereafter I tried again with check mark for OCO and it worked again. Then Client ID was set to 82 instead of 0 as I assumed that a byte instead integer could have caused the failure and it worked again as intended.
Now I re-enabled again the client ID 8020 and again (unexpectedly) correct behavior. Now a profile with distribution to two sub-account was chosen and still all orders worked as intended.
Finally another workspace with another Broker Profile with client ID 5050 was opened and the orders still worked according to their specification.

I am still confused about the reason it did not work at all on Wednesday so I was not acting yesterday. At least at present I cannot find any malfunction.

The audit trail is in the attached zip file.
One suggestion to the programmers would be to implement a drop-down list in the full mode chart trader form for profiles to be used (available as an xml structure via reqManagedAccts() and AxTWSLib._DTwsEvents_managedAccountsEvent).

This would be very much helpful in selecting the appropriate distribution as this will differ between the different classes of instruments.
Attachments
Summary Audit Trail_20130222_1316.zip
(9.31 KiB) Downloaded 195 times

dahmen walter
Posts: 73
Joined: 19 Oct 2007
Has thanked: 46 times
Been thanked: 4 times

Re: Rules for IB Ideal Pro Forex trading

Postby dahmen walter » 25 Feb 2013

After working with test amounts on Friday today again profit target and subsequently stop order was canceled after 7 seconds - a shame - see attached screenshot - I am to contact support right now
Attachments
CancelledOrders_20130225.PNG
(136.13 KiB) Downloaded 1419 times

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Rules for IB Ideal Pro Forex trading

Postby arjfca » 26 Feb 2013

OCO Group working correctly ?

To my knowledge all OCO orders at IB should have the same Base ID, with indexes incrementes for associated stop and / or profit target. This is described as well in https://www.multicharts.com/trading-sof ... rt_Trading in the last sentence in OCO-Orders "All OCO-orders of the same group will have the same OCO-ID. You may check it in the Orders tab of the Order and Position Tracker window".

Although OCO is checked this is not followed
PlaceOrder 20130220-10:11:58 147092830.0
Filled 20130220-10:11:59 147092830.0
PlaceOrder 20130220-10:11:59 147092831.0 instead of 830.1
PlaceOrder 20130220-10:11:59 147092832.0 instead of 830.2
Now cancelling orders starts with extensions ???
CancelOrder 20130220-10:12:09 147092832.1
CancelOrder 20130220-10:12:09 147092831.1

It seems to me as if there is something implemented wrong in the order workflow in regard to the allocation of transmitting an OCO order - my own implementation for Ordermanagement uses this logic:

0) set transmit = false
1)Use initial Order ID from System as ParentOrderID
2) Set Initial OrderObject Parameters (action, LMT / MKT, clientID)
3)a)If there is neither STOP not PROFITTAKE Order set transmit to True and place placeOrderEX(OrderID, ContractObject, OrderObject)
b)If there is a STOP order and no PROFITTAKE Order set transmit = True and adapt the other StopOrder Object parameters with parentID = ParentOrderID and
placeOrderEX(OrderID, ContractObject, OrderObject)
c)If there is a STOP order and PROFITTAKE Order let transmit = False and adapt the other StopOrder Object parameters with parentID = ParentOrderID and
set transmit = true and adapt the other ProfitOrder parameters with parentID = ParentOrderID and
placeOrderEX(OrderID, ContractObject, OrderObject)

resulting in
parentOrder = ID.0
STOP Order = ID.1
TARGET Order = ID.2 if stop and target is selected, ID.1 if only target is selected


It looks to me as if transmit = false is omitted initially resulting in different IDs for Initial Order, Stop and Target - heaven knows what causes the cancellation of the target and subsequently the associated stop (not being part of this regular OCO [OCA] logic with the same parent ID)

In contrast to this the attached screens however shows identical Broker OCO Orders for the cancelled orders, filled broler orders being 21 and 24
OCO order sent from MC to IB server

If I recall OCO order generated from MC are not a truly OCO order for IB. These order are managed from within MC and therefore get a different order number. Once the target price is reach, MC is sending a market order to close the position. If you want a truly OCO order, managed by IB server, you will need to send your order command directly to IB server using external function application. ( search the net or send me a PM).

It may have change since I last worked with MC sending OCO orders to IB. Did not look at it, but at the time that was the situation.

Martin

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

Re: Rules for IB Ideal Pro Forex trading  [SOLVED]

Postby Henry MultiСharts » 22 Mar 2013

The reason of cancelling the orders is that the position for the symbol becomes zero.
The position for the symbol becomes zero because a second IB broker profile with FA accounts is connected.
IB does not allow working this way at the moment:
Error 2101 (ID=[-1]): Unable subscribe to account as the following clients are subscribed to a different account.{5050}
As the result MultiCharts considers the position to be flat and cancels the exit orders.
IB is unable to resolve this behavior on their end.

The workarounds at the moment are the following:
1) Do not use multiple IB FA accounts at the same time
Or
2) Update your MultiCharts to version 8.5 release
Then in MiltiCharts go to File -> Preferences -> Trading -> Exit Strategies Average Open Position Price -> set it to “calculated based on order execution price”. Restart MC and the problem should not reappear.


Return to “MultiCharts”