PureBytes Links
Trading Reference Links
|
"Moreover, the 2nd price plot
is never displayed since it is pre-empted by the first price plot. " - didnt understand this. Can you please explain?
On 30 January 2010 22:25, Joris Schuller <jschuller@xxxxxxxxxxx> wrote:
You seem to be creating
somewhat of a mixed metaphor, using price criteria for the volume coloring and
volume criteria for the price coloring. Moreover, the 2nd price plot
is never displayed since it is pre-empted by the first price plot. Finally I
would whenever possible associate increasing parameter values with increasing
display values (OHLCVI, indicators): We typically go from bottom to top, read
from left to right (unless of course you are an Arab and do it the opposite
way). So use a linear VHeight adjustment rather than a parabolic one.
Below the code
the way I would do it. I have added the original code so that you can toggle
between them and decide which version you prefer or if so desired keep all
three possibilities. (Don’t forget to click the “Apply Indicator” button when
switching between versions in the parameter box).
Title = EncodeColor(4)+ _DEFAULT_NAME()+"; "+EncodeColor(1) + StrFormat("{{NAME}}
- {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g (%.1f%%)
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
Orig_ChangedSel=ParamToggle("Version","Modified|Original",0);
if(!Orig_ChangedSel)
//Select
modified AFL
{
ColorSel=ParamToggle("Color Selection Criterion","Vol
MA|C-O",1);
VStyle = ParamStyle( "Volume Style", styleHistogram | styleOwnScale
| styleThick | styleNoLabel, maskHistogram ) ;
VHeightNew = Param( "Height", 0.25, 0.1, 1, 0.05 ); //Changed from 1/N Height to linear
relationship to reflect increasing height with increasing param value
HighVol_Color = IIf(V> MA(V, 20), colorBlue, colorBlack);
if(ColorSel) //C-O Criterion
{
Upgreen = C > Ref( C, -1 ) AND C > O ;
DownRed = C <= Ref( C, -1 ) AND C < O;
UpBlack = C > Ref( C, -1 ) AND C < O;
DownBlue = C <= Ref( C, -1 ) AND C > O;
CO_Color = IIf( UpGreen, colorGreen, IIf( DownRed, colorRed, IIf( UpBlack, colorBlack,
colorBlue ) ) );
Plot( Close, "Price",CO_Color, styleCandle
| styleThick );
Plot( V, "Volume", CO_Color,
VStyle, 1/VHeightNew );
}
if(!ColorSel) //Vol MA
Criterion
Plot( Close, "Price",HighVol_Color, styleCandle
| styleThick );
Plot( V, "Volume", HighVol_Color,
VStyle, 1/VHeightNew );
}
if(Orig_ChangedSel)// Select
original AFL
{
//Original
version
//_SECTION_BEGIN("Variable
Volume Hight");
//
HighVolume PaintBar
//defaultColor
= IIf(C>Ref(C, -1), colorGreen, colorRed);
HighVolColor = IIf(V> MA(V, 20), colorBlue, colorBlack);
Plot(Close, "HighVolBar", HighVolColor, styleCandle,
styleThick) ;// Only price crit displayed
//Codename
= "Price Volume - 4 Color"
//
Color Conditions
Upgreen = C > Ref( C, -1 ) AND C > O ;
DownRed = C <= Ref( C, -1 ) AND C < O;
UpBlack = C > Ref( C, -1 ) AND C < O;
DownBlue = C <= Ref( C, -1 ) AND C > O;
VColor = IIf( UpGreen, colorGreen, IIf( DownRed, colorRed, IIf( UpBlack, colorBlack,
colorBlue ) ) );
VStyle = ParamStyle( "Volume Style", styleHistogram | styleOwnScale
| styleThick | styleNoLabel, maskHistogram ) ;
VHeight = Param( "1/N Height", 4, 1, 10, 0.25 );
Plot( Close, "Price",VColor, styleCandle
| styleThick );// Is not displayed because of earlier price Plot
Plot( V, "
Volume", VColor, VStyle, VHeight );
//_SECTION_END(
);
}
thanks....Pratik and all
i made i just copy+paste of ur code
_SECTION_BEGIN("Variable Volume Hight");
//defaultColor = IIf(C>Ref(C, -1), colorGreen,
colorRed);
HighVolColor = IIf(V> MA(V, 20), colorBlue,
colorBlack);
Plot(Close, "HighVolBar", HighVolColor,
styleCandle, styleThick) ;
//Codename = "Price Volume - 4 Color"
Upgreen = C > Ref( C, -1 ) AND C > O ;
DownRed = C <= Ref( C, -1 ) AND C < O;
UpBlack = C > Ref( C, -1 ) AND C < O;
DownBlue = C <= Ref( C, -1 ) AND C > O;
VColor = IIf( UpGreen, colorGreen, IIf( DownRed, colorRed,
IIf( UpBlack, colorBlack, colorBlue ) ) );
VStyle = ParamStyle( "Volume Style",
styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ) ;
VHeight = Param( "1/N Height", 4, 1, 10, 0.5 );
Plot( Close, "Price",VColor, styleCandle |
styleThick );
Plot( V, " Volume", VColor, VStyle,
VHeight );
--- On Sat, 1/30/10, silon sama <u4my1986@xxxxxxxxx>
wrote:
From: silon sama <u4my1986@xxxxxxxxx>
Subject: Re: [amibroker] Re: Volume at the Bottom of the Chart
To: amibroker@xxxxxxxxxxxxxxx
Date: Saturday, January 30, 2010, 2:57 PM
can anybody send full code of this from section behgin
to section end
--- On Thu, 1/28/10, furinkazaan <furinkazaan@ gmail.com>
wrote:
From: furinkazaan <furinkazaan@ gmail.com>
Subject: Re: [amibroker] Re: Volume at the Bottom of the Chart
To: amibroker@xxxxxxxxx ps.com
Date: Thursday, January 28, 2010, 4:01 PM
Thanks Patrik, I enjoy this immensely. Here
is the assignment, turned in: I plot it, it works. Will now figure out how
to copy images to these mails.
// HighVolume PaintBar
//defaultColor = IIf(C>Ref(C, -1), colorGreen, colorRed);
HighVolColor = IIf(V> MA(V, 20), colorBlue, colorBlack);
Plot(Close, "HighVolBar" , HighVolColor, styleCandle, styleThick)
;
As you can see, I tried defining the default color for the false condition,
then realise its not necessary since default colors are set in the
preferences anyway.
best,
eswar
2010/1/28 NW Trader <ta4charts@xxxxxxxx net>
OK!! Structure is good -- it
keeps us on task and generally we learn in a progressive,
linear manner, rather than by bouncing all over (though insight and
"Ah Ha" moments have their place).
Now for a "homework"
assignment if you are interested -- try changing the color of the candle
outline depending on whether the volume is above or below the 20 day moving
average of the volume. It's not hard, but you will learn a bit more
about the plot statement and what you can visually display on a chart
without having an extensive title statement.
Peace and Justice
--- Patrick
----- Original Message -----
To: amibroker@xxxxxxxxx ps.com
Sent: Thursday, January 28, 2010 1:08
AM
Subject: Re: [amibroker]
Re: Volume at the Bottom of the Chart
Thanks
Patrik, for your encouragement. My AFL learning effort hasnt been quite
structured and your suggestion of the right approach helps.
I incorporate color coding for the price plot as well by adapting your
code. Thanks again.
------------ --------- --------- --------- --------- --------- ---------
--------
//Codename = "Price Volume - 4 Color"
// Color Conditions
Upgreen = C > Ref( C, -1 ) AND C > O ;
DownRed = C <= Ref( C, -1 ) AND C < O;
UpBlack = C > Ref( C, -1 ) AND C < O;
DownBlue = C <= Ref( C, -1 ) AND C > O;
VColor = IIf( UpGreen, colorGreen, IIf( DownRed, colorRed, IIf( UpBlack,
colorBlack, colorBlue ) ) );
VStyle = ParamStyle( "Volume Style", styleHistogram |
styleOwnScale | styleThick | styleNoLabel, maskHistogram ) ;
VHeight = Param( "1/N Height", 4, 1, 10, 0.5 );
Plot( Close, "Price",VColor, styleCandle | styleThick );
Plot( V, " Volume", VColor, VStyle, VHeight );
2010/1/28 NW Trader
<ta4charts@xxxxxxxx net>
Great!!! -- we all have
been at the beginning at one time or another. If I know anything,
it's because others were willing to help me initially and I studied their
efforts. I actually started on other platforms (notably QP, TC2000,
eSignal, MS and TS). With more than 10 years of AB behind me, I
rarely use any of those others now (never for MS and TS) and try to boost
others in the use of AB. My real disappointment (and the reason I've
been largely absent from this group for the past couple years) is the
increasing unwillingness of new users to try to learn the basics of
afl while expecting others to write their code for them. Too
often folks start AB in the morning and without learning how to code an indicator,
want to write a complicated system to backtest with custom metrics by
noon. You were able to articulate what you wanted, and would have
figured it out before long -- next time you will be further along and ask
fewer basic questions, I have no doubt. And do not overlook the stock code,
the library and the knowledge base for examples of how to do
things.
My humble suggestion (though
I'm sure others may differ) is to first learn how to code your
indicator/system on a chart. Then learn how to write an exploration
to find buy/short and sell/cover trades. Then learn how to backtest,
optimize, add email alerts, scan in real time, etc. All of this takes
time and effort, but it is well worth it. A friend of mine (and
long time AB user too) has compared AB to an onion with many layers
that can be peeled back to expose more and more capability. I agree.
Tomasz has built a marvelous device. Keep on codin' !!!
Peace
and Justice --- Patrick
----- Original Message -----
To: amibroker@xxxxxxxxx ps.com
Sent: Wednesday, January 27, 2010 11:51
PM
Subject: Re: [amibroker]
Re: Volume at the Bottom of the Chart
Thanks
Patrik, and sorry about taking the easy way out! I do bumble along and try
do my own coding as much as I can. Your post and advice however is very
inspiring. The code works fine. Tx.
2010/1/28 NW Trader
<ta4charts@xxxxxxxx net>
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 -----
To: amibroker@xxxxxxxxx ps.com
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@xxxxxxxx. au>
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@xxxxxxxxx ps.com, "Mike" <sfclimbers@x ..>
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@xxxxxxxxx ps.com, "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@xxxxxxxxx ps.com, "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@xxxxxxxxx ps.com, "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@xxxxxxxxx ps.com, 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@xxxxxxxxx ps.com,
"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@xxxxxxxxx ps.com,
"osp2osp"<osp2osp@> wrote:
> > > > > >>
> > > > > >>>
> > > > > >>> Hi,
> > > > > >>>
> > > > > >>> Thanks for the reply. I tried that
already.
> > > > > >>>
> > > > > >>> Plot(Volume, "",MyVolCol,
styleOwnS cale+styleHistog ram,0,20) ;
> > > > > >>>
> > > > > >>> Not getting the desired the results.
> > > > > >>>
> > > > > >>> Thank You Very Much.
> > > > > >>>
> > > > > >>> Regards.
> > > > > >>>
> > > > > >>> --- In amibroker@xxxxxxxxx ps.com,
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, styleOwnS cale+styleHistog ram);
> > > > > >>>>>
> > > > > >>>>> 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.amibroke r.com/feedback/
> > > > > > (submissions sent via other channels won't be
considered)
> > > > > >
> > > > > > For NEW RELEASE ANNOUNCEMENTS and other news
always check DEVLOG:
> > > > > > http://www.amibroke r.com/devlog/
> > > > > >
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
|
|
No virus
found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.733 / Virus Database: 271.1.1/2656 - Release Date: 01/29/10
13:35:00
__._,_.___
**** 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/
__,_._,___
|