|
Josh McCormick
2020-07-03 15:38:13
|
|
I'm wanting to create a filled hatch graph (with a black outline and zero line) where everything above zero is filled in green and everything below zero is filled in red. I figured out some code that worked perfectly.... except for where they meet in the middle. There is some sloppy overspray. Is there a better way to do what I want? And please, forgive my code. This is my third day with the product:
EXAMPLE IMAGE -------------------------
https://i.imgur.com/KzrkxXX.png
MY CODE -----------------------------------
// Pull Enhanced SRM Data (in beta - to be published) based upon a 50 period lookback
a = Srme(50);
// Plot the top half of the graph in a nice green hatched pattern (positive numbers)
Plot((a>0)*a, "Bulls Only", colorGreen|108, ChartLine, StyleWidth2);
SetHatchBrush("Percent20", colorWhite|255|colorMintCream|255|161);
// Plot the bottom half of the graph in a nice red hatched pattern (positive numbers)
Plot((a<0)*a, "Bears Only" , colorRed|108, ChartLine, StyleWidth2);
SetHatchBrush("Percent20", colorWhite|255|colorMintCream|255|161);
// Plot a solid black outline around the edge of the graph.
Plot(a, "SRME", colorBlack, ChartLine, StyleWidth3);
// Plot a black zero line to clearly divide the positive/negative boundary.
Plot (0, "", colorBlack, ChartLine, StyleWidth2);
Where it fails is when a number crosses the zero line, and I know that it's because I'm calling two different graph functions. But I haven't been able to find a way to create a bi-colored (and hatched) positive/negative graph. Hopefully there's some cool command I'm missing?
PS: Try this out on your own positive/negative indicator. It's an attractive plot, IMHO. It just needs a few touch-ups.
HELP? :)
|
|