[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Plot 2 charts in 1 window??



PureBytes Links

Trading Reference Links



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 amibroker@xxxxxxxxxxxxxxx, "Peter" <aretep@xxx> 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);
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___