Page 1 of 1

How to create a stop-order with stoploss at broker?

Posted: Dec 17 2015
by Ferro
How can I place a buy-stop order with a stoploss at my broker (LMAX)?

I tested this:
1) My signal places a buy stop order, including GenerateStopLossPt(10).
2) I unplugged the network so MC loses internet connection.
3) The price hits the stop order at the broker so it is filled.
4) Result: there is no stoploss, since the internet connection from MC to broker is lost.

In other words, I would like to attach a stoploss to my stop order at the broker, so I am safe in case Multicharts crashes or its connection gets lost.

At the LMAX website, the stoploss column of the stop order is empty (see screenshot, column on the right). I would like to insert a stoploss value in that column through MC.Net.

For example with MT, you can submit a stoploss with your stop order: http://docs.mql4.com/trading/ordersend
The stoploss is then present at the broker, so you don’t depend on client software.

Does anyone know how to do this or work-around this?

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 21 2015
by Henry MultiСharts
Hello Ferro,

GenerateStopLossPt is placed only when there is an open position. If you want to place a protective stop order next to your active entry order - you need to use the regular stop order command, the same one you are using for the entry order.

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 22 2015
by Ferro
Hello Henry,

Thank you for your reply. I tried what you proposed. However the sell order was not placed at the broker.
Please note that I don't want to use a SellShort order to protect my buy-stop order, since I just want a protective stoploss and not a short order.
My code is shown below. Do you have any idea how to solve this?


protected override void Create() {
buy_order = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "testBuy", EOrderAction.Buy));
sell_order = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "testSell", EOrderAction.Sell));
}

protected override void CalcBar(){
buy_order.Send(1.09530); //the price was 1.09525 when I started the program.
sell_order.Send(1.09520); //this order is not placed at the broker when there is no open position
}

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 24 2015
by Henry MultiСharts
Hello Sir,

You are trying to generate an exit and an entry order together. As there is no open position - the exit order will be ignored by MultiCharts and not sent to the broker.

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 24 2015
by Ferro
Hello Henry,

Thank you for your explanation.
What do you propose as a solution?

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 25 2015
by JoshM
In other words, I would like to attach a stoploss to my stop order at the broker, so I am safe in case Multicharts crashes or its connection gets lost.
I'm not sure if this is possible; but with managed orders (that you used in your last example) this surely isn't possible. That's because those orders are cancelled when MultiCharts stops.

Perhaps unmanaged orders can be kept alive on the broker's end when MultiCharts closes, but I can't really say how this would work in this LMAX use case.

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 25 2015
by Ferro
Hi Josh,

Thank you for your reply. I've looked into unmanaged orders but couldn't find a stoploss parameter. There exists a PlaceOrder and ModifyOrder function but they don't support adding a stoploss.

How do other MC users address this problem? Are they aware of the risk of a stop-order without a stoploss at the broker?

The LMAX API supports stoploss for stop-orders:
public StopOrderSpecification(string instructionId, long instrumentId, decimal stopPrice, decimal quantity, TimeInForce timeInForce, decimal? stopLossPriceOffset, decimal? stopProfitPriceOffset);

Re: How to create a stop-order with stoploss at broker?

Posted: Dec 28 2015
by Henry MultiСharts
Hello Ferro,

StopLoss is not an order parameter. You can't just enable StopLoss for an order you are sending.
In MultiCharts StopLoss is an individual algorithmic order type which is generated and processed separately from the entry order. You need to have MultiCharts running to send the order. If connection is lost once the order is placed at broker - MultiCharts will no longer be able to control the order (modify/cancel).