Draw Staircase / horizontal lines / box  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
KaBo
Posts: 11
Joined: 17 Jul 2014
Has thanked: 4 times
Been thanked: 4 times

Draw Staircase / horizontal lines / box

Postby KaBo » 05 Feb 2016

Hi everybody,

seems like a super simple task at hand but I don't get it done. Maybe somebody can point me in the right direction(s).

1.) I have a chart and want to draw support / resistance lines. My problem is that these lines always start at a bar and not between bars. It doesn't make any sense, because the breakout level start and end between bars - always!
I want to display the levels but either it starts at the previous bar (which is wrong) or it starts at the current bar, which is wrong as well.
Basically I know it from other charting programs as "levels" or "staircase" (with connection between the levels). What am I missing here?

2.) Draw candlesticks. I would like to have a Value-Chart (Hellweg/Standal) as an indicator. I can only get a method to draw a bar, not a candlestick (4.3.1) Am I missing something?
On top of it, I get the bar vertically displaced by a few points. Bug of feature?

3.) Box: In the manual there is a little subchapter (4.7.1), that you can use GDI/GDI+ library to draw custom shapes. But the only reference is to the _Market_depth_on_chart script as an example. I tried to find documentation, but couldn't find any.
Quite honestly, I don't want to spend a week trying to figure out how to draw a rectangle on a chart! There must be some documentation?!?

Cheers
KaBo

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Draw Staircase / horizontal lines / box  [SOLVED]

Postby JoshM » 05 Feb 2016

1.) I have a chart and want to draw support / resistance lines. My problem is that these lines always start at a bar and not between bars. It doesn't make any sense, because the breakout level start and end between bars - always!
The point between which trend lines are drawn are defined with `ChartPoint` structs. These are typically set to a DateTime value of a bar, but they don't actually care about whether the DateTime value is actually a bar time.

So you might want to try to pass the DateTime value that's between two bars into this method to see if this also makes the trend line begin/end between bars. That begin said, I have no idea how this would work in practice because a trend line's condition cannot happen between bars: there is no time (and so no price action) when one bar closes and another one opens.
2.) Draw candlesticks. I would like to have a Value-Chart (Hellweg/Standal) as an indicator. I can only get a method to draw a bar, not a candlestick (4.3.1) Am I missing something? On top of it, I get the bar vertically displaced by a few points. Bug of feature?
You can use custom drawings for this. Henry made a helpful example here on the forum that makes gradient coloured price bars, so you might want to search for that for an example.

I don't know what you mean with a method that draws a bar but not a candlestick, and that bar being displaced by a couple of points. I think you mean a plotted paint bar. Those are based on the values you feed into them and they shouldn't be off with a couple of points. Perhaps there's a coding bug somewhere?
3.) Box: In the manual there is a little subchapter (4.7.1), that you can use GDI/GDI+ library to draw custom shapes. But the only reference is to the _Market_depth_on_chart script as an example. I tried to find documentation, but couldn't find any.
Quite honestly, I don't want to spend a week trying to figure out how to draw a rectangle on a chart! There must be some documentation?!?
There are a few more examples on the forum regarding custom drawings (also see my above comment), but there's currently not more documentation for this.

KaBo
Posts: 11
Joined: 17 Jul 2014
Has thanked: 4 times
Been thanked: 4 times

Re: Draw Staircase / horizontal lines / box

Postby KaBo » 09 Feb 2016

So you might want to try to pass the DateTime value that's between two bars into this method to see if this also makes the trend line begin/end between bars. That begin said, I have no idea how this would work in practice because a trend line's condition cannot happen between bars: there is no time (and so no price action) when one bar closes and another one opens.
Hi Josh, thanks, but this doesn't seem to work.
I am surprised, MC has been around for so long, and this indicator plot is not available. In the picture you can see the difference between the staircase plot and standard. Just so much clearer for spotting levels (breakout / stop / etc.). Would be great for trendlines as well (start and end between bars).

Image
You can use custom drawings for this. Henry made a helpful example here on the forum that makes gradient coloured price bars, so you might want to search for that for an example.
I found one easier sample ("A_Painter") - but using the custom drawer has a brutal steep learning curve! I wish there were more samples and documentation to do things.

KaBo
Posts: 11
Joined: 17 Jul 2014
Has thanked: 4 times
Been thanked: 4 times

Re: Draw Staircase / horizontal lines / box

Postby KaBo » 17 Feb 2016

O.k., after wining and ranting for a while that my favourate indicator style is not available I spent some time on the CustomDraw.
It turns out, that it is not that complicated after all. Though some more documentation in all areas of MC scripting would favour progress immensely ;-)

Josh was right, too. You can get the horizontal line to start and end between bars. However, you need to use the actual X-coordinates and not like almost all samples use the time of the bar. It does not work using a time in beetween bars.

So for anybody who is interested in the custom draw staircase I posted two samples in the contributions.

Cheers
KaBo


Return to “MultiCharts .NET”