Orders placement troubles

Questions about MultiCharts .NET and user contributed studies.
zencoder
Posts: 4
Joined: 12 May 2013

Orders placement troubles

Postby zencoder » 29 May 2013

first of all: I have read help https://www.multicharts.com/trading-sof ... 6.1_Orders and search for a few days forum and didnt get proper answer for the simple questions.... so, can anybody help me to write good code for:

A) I need to open from one to three orders at one moment. not in open next bar, not in close current bar, but exactly when .net code executes method .Send()
I need 3 orders at a time:
1) market order for open position for custom value of contract size
2) buy/sell stop order for setting stoploss order with setting stoploss price in points shift from opened market order (just for case of slippage during open last one)
3) buy/sell stop order for setting takeprofit. same as stoploss order.


B) I need to change any time or totaly delete limit orders price. not in percent, not in dollars. By myself I determinate new price for old order and want to set it not in open next bar, not in close current bar, but exactly when .net code executes.

I will be very grateful for any help in writing proper working code for above mentioned tasks

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

Re: Orders placement troubles

Postby Henry MultiСharts » 29 May 2013

Hello zencoder,

In order to send/modify the orders on the next tick after the signal generation tick you need to enable Intrabar Order Generation (IOG) mode. Please refer to this page for more details:
https://www.multicharts.com/trading-sof ... on_per_Bar
I would recommend you to read all articles of MultiCharts NET Programming Guide, not just one or two of them.

zencoder
Posts: 4
Joined: 12 May 2013

Re: Orders placement troubles

Postby zencoder » 29 May 2013

Thanks for quick replay, but it is only 1/10 of answers what I expected.

Still waiting for the rest of 9/10. For example: I cant find any guidnes how to delete pending order? or how to obtain pending order price and modify it?

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

Re: Orders placement troubles

Postby Henry MultiСharts » 31 May 2013

Hello zencoder,

In MultiCharts .Net there are two approaches for order generation: managed and umanaged orders.
Managed orders are monitored by the strategy. The orders are valid at broker while they are sent by the strategy. That means the conditions for order generation should be met in your code on each bar close or each tick (if IOG=ON) calculation while you need to keep your orders active.
Strategy can be trading only one instrument that is the main data series of your chart.
If you want to modify an order - just change the parameter you need (price or quantity) and the order will be modified or cancelled and resubmitted (depends on broker). Here is an example how to modify the amount of contracts for the order. If you want to cancel the order-stop sending it from the code (make the conditions for order generation invalid).

With unmanaged orders you can trade on multiple symbols through different broker plugins directly from one script. The symbols don't need to be on the chart, but you are responsible for managing your orders if you are using this approach. Here is an example of how to use the TradeManager.
For more information please refer to .Net programming guide: Extended Trading Possibilities. TradeManager:1, 2, 3, 4.

zencoder
Posts: 4
Joined: 12 May 2013

Re: Orders placement troubles

Postby zencoder » 01 Jun 2013

most all is clear, exept one moment.

suppose I sending market order and want to set stop loss for it in a distance for only 20 point. In main chart I have renko chart with Quote field set to Ask. When I send Sell order - it must be open on current Bid price, but it is uknown because Bid price is not present on chart. Stop loss for this Sell whill be Buy on Ask price, so my stop price must be Ask + StopInPoints * Bars.Point, because Bars.Close[0] = Ask. after sending stop order with this price everything whill be OK! I whil get 20 point stop.

But when I send Buy order, its open price must be Ask, and Stop must be in Bid, but I dont have Bid on my chart. Sending stop order with price Bars.Close[0] - StopInPoints * Bars.Point whill be wrong, because Bars.Close[0] = Ask but NOT Bid, which I realy need at this moment. So if spread will be 10 points, price Bars.Close[0] - StopInPoints * Bars.Point whil be on 10 points (spread value) close then I realy need. In this case I obtain stop only 10 points instead of required 20 :(

zencoder
Posts: 4
Joined: 12 May 2013

Re: Orders placement troubles

Postby zencoder » 01 Jun 2013

and one more question: after applying signal to the chart, the last one is marked with orders lines, which shows haw orders "was opened" in history. Is any way to acces this data to calculate signal results (total PL in points, number of profits and loss orders, and so on...) ?

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

Re: Orders placement troubles

Postby Henry MultiСharts » 03 Jun 2013

You can generate a stop loss with an offset from the average entry price, or in case you need current ask/bid values, you can get them from the status line.
Is any way to acces this data to calculate signal results (total PL in points, number of profits and loss orders, and so on...) ?
You can access the Strategy performance report from the View tab of MultiCharts. There is no access to this information from the code.


Return to “MultiCharts .NET”