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

Re: [amibroker] Re: Candlestick graphstyle problem



PureBytes Links

Trading Reference Links

Jim is right: you overwrite L (Low) array in your formula. Just replace your L with L1 or so.
I have attached fixed formula to this e-mail.

Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com

----- Original Message ----- 
From: Brett Forrester 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Monday, July 09, 2001 10:07 PM
Subject: [amibroker] Re: Candlestick graphstyle problem


Tomasz,

I tried your suggestion but still basically have the same problem as before. Below is my code and attached is a screen shot showing the candles with long tails on the tops.

A = MA ( C, 21 );
SMA50 = MA ( C, 50);
I = ( C - A ) / A;
I50 = ( C - SMA50 ) / SMA50;
J = IIF ( I > 0, I * I, 0 );
J50 = IIF ( I50 > 0, I50 * I50, 0 );
K = IIF ( J > 0, 1, 0 );
K50 = IIF ( J50 > 0, 1, 0 );
L = SUM ( K, 185 );
L50 = SUM ( K50, 250);
M = IIF ( I < 0, I * I, 0 );
M50 = IIF ( I50 < 0, I50 * I50, 0 );
N = IIF ( M > 0, 1, 0 );
N50 = IIF ( M50 > 0, 1, 0 );
OO = SUM ( N, 185 );
OO50 = SUM ( N50, 250 );
P = 1.43933 * SQRT ( SUM ( J, 185 ) / L );
P50 = 1.645 * SQRT ( SUM ( J50, 250) / L50 );
Q = 1.43933 * SQRT ( SUM ( M,185 ) / OO );
Q50 = 1.645 * SQRT ( SUM ( M50,250 ) / OO50 );
R = MA (P , 21 );
R50 = MA (P50 , 21 );
S = MA (Q, 21 );
S50 = MA (Q50, 21 );

UPPER = ( 1 + R ) * A;
UPPERINT = ( 1 + R50 ) * SMA50;
LOWER = ( 1 - S ) * A;
LOWERINT = ( 1 - S50 ) * SMA50;

SMA90 = MA (close, 90 );
UpperBreakout = SMA90 + 15 * STDEV (SMA90, 21);
LowerBreakout = SMA90 - 15 * STDEV (SMA90, 21);

MAXGRAPH=9;
graph1=2*c;
graph0=upper;
graph2=lower;
GRAPH3=A;
GRAPH4=UPPERINT;
GRAPH5=LOWERINT;
graph6=UpperBreakout;
graph7=LowerBreakout;
GRAPH1STYLE=64;
GRAPH0STYLE=GRAPH2STYLE=GRAPH3STYLE=GRAPH4STYLE=GRAPH5STYLE=graph6style=graph7style=1;
graph0color=graph2color=9;
GRAPH4COLOR=GRAPH5COLOR=5;
graph1color=16;
graph6color=graph7color=4;
title= name() + " " + date() + " Price:" + writeval(close,.2) + " - Upper Bomar = " + writeval( graph0,.2 ) + ", Lower Bomar = " + writeval( graph2,.2 ) +
", 21MA = " + writeval(graph3,.2 ) + ", Upper Intermedite = " + writeval(graph4,.2 ) +", Lower Inermediate = " + writeval(graph5,.2 );

high=2*high;
low=2*low;
open=2*open;

Please excuse the colors as I am in the process of modifying some of the assignments and I have not completed the changes prior to this screen shot.

Thanks for your assistance again,

Brett

--- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> Dear Brett,
> 
> Please do not be afraid about your database.
> AFL formulas are safe because they operate on copies of the data
> so even if you modify the OHLC arrays in the AFL formula
> this wouldn't affect the database (unless you are using scripting and automation
> - but this is another story)
> 
> An example:
> 
> graph0 = 2 * close;
> graph0style = 64;
> graph0color = 2;
> high = 2 * high;
> low = 2 * low;
> open = 2 * open;
> 
> draws candlestick chart with doubled prices.
> 
> 
> Best regards,
> Tomasz Janeczko
> ===============
> AmiBroker - the comprehensive share manager.
> http://www.amibroker.com
> 
> ----- Original Message ----- 
> From: brett_f1@xxxx 
> To: amibroker@xxxx 
> Sent: Tuesday, July 03, 2001 1:07 AM
> Subject: [amibroker] Re: Candlestick graphstyle problem
> 
> 
> Yes I did/do realize the candles must also use the high, low and open 
> values in addition to the close I'm using. However, I incorrectly 
> assumed that these values would be read without me having to write 
> them into the code.
> 
> How do I OVERWRITE the High, Low and Open variables? I hesitate to 
> try this on my own as I've grown tired of restoring my databases 
> after other blunders I've made.
> 
> Regards,
> 
> Brett
> 
> 
> 
> --- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> > Hello Brett,
> > 
> > If you are using graphstype=64 you have to know that this style
> > uses indirectly High, Low and Open arrays. This is so because
> > candlesticks need 4 arrays to draw (not only one)
> > So it is not enough to write:
> > graph0 = something;
> > graph0style = 64;
> > 
> > but you have to OVERWRITE the High, Low and Open variables.
> > (the safest way is to do this at the end of the formula otherwise 
> built in functions
> > will operate on overwritten values)
> > 
> > Best regards,
> > Tomasz Janeczko
> > ===============
> > AmiBroker - the comprehensive share manager.
> > http://www.amibroker.com
> > 
> > ----- Original Message ----- 
> > From: brett_f1@xxxx 
> > To: amibroker@xxxx 
> > Sent: Saturday, June 30, 2001 6:45 PM
> > Subject: [amibroker] Candlestick graphstyle problem
> > 
> > 
> > I'm using geaphstyle=64 with some other graphs to overlay some 
> other 
> > indicators with and I'm having a problem with the end result of 
> the 
> > display. The candles appear with an outline color and long thin 
> tops 
> > from the body to the top of the chart. Has anyone else 
> experienced 
> > this type of problem and been able to fix it?
> > 
> > Brett
> > 
> > 
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service.
> 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------=_NextPart_001_006F_01C10918.136D9BA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Tahoma size=2>Hello Brett,</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>Jim is right: you&nbsp;overwrite L (Low) array in 
your formula. Just replace your L with L1 or so.</FONT></DIV>
<DIV><FONT face=Tahoma size=2>I have attached fixed formula to this 
e-mail.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>Best regards,<BR>Tomasz Janeczko<BR>===============<BR>AmiBroker - the 
comprehensive share manager.<BR><A 
href="http://www.amibroker.com";>http://www.amibroker.com</A><BR></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial ce">----- Original Message ----- </DIV>
<DIV 
style="BACKGROUND: #e4e4e4; FONT: 10pt arial ce; font-color: black"><B>From:</B> 
<A title=brett@xxxx href="mailto:brett@xxxx";>Brett 
Forrester</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>To:</B> <A title=amibroker@xxxxxxxxxxxxx 
href="mailto:amibroker@xxxxxxxxxxxxxxx";>amibroker@xxxxxxxxxxxxxxx</A> </DIV>
<DIV style="FONT: 10pt arial ce"><B>Sent:</B> Monday, July 09, 2001 10:07 
PM</DIV>
<DIV style="FONT: 10pt arial ce"><B>Subject:</B> [amibroker] Re: Candlestick 
graphstyle problem</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Tomasz,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I tried your suggestion but still basically have 
the same problem as before.&nbsp; Below is my code and attached is a screen 
shot showing the candles with long tails on the tops.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>A = MA ( C, 21 );<BR>SMA50 = MA ( C,50);<BR>I = 
( C - A ) / A;<BR>I50 = ( C - SMA50 ) / SMA50;<BR>J = IIF ( I &gt; 0,I * I, 0 
);<BR>J50 = IIF ( I50 &gt; 0, I50 * I50, 0 );<BR>K = IIF ( J &gt; 0, 1, 0 
);<BR>K50 = IIF ( J50 &gt; 0, 1, 0 );<BR>L = SUM ( K, 185 );<BR>L50 = SUM ( 
K50, 250);<BR>M = IIF ( I &lt; 0, I * I, 0 );<BR>M50 = IIF ( I50 &lt;0, I50 * 
I50, 0 );<BR>N = IIF ( M &gt; 0, 1, 0 );<BR>N50 = IIF ( M50 &gt; 0, 1, 0 
);<BR>OO = SUM ( N, 185 );<BR>OO50 = SUM ( N50, 250 );<BR>P = 1.43933 * SQRT ( 
SUM ( J, 185 ) / L );<BR>P50 = 1.645 * SQRT ( SUM ( J50, 250) / L50 );<BR>Q = 
1.43933 * SQRT ( SUM ( M,185 ) / OO );<BR>Q50 = 1.645 * SQRT ( SUM ( M50,250 ) 
/ OO50 );<BR>R = MA (P , 21 );<BR>R50 = MA (P50 , 21 );<BR>S = MA (Q, 21 
);<BR>S50 = MA (Q50, 21 );</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>UPPER = ( 1 + R ) * A;<BR>UPPERINT =( 1 + R50 ) 
* SMA50;<BR>LOWER = ( 1 - S ) * A;<BR>LOWERINT = ( 1 - S50 ) * 
SMA50;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>SMA90 = MA (close, 90 );<BR>UpperBreakout = SMA90 
+ 15 * STDEV (SMA90, 21);<BR>LowerBreakout = SMA90 - 15 * STDEV (SMA90, 
21);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>MAXGRAPH=9;<BR>graph1=2*c;<BR>graph0=upper;<BR>graph2=lower;<BR>GRAPH3=A;<BR>GRAPH4=UPPERINT;<BR>GRAPH5=LOWERINT;<BR>graph6=UpperBreakout;<BR>graph7=LowerBreakout;<BR>GRAPH1STYLE=64;<BR>GRAPH0STYLE=GRAPH2STYLE=GRAPH3STYLE=GRAPH4STYLE=GRAPH5STYLE=graph6style=graph7style=1;<BR>graph0color=graph2color=9;<BR>GRAPH4COLOR=GRAPH5COLOR=5;<BR>graph1color=16;<BR>graph6color=graph7color=4;<BR>title= 
name() + " " + date() + " Price:" + writeval(close,.2) + " - Upper Bomar = " + 
writeval( graph0,.2 ) + ", Lower Bomar = " + writeval( graph2,.2 ) 
+<BR>&nbsp;", 21MA = " + writeval(graph3,.2 ) + ", Upper Intermedite = " + 
writeval(graph4,.2 ) +", Lower Inermediate = " + writeval(graph5,.2 
);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>high=2*high;<BR>low=2*low;<BR>open=2*open;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Please excuse the colors as I am in the process 
of modifying some of the assignments and I have not completed the changes 
prior to this screen shot.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks for your assistance again,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Brett</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>--- In <A 
href="mailto:amibroker@xxxx";>amibroker@xxxx</A>..., "Tomasz Janeczko" &lt;<A 
href="mailto:tj@xxxx";>tj@xxxx</A>...&gt; wrote:<BR>&gt; Dear Brett,<BR>&gt; <BR>&gt; 
Please do not be afraid about your database.<BR>&gt; AFL formulas are safe 
because they operate on copies of the data<BR>&gt; so even if you modify the 
OHLC arrays in the AFL formula<BR>&gt; this wouldn't affect the database 
(unless you are using scripting and automation<BR>&gt; - but this is another 
story)<BR>&gt; <BR>&gt; An example:<BR>&gt; <BR>&gt; graph0 = 2 * 
close;<BR>&gt; graph0style = 64;<BR>&gt; graph0color = 2;<BR>&gt; high = 2 * 
high;<BR>&gt; low = 2 * low;<BR>&gt; open = 2 * open;<BR>&gt; <BR>&gt; draws 
candlestick chart with doubled prices.<BR>&gt; <BR>&gt; <BR>&gt; Best 
regards,<BR>&gt; Tomasz Janeczko<BR>&gt; ===============<BR>&gt; AmiBroker - 
the comprehensive share manager.<BR>&gt; <A 
href="http://www.amibroker.com";>http://www.amibroker.com</A><BR>&gt; 
<BR>&gt;&nbsp;&nbsp; ----- Original Message ----- <BR>&gt;&nbsp;&nbsp; From: 
brett_f1@xxxx... <BR>&gt;&nbsp;&nbsp; To: <A 
href="mailto:amibroker@xxxx";>amibroker@xxxx</A>... <BR>&gt;&nbsp;&nbsp; Sent: 
Tuesday, July 03, 2001 1:07 AM<BR>&gt;&nbsp;&nbsp; Subject: [amibroker] Re: 
Candlestick graphstyle problem<BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp; Yes I 
did/do realize the candles must also use the high, low and open 
<BR>&gt;&nbsp;&nbsp; values in addition to the close I'm using.&nbsp; However, 
I incorrectly <BR>&gt;&nbsp;&nbsp; assumed that these values would be read 
without me having to write <BR>&gt;&nbsp;&nbsp; them into the code.<BR>&gt; 
<BR>&gt;&nbsp;&nbsp; How do I OVERWRITE the High, Low and Open 
variables?&nbsp; I hesitate to <BR>&gt;&nbsp;&nbsp; try this on my own asI've 
grown tired of restoring my databases <BR>&gt;&nbsp;&nbsp; after other 
blunders I've made.<BR>&gt; <BR>&gt;&nbsp;&nbsp; Regards,<BR>&gt; 
<BR>&gt;&nbsp;&nbsp; Brett<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;--- 
In amibroker@xxxx..., "Tomasz Janeczko" &lt;<A 
href="mailto:tj@xxxx";>tj@xxxx</A>...&gt; wrote:<BR>&gt;&nbsp;&nbsp; &gt; Hello 
Brett,<BR>&gt;&nbsp;&nbsp; &gt; <BR>&gt;&nbsp;&nbsp; &gt; If you are using 
graphstype=64 you have to know that this style<BR>&gt;&nbsp;&nbsp; &gt;uses 
indirectly High, Low and Open arrays. This is so because<BR>&gt;&nbsp;&nbsp; 
&gt; candlesticks need 4 arrays to draw (not only one)<BR>&gt;&nbsp;&nbsp; 
&gt; So it is not enough to write:<BR>&gt;&nbsp;&nbsp; &gt; graph0 = 
something;<BR>&gt;&nbsp;&nbsp; &gt; graph0style = 64;<BR>&gt;&nbsp;&nbsp; &gt; 
<BR>&gt;&nbsp;&nbsp; &gt; but you have to OVERWRITE the High, Low and Open 
variables.<BR>&gt;&nbsp;&nbsp; &gt; (the safest way is to do this at the end 
of the formula otherwise <BR>&gt;&nbsp;&nbsp; built in 
functions<BR>&gt;&nbsp;&nbsp; &gt; will operate on overwritten 
values)<BR>&gt;&nbsp;&nbsp; &gt; <BR>&gt;&nbsp;&nbsp; &gt; Best 
regards,<BR>&gt;&nbsp;&nbsp; &gt; Tomasz Janeczko<BR>&gt;&nbsp;&nbsp; &gt; 
===============<BR>&gt;&nbsp;&nbsp; &gt; AmiBroker - the comprehensive share 
manager.<BR>&gt;&nbsp;&nbsp; &gt; <A 
href="http://www.amibroker.com";>http://www.amibroker.com</A><BR>&gt;&nbsp;&nbsp; 
&gt; <BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; ----- Original Message ----- 
<BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; From: <A 
href="mailto:brett_f1@xxxx";>brett_f1@xxxx</A>... <BR>&gt;&nbsp;&nbsp; 
&gt;&nbsp;&nbsp; To: amibroker@xxxx... 
<BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; Sent: Saturday, June 30, 2001 6:45 
PM<BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; Subject: [amibroker] Candlestick 
graphstyle problem<BR>&gt;&nbsp;&nbsp; &gt; <BR>&gt;&nbsp;&nbsp; &gt; 
<BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; I'm using geaphstyle=64 with someother 
graphs to overlay some <BR>&gt;&nbsp;&nbsp; other <BR>&gt;&nbsp;&nbsp; 
&gt;&nbsp;&nbsp; indicators with and I'm having a problem with the end result 
of <BR>&gt;&nbsp;&nbsp; the <BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; 
display.&nbsp; The candles appear with an outline color and long thin 
<BR>&gt;&nbsp;&nbsp; tops <BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; from the body 
to the top of the chart.&nbsp; Has anyone else <BR>&gt;&nbsp;&nbsp; 
experienced <BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; this type of problem and 
been able to fix it?<BR>&gt;&nbsp;&nbsp; &gt; <BR>&gt;&nbsp;&nbsp; 
&gt;&nbsp;&nbsp; Brett<BR>&gt;&nbsp;&nbsp; &gt; <BR>&gt;&nbsp;&nbsp; &gt; 
<BR>&gt;&nbsp;&nbsp; &gt;&nbsp;&nbsp; Your use of Yahoo! Groups is subject to 
the Yahoo! Terms of <BR>&gt;&nbsp;&nbsp; Service.<BR>&gt; <BR>&gt; 
<BR>&gt;&nbsp;&nbsp; Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service.</FONT></DIV><BR><TT>Your use of Yahoo! Groups is subject to the <A 
href="http://docs.yahoo.com/info/terms/";>Yahoo! Terms of Service</A>.</TT> 
<BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_001_006F_01C10918.136D9BA0--

Attachment:

Attachment: Description: "Description: Binary data"