Hi,
Your math appears to be faulty, and you are not using the min/max Y axis
arguments correctly.
The values to min/max Y should be the lowest value and highest value
respectively for the scale with which to plot. If you want your
indicator to draw in the lower 20%, then you have to make the minY equal
to the HaLow and the maxY to be 5 times the range (HaHigh - HaLow) +
HaLow such that the range of the indicator is 1/5th the Y axis range.
Translated to Y axis, this ideally means the lowest visible HaLow and
the highest visible HaHigh. However, AmiBroker seems to be setting the Y
axis min/max one time only, as opposed to dynamically adjusting the
range while scrolling. Therefore, you can use the all time lowest
HaLow and all time highest HaHigh, though this may compress the
indicator more than you want. Play with the following and work from
there. Mike
// Plots second chart in lower 20% of window
PH = 20;
/* Dynamic approach does not seem to work, presumably due to
one time only setting of Y axis high/low
function GetVisibleBarCount() {
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
return Min( (Lvb - fvb) + 1, BarCount - fvb );
}
Period = GetVisibleBarCount();
MinValue = LastValue(LLV(HaLow, Period));
MaxValue = LastValue(HHV(HaHigh, Period));
*/
MinValue = LastValue(Lowest(HaLow));
MaxValue = LastValue(Highest(HaHigh));
MinY = MinValue;
MaxY = (100/PH) * (MaxValue - MinValue + 1) + MinValue;
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose,"Heiken-Ashi Candles ",
colorBlack, styleCandle|styleOwnScale, MinY, MaxY);
--- In [email protected], "Peter" <are...@...> wrote:
>
> Hi
>
> Can you use PlotOHLC to plot a second chart in the lower part of a
window?
>
> The normal Plot function as in the last line the code will plot the
RSI line
> but the PlotOHLC doesn't seem to work?
>
> Any help would be appreciated!!!
>
> Thanks
>
> Peter
>
>
>
>
>
> // Plots main chart
>
> Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
> ParamStyle("Style", styleCandle, maskAll) );
>
>
>
> // Heiken-Ashi
>
> HaClose = (O+H+L+C)/4;
>
> HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
>
> HaHigh = Max( H, Max( HaClose, HaOpen ) );
>
> HaLow = Min( L, Min( HaClose, HaOpen ) );
>
>
>
>
>
> R = RSI();
>
> PH = 20; // Height
> of second plot in percent pane height
>
> Plot2Height = 100/PH*100;
>
> GraphXSpace = 5*PH;
>
>
>
> // Plots second chart in lower 20% of window
>
> PlotOHLC( HaOpen, HaHigh, HaLow, HaClose,"Heiken-Ashi Candles ",
colorBlack,
> styleCandle|styleOwnScale,0,Plot2Height);
>
> //Plot(R,"",colorRed,styleLine|styleOwnScale,0,Plot2Height);
>