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

Questions about MultiCharts .NET and user contributed studies.
Ferro
Posts: 4
Joined: 17 Dec 2015
Has thanked: 1 time

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

Postby Ferro » 17 Dec 2015

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?
Attachments
lmax stop order.png
(12.47 KiB) Downloaded 1951 times

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

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

Postby Henry MultiСharts » 21 Dec 2015

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.

Ferro
Posts: 4
Joined: 17 Dec 2015
Has thanked: 1 time

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

Postby Ferro » 22 Dec 2015

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
}

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

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

Postby Henry MultiСharts » 24 Dec 2015

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.

Ferro
Posts: 4
Joined: 17 Dec 2015
Has thanked: 1 time

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

Postby Ferro » 24 Dec 2015

Hello Henry,

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

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

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

Postby JoshM » 25 Dec 2015

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.

Ferro
Posts: 4
Joined: 17 Dec 2015
Has thanked: 1 time

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

Postby Ferro » 25 Dec 2015

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);

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

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

Postby Henry MultiСharts » 28 Dec 2015

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).


Return to “MultiCharts .NET”