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 [email protected], "Mike" <sfclimb...@...> 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 [email protected], "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 [email protected], "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 [email protected], "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 [email protected], 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 [email protected], "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 [email protected], "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 [email protected], 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
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>