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

[amibroker] Re: How to plot volume in price pane using 1/3 of pane?



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Dan Clark" <dan_public@xxxx> wrote:
>
> Hi,
> 
> I'd like to overlay a volume histogram in a price bar pane, but set it up so
> that the tallest volume bar take up onlys 1/3 of the pane.  How can I do
> that?   


Dan, Here is a way. You can change the numbers for the LowerFreespacePercent and the UpperFreespacePercent to suit your needs. (Be sure to undo the line-wrap in the long Title statement.) Bill

// Lower limit for plotting one variable
function L1 (Var, LowerFreespacePercent, 
                        UpperFreespacePercent)
{
    vis = Status("barvisible");
    Hii = LastValue(Highest(Var*vis));
    Loo = LastValue(Lowest((Var - Hii)*vis) + Hii);
    range = Hii - Loo;
    rangePercent = 100 - LowerFreespacePercent - 
                           UpperFreespacePercent; 
    mult = range / rangePercent;
    result = Loo - mult*LowerFreespacePercent;
    return result;
}

// Upper limit for plotting one variable
function U1 (Var, LowerFreespacePercent, 
                        UpperFreespacePercent)
{
    vis = Status("barvisible");
    Hii = LastValue(Highest(Var*vis));
    Loo = LastValue(Lowest((Var - Hii)*vis) + Hii);
    range = Hii - Loo;
    rangePercent = 100 - LowerFreespacePercent - 
                                   UpperFreespacePercent; 
    mult = range / rangePercent;
    result = Hii + mult*UpperFreespacePercent;
    return result;
}

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( Close, "Close", colorRed, styleNoTitle | styleBar | 
    styleOwnScale, L1(Close, 15, 12), U1(Close, 15, 12) );    
Plot(Volume, "volume", colorLightBlue, styleHistogram | 
    styleOwnScale, L1(Volume, 5, 65), U1(Volume, 5, 65) );







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/