PureBytes Links
Trading Reference Links
|
If any of you feel free to tell me what I did wrong below, I will appreciate
it. I have never succeeded in modifying any of the
builtin AB indicators. Ron D
Johan, thanks for the code. I made a custom version of the
built-in price chart so I would not risk harming the built-in price chart.
Below, I have copied the custom duplicate Price Chart, with your code pasted in
above the <FONT
size=4>//--Indicator-End-- line as you instructed. I
have also copied the error message that I get when I click on
Apply.
I then
clicked on OK after viewing the error message, and this same error message
is the only thing that shows up in the indicator window. Somehow, this
added coding prevents the original portion of the built-in price window
from seeing whatever else that it needs to
see.
I looked in help for WRITEUPONSTOCK but could find no reference to it..
I am guessing that it would work if it were coded using WriteIf(
xxxxxxx). I will try to learn a little about this when I have more
time.
Ron D
This is the error below.
=======================================================
Line 20, Column 69:// (C)2002 amibroker.com
#include "C:\\program
files\amibroker\afl\include\writeuponstock.afl"--------------------------------------------------------------------^
#include error: File does not exist:'C:\\program
files\amibroker\afl\include\writeuponstock.afl'(current working directory is
'C:\Program Files\AmiBroker')
This is the pasted version done in a Custom Indicator
window,
<FONT
size=3>===============================================================================
btop = BBandTop(
C, Prefs(
4 ), <FONT
color=#0000ff size=4>Prefs(<FONT color=#ff00ff
size=4>8)/100<FONT
size=4> );
bbot = BBandBot(
C, Prefs<FONT
size=4>(4), <FONT
color=#0000ff size=4>Prefs(<FONT color=#ff00ff
size=4>8)/100<FONT
size=4> );
width = btop - bbot;
PctChange=100<FONT
size=4>*(width-Ref<FONT
size=4>(width,-1<FONT
size=4>))/Ref<FONT
size=4>(width,-1<FONT
size=4>);
Plot(PctChange,<FONT color=#ff00ff
size=4>"BwidthPctChg"<FONT
size=4>,colorBlack,styleNoDraw);
//--Indicator-End--<FONT
size=4>
// Above line instructs the parser that the code
// below is only for commentary/interpretation window
// This provides significant performance improvement
//
// (C)2002 amibroker.com
#include <FONT
color=#ff00ff size=4>"C:\\program
files\amibroker\afl\include\writeuponstock.afl";
movshort = MA(
C, Prefs<FONT
size=4>(4) );
movmed = MA( C,
Prefs(<FONT
color=#ff00ff size=4>6) );
movlong = MA( C,
Prefs(<FONT
color=#ff00ff size=4>28) );
btop = BBandTop(
C, Prefs(
4 ), <FONT
color=#0000ff size=4>Prefs(<FONT color=#ff00ff
size=4>8)/100<FONT
size=4> );
bbot = BBandBot(
C, Prefs<FONT
size=4>(4), <FONT
color=#0000ff size=4>Prefs(<FONT color=#ff00ff
size=4>8)/100<FONT
size=4> );
width = btop - bbot;
lslop = LinRegSlope(
C, 30 ) +
100;
lslo = LLV( lslop,
90 );
lshi = HHV( lslop,
90 );
lswidth = lshi - lslo;
trend = 100*( lslop -
lslo )/lswidth;
mawidth = MA( width,
100 );
relwidth = 100*(width -
mawidth)/mawidth;
_N( tname = <FONT color=#0000ff
size=4>Name()+<FONT color=#ff00ff
size=4>"("+<FONT color=#0000ff
size=4>FullName()+<FONT color=#ff00ff
size=4>")" );
"Price and moving averages:";
tname + " has closed "
+ WriteIf( C >
movshort, "above" ,
"below" ) + <FONT
color=#ff00ff size=4>" its short time moving average. "<FONT
size=4>;
"Short time moving average is currently " + <FONT
color=#0000ff size=4>WriteIf( movshort > movmed,
"above", <FONT
color=#ff00ff size=4>"below") + <FONT color=#ff00ff
size=4>" mid-time, and " + <FONT color=#0000ff
size=4>WriteIf( movshort > movlong, <FONT
color=#ff00ff size=4>"above", <FONT color=#ff00ff
size=4>"below" ) + " long
time moving averages.";<FONT color=#ff00ff
size=4>
"The relationship between price and moving averages is: "<FONT
size=4>+
WriteIf( C > movshort AND movshort >
movmed, "bullish"<FONT
size=4>,
WriteIf( C < movshort AND movshort <
movmed, "bearish",
"neutral" ) ) +
" in short-term, and "<FONT
size=4>+
WriteIf( movshort > movmed AND movmed >
movlong , "bullish"<FONT
size=4>,
WriteIf( movshort < movmed AND movmed <
movlong, "bearish",
"neutral" ) ) +
" in mid-long term. ";
"\nBollinger Bands:";
tname+ " has closed " +
WriteIf( C < bbot, <FONT color=#ff00ff
size=4>"below the lower band by " +<FONT
color=#0000ff size=4>
WriteVal( <FONT color=#ff00ff
size=4>100 *( bbot-C )/ width, <FONT
color=#ff00ff size=4>1.1 ) + <FONT color=#ff00ff
size=4>"%. " +
WriteIf( trend < <FONT color=#ff00ff
size=4>30, " This combined
with the steep downtrend can suggest that the downward trend in prices has a
good chance of continuing. However, a short-term pull-back inside the bands is
likely.",
WriteIf( trend > <FONT color=#ff00ff
size=4>30 AND trend < <FONT color=#ff00ff
size=4>70, "Although
prices have broken the lower band and a downside breakout is possible, the most
likely scenario for "+tname+<FONT color=#ff00ff
size=4>" is to continue within current trading range.",
"" ) ), <FONT
color=#ff00ff size=4>"" ) +<FONT color=#0000ff
size=4>
WriteIf( C > btop, <FONT color=#ff00ff
size=4>"above the upper band by " +<FONT
color=#0000ff size=4>
WriteVal( <FONT color=#ff00ff
size=4>100 *( C- btop )/ width, <FONT
color=#ff00ff size=4>1.1 ) + <FONT color=#ff00ff
size=4>"%. " +
WriteIf( trend > <FONT color=#ff00ff
size=4>70, " This combined
with the steep uptrend suggests that the upward trend in prices has a good
chance of continuing. However, a short-term pull-back inside the bands is
likely.",
WriteIf( trend > <FONT color=#ff00ff
size=4>30 AND trend < <FONT color=#ff00ff
size=4>70, "Although
prices have broken the upper band and a upside breakout is possible, the most
likely scenario for "+tname+<FONT color=#ff00ff
size=4>" is to continue within current trading range.",
"" ) ), <FONT
color=#ff00ff size=4>"" ) +<FONT color=#0000ff
size=4>
WriteIf( C < btop AND ( ( btop -
C ) / width ) < 0.5<FONT
size=4>,
"below upper band by " +<FONT color=#0000ff
size=4>
WriteVal( <FONT color=#ff00ff
size=4>100 *( btop - C )/ width, <FONT
color=#ff00ff size=4>1.1 ) + <FONT color=#ff00ff
size=4>"%. ",
WriteIf( C < btop AND C > bbot
, "above bottom band by "
+
WriteVal( <FONT color=#ff00ff
size=4>100 *( C - bbot )/ width, <FONT
color=#ff00ff size=4>1.1 ) + <FONT color=#ff00ff
size=4>"%. ", <FONT color=#ff00ff
size=4>"" ) );
WriteIf( ( trend > <FONT color=#ff00ff
size=4>30 AND trend < <FONT color=#ff00ff
size=4>70 AND ( C > btop OR C
< bbot ) ) AND abs<FONT
size=4>(relwidth) > 40<FONT
size=4>,
"This picture becomes somewhat unclear due
to the fact that Bollinger Bands are currently",
"Bollinger Bands are "
)+
WriteVal( <FONT color=#0000ff
size=4>abs( relwidth ), <FONT color=#ff00ff
size=4>1.1 ) + "%
" +
WriteIf( relwidth > <FONT color=#ff00ff
size=4>0, <FONT color=#ff00ff
size=4>"wider" , <FONT color=#ff00ff
size=4>"narrower" ) +
" than normal.";
WriteIf( <FONT color=#0000ff
size=4>abs( relwidth ) < <FONT color=#ff00ff
size=4>40, "The current
width of the bands (alone) does not suggest anything conclusive about the future
volatility or movement of prices.",<FONT
color=#ff00ff size=4>"")+<FONT color=#0000ff
size=4>
WriteIf( relwidth < -<FONT color=#ff00ff
size=4>40, "The narrow
width of the bands suggests low volatility as compared to "
+ tname + "'s normal range. Therefore, the
probability of volatility increasing with a sharp price move has increased for
the near-term. "+
"The bands have been in this narrow range for " +
WriteVal(<FONT
color=#0000ff size=4>BarsSince(<FONT color=#0000ff
size=4>Cross(-<FONT color=#ff00ff
size=4>40,relwidth)),<FONT color=#ff00ff
size=4>1.0) + " bars. The
probability of a significant price move increases the longer the bands remain in
this narrow range." ,<FONT color=#ff00ff
size=4>"")+
WriteIf( relwidth > <FONT color=#ff00ff
size=4>40, "The large
width of the bands suggest high volatility as compared to "
+ tname + "'s normal range. Therefore, the
probability of volatility decreasing and prices entering (or remaining in) a
trading range has increased for the near-term. "<FONT
size=4>+
"The bands have been in this wide range for " +
WriteVal(<FONT
color=#0000ff size=4>BarsSince(<FONT color=#0000ff
size=4>Cross(relwidth,<FONT color=#ff00ff
size=4>40)),<FONT color=#ff00ff
size=4>1.0) + " bars.The
probability of prices consolidating into a less volatile trading range increases
the longer the bands remain in this wide range."
,"");<FONT
color=#ff00ff size=4>
"\nThis commentary is not a recommendation to buy or sell. Use at your own
risk.";
<FONT
size=3>
<FONT
face=Arial>===========================================================================
----- Original Message -----
<BLOCKQUOTE
>
<DIV
>From:
johsun
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, April 13, 2004 2:32
PM
Subject: [amibroker] Re: Modify Price
Chart
Hello,just past the code below (I made some changes to the plot
statement)*above* the first line in main price chart code, the one that
says //--Indicator-End--.btop = BBandTop( C, Prefs( 4 ),
Prefs(8)/100 );bbot = BBandBot( C, Prefs(4), Prefs(8)/100
);width = btop -
bbot;PctChange=100*(width-Ref(width,-1))/Ref(width,-1);Plot(PctChange,"BwidthPctChg",colorBlack,styleNoDraw);Johan---
In amibroker@xxxxxxxxxxxxxxx,
"mrdavis9" <mrdavis9@x...>
wrote:> All I really want to do is to add to the built-in Price Chart
popup menu so that it will show this "BwidthPctChg" value at the
bottom of the menu.> > I have never tried to modify the main
price chart. I looked at the coding in it, and it is way
beyond what I do right now. I have other things I am working on
right now, so I don't want to stop what I am doing in order to learn all
about the coding in the price chart. It appears that you are supposed to
somehow make the output from all of those WriteIf(statements) appear
in the commentary window, which I have yet to feel the need to
use.> > I copied the built-in price code to a custom indicator,
deleted most of it, and then added the below modification to it, and it
works, but I would sure like to have this function available in the
built-in price chart. BTW, in this custom version, the
Bollinger bands ended up being super close together, even before I
multiplied by 100 for the last plot(statement).> > I sure
would appreciate it if a kind soul would post the completed modification,
and instruct me how to install it into the main price chart so that it
will appear in the popup menu. I assume it involves those writeif()
functions that I see in the code, which I have also never used.
later, Ron D> > movshort = MA( C, Prefs(4) );> >
movmed = MA( C, Prefs(6) );> > movlong = MA( C, Prefs(28)
);> > btop = BBandTop( C, Prefs( 4 ), Prefs(8)/100 );>
> bbot = BBandBot( C, Prefs(4), Prefs(8)/100 );> > width
= btop - bbot;> >
PctChange=(width-Ref(width,-1))/Ref(width,-1);> >
Plot(btop,"Btop",colorBlack,styleLine);> >
Plot(bbot,"Bbot",colorBlack,styleLine);> >
Plot(width,"Bwidth",colorBlack,styleNoLine,styleOwnScale);> >
Plot(PctChange*100,"BwidthPctChg",colorBlack,styleNoLine,styleOwnScale);>
> > > > ---> Outgoing mail is certified
Virus Free.> Checked by AVG anti-virus system (<A
href="">http://www.grisoft.com).> Version:
6.0.656 / Virus Database: 421 - Release Date:
4/10/2004------------------------ Yahoo! Groups Sponsor
---------------------~-->Buy Ink Cartridges or Refill Kits for your HP,
Epson, Canon or LexmarkPrinter at MyInks.com. Free s/h on orders $50
or more to the US & Canada.<A
href="">http://www.c1tracking.com/l.asp?cid=5511<A
href="">http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM---------------------------------------------------------------------~->Send
BUG REPORTS to <A
href="">bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
<A
href="">suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: <A
href="">amiquote@xxxxxxxxxxxxxxx (Web
page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links<*> To visit your group on the web, go
to: <A
href="">http://groups.yahoo.com/group/amibroker/<*>
To unsubscribe from this group, send an email to:
<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx<*>
Your use of Yahoo! Groups is subject to: <A
href="">http://docs.yahoo.com/info/terms/
---Outgoing mail is certified Virus Free.Checked by AVG
anti-virus system (<A
href="">http://www.grisoft.com).Version: 6.0.656
/ Virus Database: 421 - Release Date: 4/10/2004
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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 the Yahoo! Terms of Service.
|