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

Re: [amibroker] Re: Volume at the Bottom of the Chart


  • Date: Wed, 27 Jan 2010 22:07:37 -0800
  • From: "NW Trader" <ta4charts@xxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Volume at the Bottom of the Chart

PureBytes Links

Trading Reference Links



Hi Eswar,
 
You can do this for yourself if you start to learn some basic AFL coding (which should be your goal if you want to use AB customized to your own preferences).  You already are part way there as you have defined the conditions you want to display, now you just need to incorporate them into an indicator which you can overlay on a price chart. To get you started, try the following:
 

Codename = "Volume - 4 Color" ;

// Color Conditions

Upgreen = C > Ref( C, -1 ) AND C > O ;

DownRed = C <= Ref( C, -1 ) AND C < O;

UpPurple = C > Ref( C, -1 ) AND C < O;

DownBlue = C <= Ref( C, -1 ) AND C > O;

VColor = IIf( UpGreen, colorGreen, IIf( DownRed, colorRed, IIf( UpPurple, colorPlum, colorBlue ) ) );

VStyle  = ParamStyle( "Volume Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ) ;

VHeight = Param( "1/N Height", 4, 1, 10, 0.5 );

Plot( V, "   Volume", VColor, VStyle, VHeight );

 
In this code, I've substituted Plum for Purple and added a parameter setting to adjust the height of the volume bars (to prevent overwriting your price code -- right click on the chart, select parameters). To overlay this on another chart, first click on the target chart, then right click on the code in the Charts tree (save it first to a Named folder under Formulas and it will be there in the tree) and select Overlay from the drop down menu. If you just want to use it as a volume chart, select either Insert or Insert Linked.
 
Hope this will help you realize what you can do with very little effort to learn basic AFL.
 
Peace and Justice   ---   Patrick
----- Original Message -----
Sent: Wednesday, January 27, 2010 8:40 PM
Subject: Re: [amibroker] Re: Volume at the Bottom of the Chart

Hi,
I too find it useful to view the volume histogram when colored based on direction from previous close. Thanks. However, combining this with the relation of Close to today's Open can offer far better insights. Consider the following states:

1. C >Ref(C, -1) AND C>O - Upvolume green
2. C<=Ref(C,-1) AND C<O - Down volume - Red
3. C >Ref(C, -1) AND C<O - Upvolume - Purple
4. C<=Ref(C, -1) AND C>O - Downvolume - Blue

States 3. and 4. typically preceede changes in trend and reflect emerging patterns like the gapped morning/ evening star. It would be even better if the price candle is colored differently along with volumes, to reflect these potential inflexion points.

Would greatly appreciate if someone could amend the code for these additional states into a formula that I can drag-drop onto the price chart.

best,
Eswar



2010/1/26 edwol53 <edwol@xxxxxxxxxxx>
 

Hello Mike & Barry

Quite correctly - I was focused on the efficiency/elegance of the code and I did not pay enough attention to the code itself ie as you correctly pointed out the second condition needed to be considered. Thankyou for pointing that out.

My take on the colour volume is slightly different where the colour of the volume reflects the current close relative to the previous period's close ie C - Ref(C, -1) and is more insightful when using the volume histogram at a glance.

For those who aggree with this view the code segment below may be of use.


_SECTION_BEGIN("Variable Volume Hight2");
direction = C - Ref(C, -1);
VolColor = (direction > 0) * ParamColor( "UpColor" ,colorGreen) + (direction <= 0)*ParamColor( "DnColor" ,colorRed) ;

vHeight = Param("Volume: 1 / Height",10, 1, 100, 1.0) ; // height as % of screen
Plot(Prec(Volume ,0),"V",VolColor, styleNoTitle | styleOwnScale| styleNoLabel | styleHistogram |styleThick | styleNoLabel, vHeight);
_SECTION_END();

Cheers
Ed


--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> You have not correctly inverted the opposite condition. The _expression_ that you should be trying to form is as follows;
>
> In the case of up volume:
>
> ( (1 * colorGreen) + (0 * colorRed) )
>
> which you will note is equivalent to simply saying "colorGreen" since we are zeroing out the colorRed value. Conversely, in the case of down volumne:
>
> ( (0 * colorGreen) + (1 * coloreRed) )
>
> which is the same as simply saying "colorRed" since we zero out the colorGreen value.
>
> In your code you have not inverted the up condition for application to down color. Therefore your values are evaluating to other colors.
>
> In the case of up volume:
>
> 1 * colorGreen + 1 * colorRed
>
> In the case of down volume:
>
> 0 * colorGreen + 0 * colorRed
>
> Change your code to something like:
>
> (direction * colorGreen) + (!direction * colorRed);
>
> better yet, change your variable name accordingly:
>
> (upVolume * colorGreen) + (!upVolume * colorRed);
>
> Mike
>
> --- In amibroker@xxxxxxxxxxxxxxx, "edwol53" <edwol@> wrote:
> >
> > Hello Barry
> >
> > I made a slight modification to your code below, which should give the same clour output for volume, but it instead it plots black for green & light grey for red. The boolean _expression_ for direction should resolve to 1 (true) or 0 (false) and Volcolor should plot the same as you original code. Can you why this is not the case ?
> >
> > _SECTION_BEGIN("Variable Volume Hight2");
> > direction = C > O OR (C == O AND (H-C) <= (C-L) );
> > VolColor = (direction) * ParamColor( "UpColor" ,colorGreen) + (direction )*ParamColor( "DnColor" ,colorRed) ;
> > vHeight = Param("Volume: 1 / Height",10, 1, 100, 1.0) ; // height as % of screen
> > Plot(Prec(Volume ,0),"V",VolColor, styleNoTitle | styleOwnScale| styleNoLabel | styleHistogram | styleNoLabel, vHeight);
> > _SECTION_END();
> >
> > Thanks
> > Ed
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Barry" <razzbarry@> wrote:
> > >
> > > The formula in post 146327 has parameters that allow you to change the color. OR you can use this version which also has colors red and green but also has parameters for the colors. Just make a formula out of it and drag and drop onto the price all in one screen.
> > >
> > > _SECTION_BEGIN("Variable Volume Hight");
> > > VolColor = (C > O OR (C == O AND (H-C) <= (C-L) )) * ParamColor( "UpColor" ,colorGreen) + (C < O OR (C == O AND (H-C) > (C-L)) )*ParamColor( "DnColor" ,colorRed) ;
> > > vHeight = Param("Volume: 1 / Height",10, 1, 100, 1.0) ; // height as % of screen
> > > Plot(Prec(Volume ,0),"V",VolColor, styleNoTitle | styleOwnScale| styleNoLabel | styleHistogram | styleNoLabel, vHeight);
> > > _SECTION_END();
> > >
> > > Barry
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Richard" <areehoi@> wrote:
> > > >
> > > > I'm interested in using this "Price (all in one)" chart but, how would I change code to show color ...Green for up volume and red for down volume. Thanks
> > > >
> > > > Dick H
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, Tomasz Janeczko <groups@> wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > Price (all in one).afl shipped with AmiBroker contains the code that
> > > > > does that exactly.
> > > > > You can use AFL Editor to see the underlying code and see how it is done.
> > > > >
> > > > > Best regards,
> > > > > Tomasz Janeczko
> > > > > amibroker.com
> > > > >
> > > > > On 2010-01-25 11:01, osp2osp wrote:
> > > > > > Mike,
> > > > > >
> > > > > > Thank you very much for your kind reply.
> > > > > >
> > > > > > It is dead end for me. May be, I have to place my request properly.
> > > > > >
> > > > > > Price is already plotted along with moving averages and Bollinger Bands.
> > > > > >
> > > > > > I just want to overlay the volume bars at the bottom of the screen. So that, the area available for price plot is not reduced and at the same time the volume spikes do not go up to the top of window.
> > > > > >
> > > > > > Hope, I am clear.
> > > > > >
> > > > > > Thank you once again.
> > > > > >
> > > > > > Warm Regards
> > > > > >
> > > > > >
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Mike"<sfclimbers@> wrote:
> > > > > >
> > > > > >> Multiple plots on a single pane have been discussed in the following thread. Read through it and see if it's what you want:
> > > > > >>
> > > > > >> http://finance.groups.yahoo.com/group/amibroker/message/143807
> > > > > >>
> > > > > >> Mike
> > > > > >>
> > > > > >> --- In amibroker@xxxxxxxxxxxxxxx, "osp2osp"<osp2osp@> wrote:
> > > > > >>
> > > > > >>>
> > > > > >>> Hi,
> > > > > >>>
> > > > > >>> Thanks for the reply. I tried that already.
> > > > > >>>
> > > > > >>> Plot(Volume, "",MyVolCol,styleOwnScale+styleHistogram,0,20);
> > > > > >>>
> > > > > >>> Not getting the desired the results.
> > > > > >>>
> > > > > >>> Thank You Very Much.
> > > > > >>>
> > > > > >>> Regards.
> > > > > >>>
> > > > > >>> --- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs<kmccombs@> wrote:
> > > > > >>>
> > > > > >>>> Check AFL Help for how to use Plot() function. You need to use sixth
> > > > > >>>> parameter, maxvalue.
> > > > > >>>>
> > > > > >>>> osp2osp wrote:
> > > > > >>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> Hi,
> > > > > >>>>>
> > > > > >>>>> I like to plot the volume in the price window itself and tried the
> > > > > >>>>> following:
> > > > > >>>>>
> > > > > >>>>> Plot(Volume, "Vol",MyVolCol,styleOwnScale+styleHistogram);
> > > > > >>>>>
> > > > > >>>>> It plots the volume bars in entire price window.
> > > > > >>>>>
> > > > > >>>>> I need help to plot ie. overlay volume at the bottom of the price
> > > > > >>>>> window, taking not more than 20% of the entire price window.
> > > > > >>>>>
> > > > > >>>>> Request someone to help me.
> > > > > >>>>>
> > > > > >>>>> Thank you very much.
> > > > > >>>>>
> > > > > >>>>> Warm Regards.
> > > > > >>>>>
> > > > > >>>>> K Karunakaran
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>
> > > > > >>>
> > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------------
> > > > > >
> > > > > > **** 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/
> > > > > >
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>




__._,_.___


**** 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

__,_._,___