Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have a colored plot that crosses a zero line. The colors do not change exactly at the zero line. How should this be coded to change exactly at the zero line?
if (Plot[0]>0) PlotColors[0][0] = UpColor;
if (Plot[0]<0) PlotColors[0][0] = DownColor;
I would also like the zero line and other lines to draw on top of a histogram instead of behind. Is that possible?
Can you help answer these questions from other members on NexusFi?
If you want to plot the zeroline and other lines on top of a histogram, this is possible but not easy. You need to use ZOrder, and code two indicators.
Use one indicator for the histogram, select Zorder = x (for example ZOrder = 2) in the Initialize() section of the indicator.
Use another indicator for the zerolines, select ZOrder = x+1 (for example ZOrder = 3) in the Initialize() section of the indicator.
As far as I know, it is not possible to code this within a single indicator.
Do you have a solution for the problem to draw one element on top of another within the same indicator? For example, woud it be possible to draw a rectangle via DrawRectangle() behind a plotted line?
I found a solution for drawing a line on top of a histogram. Instead of using Add(Line), I used Add(Plot) and set it to a fixed value. As long as the horizontal line plot comes before the histogram plot, the line draws on top.
That is already better than 2 separate indicators that I have used so far. The question is, whether I can save the order as part of my workspace, once I have shifted it to the appropriate level. The chart template does not save it, as far as I know.
I have modified the pivots indicator and added 3 lines of code to plot a rectangle as well. The rectangle is plotted in the end of the OnBarUpdate() section.
- I have not yet tried to put DrawRectangle() into the custom plot area, because the custom plot is called with every incoming tick... -
As can be seen below, the rectangle plots above the bars and above the plot lines. If I initialize the indicator with ZOrder = -1, the rectangle will plot behind the bars, but still above the plot lines.
Is there any way to plot the rectangle behind the plot lines?