..and so it begins
I've been reading through the classDocs. It does not appear mc.net has a PaintBar equivalent plot type. Is this correct? Sure would be nice.
PaintBar [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: PaintBar
Hello riverTrader,
There is no equivalent for PaintBar in MultiCharts .Net.
PaintBar is just a combination of four plots. The same functionality can be easily created in MultiCharts .Net using the following code:
There is no equivalent for PaintBar in MultiCharts .Net.
PaintBar is just a combination of four plots. The same functionality can be easily created in MultiCharts .Net using the following code:
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class PPB : IndicatorObject
{
public PPB(object _ctx):base(_ctx){}
private IPlotObject plot1;
private IPlotObject plot2;
private IPlotObject plot3;
private IPlotObject plot4;
protected override void Create()
{
plot1 = AddPlot(new PlotAttributes("Open", EPlotShapes.LeftTick, Color.Red));
plot2 = AddPlot(new PlotAttributes("High", EPlotShapes.BarHigh, Color.Red));
plot3 = AddPlot(new PlotAttributes("Low", EPlotShapes.BarLow, Color.Red));
plot4 = AddPlot(new PlotAttributes("Close", EPlotShapes.RightTick, Color.Red));
}
protected override void StartCalc() {
// assign inputs
}
protected override void CalcBar(){
plot1.Set(Bars.Open[0]);
plot2.Set(Bars.High[0]);
plot3.Set(Bars.Low[0]);
plot4.Set(Bars.Close[0]);
}
}
}
- Attachments
-
- PPB.zip
- (1.22 KiB) Downloaded 693 times
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: PaintBar
Thanks. The code you provided draws a standard bar.
Is there a way to use the plots to draw a candlestick?
Is there a way to use the plots to draw a candlestick?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: PaintBar
Just change the chart style to candlestick in Format->Instrument tab->Style->Chart type to Candlestick and the indicator will change to Candlesticks as well.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: PaintBar [SOLVED]
Please find the example attached.Could you provide an example which shows blue bars if Close > MA and red bars if Close < MA?
- Attachments
-
- PPB_MA.pln
- (1.42 KiB) Downloaded 1109 times
Re: PaintBar
Works nicely as indicator if its exactly overlayed over the standard barchart.
Is there a way to influence the drawing of a bar directly? That would be awesome. In other words is it possible to take full control over drawing a bar or candle?
Like drawing candles with gradient colors depending on indicators or whatever I would it to look like? Is it possible with IChartCustomDrawer?
Really if that functionality is possible then MC.Net will top everything.
Is there a way to influence the drawing of a bar directly? That would be awesome. In other words is it possible to take full control over drawing a bar or candle?
Like drawing candles with gradient colors depending on indicators or whatever I would it to look like? Is it possible with IChartCustomDrawer?
Really if that functionality is possible then MC.Net will top everything.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: PaintBar
Yes that is possible to plot candles with gradient colors.Works nicely as indicator if its exactly overlayed over the standard barchart.
Is there a way to influence the drawing of a bar directly? That would be awesome. In other words is it possible to take full control over drawing a bar or candle?
Like drawing candles with gradient colors depending on indicators or whatever I would it to look like? Is it possible with IChartCustomDrawer?
Please find a sample attached.
- Attachments
-
- CustomDrawGradientBar.pln
- (1.89 KiB) Downloaded 1062 times
Re: PaintBar
Really awesome! Very cool.
The only drawback it seems if its made as custom draw that its no real object (or plot) in the chart. So you can't click with mouse on it directly to select it and change input parameters.
Is it possible to make PlotObjects (like the PPB_MA above) the same way? Fully custom drawn like you have shown but selectable by mouse? Or is it impossible due to inability of Multicharts to determine the hitbox for a mouseclick if its completely custom drawn?
It would be enough in my opinion if the interface IChartCustomDrawer would have a function like IsHit(int x, int y) to be implemented by the custom drawer which returns true if the drawn stuff is hit by the mouse. The DrawContext could give a hint that the drawn object is currently selected so drawing could be made a bit different to reflect that fact.
Anyway, I'm already happy and impressed enough about what you have shown here
The only drawback it seems if its made as custom draw that its no real object (or plot) in the chart. So you can't click with mouse on it directly to select it and change input parameters.
Is it possible to make PlotObjects (like the PPB_MA above) the same way? Fully custom drawn like you have shown but selectable by mouse? Or is it impossible due to inability of Multicharts to determine the hitbox for a mouseclick if its completely custom drawn?
It would be enough in my opinion if the interface IChartCustomDrawer would have a function like IsHit(int x, int y) to be implemented by the custom drawer which returns true if the drawn stuff is hit by the mouse. The DrawContext could give a hint that the drawn object is currently selected so drawing could be made a bit different to reflect that fact.
Anyway, I'm already happy and impressed enough about what you have shown here
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: PaintBar
This feature has not been implemented yet. You may want to submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/Really awesome! Very cool.
The only drawback it seems if its made as custom draw that its no real object (or plot) in the chart. So you can't click with mouse on it directly to select it and change input parameters.
Is it possible to make PlotObjects (like the PPB_MA above) the same way? Fully custom drawn like you have shown but selectable by mouse? Or is it impossible due to inability of Multicharts to determine the hitbox for a mouseclick if its completely custom drawn?
It would be enough in my opinion if the interface IChartCustomDrawer would have a function like IsHit(int x, int y) to be implemented by the custom drawer which returns true if the drawn stuff is hit by the mouse. The DrawContext could give a hint that the drawn object is currently selected so drawing could be made a bit different to reflect that fact.
Anyway, I'm already happy and impressed enough about what you have shown here