Displaying Limit orders  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Displaying Limit orders

Postby 3strategy » 14 Jan 2015

I attach a simple Signal, that uses Limit orders.
I wrote a class that contains some additional logic that displays the order on the chart when it is "on". Without it the order is only displayed when it actually gets a filled (i.e. when we enter / exit a position).

The Class OrderEx which contains logic for displaying the order, cannot call the methods or objects for displaying (DrwText, DrwTrendLine) which are only accessible to the signal.
It would also need access to the Signal's Environment, CurrentPosition, Bars, BarNumber...

How can I change OrderEx so that it can access the DrwText, DrwTrendLine, Environment, CurrentPosition, Bars, BarNumber ?

The purpose is to be able to use this OrderEx in other Signals studies without repeating the draw methods in each study.
Attachments
TestLimitOrder.pln
(5.42 KiB) Downloaded 419 times

3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Displaying Limit orders

Postby 3strategy » 14 Jan 2015

I think I solved it.
Attached, is a working OrderEx class (using the same basic Signal).

What i did is make the following constructor

Code: Select all

public OrderEx(IOrderPriced order, object signal)
{
Order = order;
Signal = signal as SignalObject;
Barnumber = new BarNumber(Signal) ;//barnumber;
}
1) Is there anything better I should do?
I'm not comfortable with continuously "sending" the limit order on each bar, as opposed to triggering / cancelling. But I'm trying to make the best of the way it works and I hope my example helps someone.
2) If anyone has an example of a comprehensive working signal using limit orders - some kind of best practice, I'd love to see it.

3) Can I share the OrderEx class with someone that codes in MultiCharts.Net in VB, without converting my code to VB?
Attachments
TestLimitOrder.pln
(5.45 KiB) Downloaded 545 times

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

Re: Displaying Limit orders

Postby Henry MultiСharts » 14 Jan 2015

Hello 3strategy,

We are currently analyzing this case.

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

Re: Displaying Limit orders

Postby Henry MultiСharts » 15 Jan 2015

Hello 3strategy,

1. With the Managed approach, when everything is monitored by MC auto trading engine which is continuously "sending" the limit order on each bar - you can get all of the required functionality by accessing the SignalObject. Triggering / cancelling is Unmanaged order approach - means everything is monitored and controlled by the user's code. To learn more please refer to the following post.
3. You can move OrderEx into a separate project and compile it into a Dll. Then you can share the Dll with someone.

3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Displaying Limit orders / creating a dll for multichart

Postby 3strategy » 15 Jan 2015

Can I reference some of MultiCharts dlls so that OrderEx can use these types ? Otherwise it won't compile.
If yes, what should I reference?

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

Re: Displaying Limit orders  [SOLVED]

Postby Henry MultiСharts » 21 Jan 2015

Please have a look at the example attached to this post.


Return to “MultiCharts .NET”