Puzzling issue regarding styleLine and styleBar in Plot statement

I have a simple formula to plot the relative strength of the selected symbol and a base symbol.

base=ParamStr("RS BaseTicker","VOO");
RS=RelStrength(base)/1000;	//Divided by 1000 so result yields actual fractional amount
Color=Param("CRS Color",colorDarkYellow);
if (plotStyle=="styleLine")
  }type or paste code here

When using styleLine in the Plot statement the chart correctly shows the relative strength between the two symbols with proper scaling.
Screen Shot 2021-03-21 at 4.42.26 PM
If styleBar is used instead, the chart plots both the selected symbol with its correct scaling and the relative strength line which is flat-lined at the bottom because its scaling is so different.
Screen Shot 2021-03-21 at 4.44.12 PM

What do I need to change in the Plot statement so that the chart only shows the correct relative strength line using the styleBar parameter?

You have to use styleOwnScale in the plot for the RS line, and also ensure that the first line to be plotted is the price, not the RS, because the first plot sets the default scale for the chart.

You might also have to set minvalue and maxvalue for the RS line (I don't remember).

To plot OHLC bars, styleBar requires FOUR prices - Open, High, Low and Close, not only one.

It works if you call Plot() with CLOSE price because it indirectly looks up High, Low, Open. But if you call it with something else than current symbol close, you have to pass FOUR prices (OHLC) to PlotOHLC function.

PeterD - thank you for your suggestion on Plotting a relative strength line.

Tomasz - also thank you for pointing out the need to Plot OHLC bars for something other than the current symbol Close. This allowed me to take one more small step towards a better understanding of Amibroker's complexities.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.