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

Re: Candlestick graphstyle problem



PureBytes Links

Trading Reference Links

Thank you Jim and Tomasz. You found for me one of the dangers of 
translating code from a spreadsheet to AFL. I had fixed other 
references but missed that one. In the future, I need to take a bit 
more time and change those cell references to full names.

Thanks again,

Brett

--- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> Hello Brett,
> 
> 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@xxxx 
> 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=graph6styl
e=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.