sunshine wrote:Unfortunately I couldn't recreate the issue. Do you always get reject for Sell Market Range orders or in some cases? Which Time-In-Force and amount do you use for the Sell order?
Hi sunshine,
I must be doing something wrong, or there is an issue with the Sell orders..
I use this function:
public void CreateRangeOrder(string sOfferID, string sAccountID, int iAmount, double dRateMin, double dRateMax, string sBuySell)
{
O2GRequestFactory factory = mSession.getRequestFactory();
O2GValueMap valuemap = factory.createValueMap();
valuemap.setString(O2GRequestParamsEnum.Command, Constants.Commands.CreateOrder);
valuemap.setString(O2GRequestParamsEnum.OrderType, Constants.Order.MarketOpenRange);
valuemap.setString(O2GRequestParamsEnum.AccountID, sAccountID); // The identifier of the account the order should be placed for.
valuemap.setString(O2GRequestParamsEnum.OfferID, sOfferID); // The identifier of the instrument the order should be placed for.
valuemap.setString(O2GRequestParamsEnum.BuySell, sBuySell); // The order direction (Constants.Buy for buy, Constants.Sell for sell).
valuemap.setDouble(O2GRequestParamsEnum.RateMin, dRateMin); // The minimum dRate at which the order can be filled.
valuemap.setDouble(O2GRequestParamsEnum.RateMax, dRateMax); // The maximum dRate at which the order can be filled.
valuemap.setString(O2GRequestParamsEnum.CustomID, "OpenRangeOrder"); // The custom identifier of the order.
valuemap.setInt(O2GRequestParamsEnum.Amount, iAmount);
O2GRequest request = factory.createOrderRequest(valuemap);
mSession.sendRequest(request);
}
Instrument: EUR/USD, Current Rate: 1.34588; Parameters:
sOfferID: 1;
sSAccountId: XXX778;
iAmount: 1000;
dRateMin: 1.34561;
dRateMax: 1.34615;
sBuySell: S;
Returns 'EUR/USD: Your order 85564588 could not be executed (/)'
I always have Sell orders rejected. Buy orders are always executed with no problem.
I am not sure where I can set 'Time-In-Force' though.
thanks,
Anton.
Added:
Just tested the True Market Open and I did not have no issues opening Sell position with Stop/Loss at all.