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
ITradingProfile ModifyOrder question [SOLVED]
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: ITradingProfile ModifyOrder question
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.
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.
Re: ITradingProfile ModifyOrder question
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
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
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: ITradingProfile ModifyOrder question [SOLVED]
poutche,
Both of your solutions are viable and there’s no fundamental difference between them.
Both of your solutions are viable and there’s no fundamental difference between them.
This is by design and serves for the proper communication with the broker APIs.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?