ITradingProfile ModifyOrder question  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
poutche
Posts: 3
Joined: 31 Oct 2014
Has thanked: 1 time

ITradingProfile ModifyOrder question

Postby poutche » 24 May 2019

Hi,

1) If I want to modify an order, do I have to call the ModifyOrder method for each field I want to modify (ex: limitPrice + contracts)

2)If there are different orders, I suppose they can be sent at the same time...

2) Do I have to fill all the fields of the OrderParams or only the field(s) I want to change?



Thank you in advance.
Guy

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: ITradingProfile ModifyOrder question

Postby Anna MultiCharts » 29 May 2019

Hello, poutche!

1) ITradingProfile.ModifyOrder is meant only for the orders that were placed through ITradingProfile. It cannot modify any other orders.
2) Yes, it is required to fill all the fields.

poutche
Posts: 3
Joined: 31 Oct 2014
Has thanked: 1 time

Re: ITradingProfile ModifyOrder question

Postby poutche » 01 Jun 2019

Thank you very much Anna!

But I am still divided on the best way to use ModifyOrder
(Broker: LMAX)

Step 1) PlaceOrder

OrderParams MyPlaceOrderParams = new OrderParams();
MyPlaceOrderParams.action= MTPA_OrdrActn.eMTPA_OA_Buy;
MyPlaceOrderParams.category=MTPA_OrdrCtgry.eMTPA_OC_Limit;
MyPlaceOrderParams.contracts=5;
MyPlaceOrderParams.limit_price=60;
MyPlaceOrderParams.stop_price=0;
MyPlaceOrderParams.tif=MTPA_OrdrTimeInForce.eMTPA_TIF_DAY;

PlaceOrderID= MyTradingProfile.PlaceOrder(MyPlaceOrderParams);

Step 2) I want to modify the contracts from 5 to 4 + limit_price from 60 to 50:

Approach A: (fields are changed at the same time + use of only 1 OrderParams )

OrderParams MyModifyOrderParams = new OrderParams();
MyModifyOrderParams.action= MTPA_OrdrActn.eMTPA_OA_Buy;
MyModifyOrderParams.category=MTPA_OrdrCtgry.eMTPA_OC_Limit;
MyModifyOrderParams.contracts=4;
MyModifyOrderParams.limit_price=50;
MyModifyOrderParams.stop_price=0;
MyModifyOrderParams.tif=MTPA_OrdrTimeInForce.eMTPA_TIF_DAY;

MyTradingProfile.ModifyOrder(PlaceOrderID,MyModifyOrderParams,MTPA_ModifiableOrderFields.eMTPA_MOF_Quantity);
//WAIT CONFIRMATION ?
MyTradingProfile.ModifyOrder(PlaceOrderID, MyModifyOrderParams, MTPA_ModifiableOrderFields.eMTPA_MOF_Price);

it seems strange to me that two orders are needed. This is the third parameter that asks me question. Why one field at a time?

It suggests to me that it can be a little more "complicated" to get what I want...:

Approach B:

A) Contracts from 5 to 4 without limit_price change

OrderParams MyModifyOrderParams = new OrderParams();
MyModifyOrderParams.action= MTPA_OrdrActn.eMTPA_OA_Buy;
MyModifyOrderParams.category=MTPA_OrdrCtgry.eMTPA_OC_Limit;
MyModifyOrderParams.contracts=4;
MyModifyOrderParams.limit_price=60; ---> limit_price is not yet changed
MyModifyOrderParams.stop_price=0;
MyModifyOrderParams.tif=MTPA_OrdrTimeInForce.eMTPA_TIF_DAY;

MyTradingProfile.ModifyOrder(PlaceOrderID,MyModifyOrderParams,MTPA_ModifiableOrderFields.eMTPA_MOF_Quantity);

B) Once this is done at the broker side: limit_price from 60 to 50

OrderParams MyModifyOrderParams = new OrderParams();
MyModifyOrderParams.action= MTPA_OrdrActn.eMTPA_OA_Buy;
MyModifyOrderParams.category=MTPA_OrdrCtgry.eMTPA_OC_Limit;
MyModifyOrderParams.contracts=4;
MyModifyOrderParams.limit_price=50;
MyModifyOrderParams.stop_price=0;
MyModifyOrderParams.tif=MTPA_OrdrTimeInForce.eMTPA_TIF_DAY;

MyTradingProfile.ModifyOrder(PlaceOrderID, MyModifyOrderParams, MTPA_ModifiableOrderFields.eMTPA_MOF_Price);

Thanks in advance for enlightening me on this subject.

Guy

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: ITradingProfile ModifyOrder question  [SOLVED]

Postby Anna MultiCharts » 07 Jun 2019

poutche,

Both of your solutions are viable and there’s no fundamental difference between them.
it seems strange to me that two orders are needed. This is the third parameter that asks me question. Why one field at a time?
This is by design and serves for the proper communication with the broker APIs.


Return to “MultiCharts .NET”