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

[amibroker] Re: Changeing Code from [graph0, graph1] To Plot.



PureBytes Links

Trading Reference Links

The bar color can be changed on a bar by bar basis. I believe you were
on the right track.
Here is an indicator that I created which tried to duplicate the way
that Stockcharts.com colors their candles.

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC(
C, 1 ) ) ));

WC = C >= Ref(C,-1) AND C >= O;
BC = C >= Ref(C,-1) AND C < O;
RC = C < Ref(C,-1) AND C <= O;
OC = C < Ref(C,-1) AND C > O;
CandleColor = IIf(WC,55, IIf(BC,16,IIf(RC,32,25)));

Plot( C, "Close", CandleColor, styleNoTitle | ParamStyle("Style") |
GetPriceStyle() ); 
_SECTION_END();
/*
Rule # 1: 
"Hollow White Candle"  
Close today >= Close yesterday and Close today >= Open
C >= Ref(C,-1) AND C >= O

Rule # 2:  
"Filled Red Candle"    
Close today <= Close yesterday  
C < Ref(C,-1) AND C <= O

Rule # 3:  
"Black Candle"  Opens bullishly but closes bearishly
Close today >= Close yesterday and closes today lower than the open.  
C >= Ref(C,-1) AND C < O

Rule # 4:  
"Hollow Red Candle"  Opens bearishly but closes bullishly.
Open today below yesterdays close and closes today higher than the open.  
C < Ref(C,-1) AND C > O

*/
I think you can get ideas from this to achieve what you are looking for.

Trade well,
MM

--- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@xxx> wrote:
>
> If you want to conquer AFL you have to follow the "rules" which
include using the syntax as provided without modification.  No ifs,
ands, or buts.  The link given before takes you to the plot() webpage
where allowed styles for plot() are defined.  Note that "style" as you
used it in your code is not an allowed style - you can only use the
styles that are listed.  As for colors, there is only one color
section in plot() not two as you used for upcolor and downcolor.  In
addition, as you defined them these colors are for price bars not
wilders().  The following I think is more or less what you are after.
> 
> plot(c, "", barcolor, stylebar (or any style that you want));
> plot(wilders(var4, 5), "", colorred, stylehistogram|stylethick);
> 
> Bill
> 
> ----- Original Message ----- 
> From: "Mohammed" <softnews2003@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, February 26, 2008 10:28 PM
> Subject: [amibroker] Re: Changeing Code from [graph0, graph1] To Plot.
> 
> 
> >I use:
> > 
> > UpColor = colorLime;
> > DownColor = colorBlue;
> > StochDColor = colorRed;
> > style = styleLine;
> > 
> > 
> > 
> > outsidebar = Outside();
> > insidebar = H <= Ref(H,-1) AND L >= Ref(L,-1);
> > upbar = H > Ref(H,-1) AND L >= Ref(L, -1);
> > downbar = L < Ref(L,-1) AND H <= Ref(H,-1);
> > barcolor=IIf(outsidebar, 1, 
> >               IIf(downbar,   4, 
> >               IIf(upbar,        5, 
> >               IIf(insidebar,6, 0 ) ) ) );
> > 
> > var1=MA( Avg , 34);
> > var2=MA( Avg ,5);
> > var3=var2-var1;
> > var4=var3-MA(var3,5);
> > Graph0=var4;
> > Graph0Style=2+4;
> > //Graph1=Wilders(var4,5);
> > Plot( Wilders(var4,5),  _DEFAULT_NAME(), UpColor , DownColor , 
> > Style );
> > 
> > Thanks
> > 
> > 
> > 
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@> 
> > wrote:
> >>
> >> What code did you use for Plot()?
> >> 
> >> ----- Original Message ----- 
> >> From: "Mohammed" <softnews2003@>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Tuesday, February 26, 2008 10:18 PM
> >> Subject: [amibroker] Re: Changeing Code from [graph0, graph1] To 
> > Plot.
> >> 
> >> 
> >> > Hello wavemechanic,
> >> > 
> >> > Yes I Do, I post my request after I try it, it plotted the 
> > indicator 
> >> > as a line, I try to change the style to style Histogram, but that 
> >> > didn't work.
> >> > 
> >> > Please help.
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > --- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@> 
> >> > wrote:
> >> >>
> >> >> Have you tried to use Plot()?  What do you get?
> >> >> 
> >> >> http://www.amibroker.com/guide/afl/afl_view.php?id=114
> >> >> 
> >> >>   ----- Original Message ----- 
> >> >>   From: Mohammed 
> >> >>   To: amibroker@xxxxxxxxxxxxxxx 
> >> >>   Sent: Tuesday, February 26, 2008 3:42 PM
> >> >>   Subject: [amibroker] Changeing Code from [graph0, graph1] To 
> > Plot.
> >> >> 
> >> >> 
> >> >>   Hi all,
> >> >> 
> >> >> 
> >> >> 
> >> >>   Please any one can help to change the following code, 
> >> >> 
> >> >> 
> >> >> 
> >> >>   outsidebar = Outside();
> >> >> 
> >> >>   insidebar = H <= Ref(H,-1) AND L >= Ref(L,-1);
> >> >> 
> >> >>   upbar = H > Ref(H,-1) AND L >= Ref(L, -1);
> >> >> 
> >> >>   downbar = L < Ref(L,-1) AND H <= Ref(H,-1);
> >> >> 
> >> >>   barcolor=IIf(outsidebar, 1, 
> >> >> 
> >> >>                  IIf(downbar,   4, 
> >> >> 
> >> >>                  IIf(upbar,        5, 
> >> >> 
> >> >>                  IIf(insidebar,6, 0 ) ) ) );
> >> >> 
> >> >> 
> >> >> 
> >> >>   var1=MA( Avg , 34);
> >> >> 
> >> >>   var2=MA( Avg ,5);
> >> >> 
> >> >>   var3=var2-var1;
> >> >> 
> >> >>   var4=var3-MA(var3,5);
> >> >> 
> >> >>   Graph0=var4;
> >> >> 
> >> >>   Graph0Style=2+4;
> >> >> 
> >> >>   Graph1=Wilders(var4,5);
> >> >> 
> >> >>   Graph1Style=5;
> >> >> 
> >> >>   Graph0BarColor=Barcolor;
> >> >> 
> >> >> 
> >> >> 
> >> >>    I would like to use (Plot) function instead of (graph0, 
> > graph1).
> >> >> 
> >> >> 
> >> >> 
> >> >>   Thank you an advance.
> >> >> 
> >> >> 
> >> >> 
> >> >>   Regards
> >> >> 
> >> >>    
> >> >> 
> >> >> 
> >> >> -----------------------------------------------------------------
> > ---
> >> > ----------
> >> >> 
> >> >> 
> >> >>   No virus found in this incoming message.
> >> >>   Checked by AVG Free Edition. 
> >> >>   Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release 
> > Date: 
> >> > 2/26/2008 9:08 AM
> >> >>
> >> > 
> >> > 
> >> > 
> >> > 
> >> > Please note that this group is for discussion between users only.
> >> > 
> >> > To get support from AmiBroker please send an e-mail directly to 
> >> > SUPPORT {at} amibroker.com
> >> > 
> >> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> >> > http://www.amibroker.com/devlog/
> >> > 
> >> > For other support material please check also:
> >> > http://www.amibroker.com/support.html
> >> > 
> >> > Yahoo! Groups Links
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > -- 
> >> > No virus found in this incoming message.
> >> > Checked by AVG Free Edition. 
> >> > Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 
> > 2/26/2008 9:08 AM
> >> > 
> >> >
> >>
> > 
> > 
> > 
> > 
> > Please note that this group is for discussion between users only.
> > 
> > To get support from AmiBroker please send an e-mail directly to 
> > SUPPORT {at} amibroker.com
> > 
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > -- 
> > No virus found in this incoming message.
> > Checked by AVG Free Edition. 
> > Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date:
2/26/2008 9:08 AM
> > 
> >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/