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.
Displaying Limit orders [SOLVED]
Re: Displaying Limit orders
I think I solved it.
Attached, is a working OrderEx class (using the same basic Signal).
What i did is make the following constructor
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?
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;
}
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 547 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Displaying Limit orders
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.
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.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times