Okay this is a weekend question, but I'm having fun.
Looking into the IChartCustomDrawer interface I see that I am to provide a ChartPoint to specify the point on the chart to locate the rectangle/graphic.
How do I get the ChartPoint for a given bar /dateTime? And secondly, how do I get a chartpoint for a bar/dateTime if the object I am drawing is not on the chart itself, but on a second pane? (eg. a bar graph below the main chart).
given a bar chartpoint, is there a way I can find what the rectangle would be for the entire bar y-axis (ie. the width == barWidth, height == chartHeight).
no hurry on this one.
IChartCustomDrawer Interface
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: IChartCustomDrawer Interface
One more question: can I get the rectangle for the entire (inner) chart area?
I'm thinking I may want to just use the chart space altogether, and either place the graphic above or below the chart graphics.
I'm thinking I may want to just use the chart space altogether, and either place the graphic above or below the chart graphics.
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: IChartCustomDrawer Interface
Thanks. I spent some time looking through the code for Market_Depth_on_Chart_2_.Indicator.CS and got a lot of questions answered.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: IChartCustomDrawer Interface
Hello riverTrader,
When you are calling EventDraw you can send the DrawContext parameter. You can specify and convert regular coordinates into bar coordinates with it. Check "DrawContext Environment" in the help file for more information.
When you are calling EventDraw you can send the DrawContext parameter. You can specify and convert regular coordinates into bar coordinates with it. Check "DrawContext Environment" in the help file for more information.
Re: IChartCustomDrawer Interface
You meant when you use the callback EventDraw you *get* a DrawContext object which in turn can be used to convert pixels to chart space and versa.When you are calling EventDraw you can send the DrawContext parameter.
Re: IChartCustomDrawer Interface
@rivertrader please post some sample code when you get working! I am pretty new to programming so sample code really helps. I got my price and time values for the two rectangle coordinates but quite confused on how to proceed.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: IChartCustomDrawer Interface
Can someone share a code example of using a DrawContext object, for example to draw a text box?
I couldn't find one included in the default indicators, and while the documentation is handy for referencing, it lacks an example how one should implement DrawContext from scratch.
I couldn't find one included in the default indicators, and while the documentation is handy for referencing, it lacks an example how one should implement DrawContext from scratch.
Re: IChartCustomDrawer Interface
I couldn't find one included in the default indicators, and while the documentation is handy for referencing, it lacks an example how one should implement DrawContext from scratch.
I couldn't agree more. There needs to be plenty of examples in the documentation for people to work with.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: IChartCustomDrawer Interface
Could you also provide an example of how to loop through backtest trades done by a signal?We will provide you with the examples shortly.
The documentation is for me as beginner not completely clear on this. Should I use ITradingData, since that's the 'trade data access interface', or the ITradeManager, but the IPositions is also described as something that holds positions data. The IOrders interface could also work, since that is an 'orders data' source interface. But clicking through these, I couldn't find a property that, say, returned the entry price.
Anyway, just to highlight that an example would be very much appreciated.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: IChartCustomDrawer Interface
JoshM,Could you also provide an example of how to loop through backtest trades done by a signal?
Do you mean you want to send orders in a loop on one bar in backtesting?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: IChartCustomDrawer Interface
Hello Martin,HelloWe will provide you with the examples shortly.
An old post, Is an example of code has been published?
Martin
Here is an example how to plot candles with gradient colors in MC .Net using IChartCustomDrawer. There is also a prebuilt indicator called _Market_Depth_on_Chart_2_ that can be used for reference.