PureBytes Links
Trading Reference Links
|
Hi Martin,
No Switch/Case, your code looks very good.
I think you will find, after using AB for a while, that it is not really "a
little lacking". It is not as tightly packaged as say, MS, but I still
remember using MS and how their "user friendliness" used to constantly lead
me straight into a brick wall whenever I wanted to try a new idea. I think
AB is deliberatley left at a little "lower level" because it offers much
more flexibility in the end. You will come to appreciate it!
Steve
PS - You forgot about LinearReg() andTSF() ! 8 - )
----- Original Message -----
From: "Martin Cooney" <martin@xxxxxxxxxxxxx>
To: "Amibroker General Forum" <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, February 04, 2006 4:07 AM
Subject: [amibroker] Multi MA with Shift
> Hi,
>
> I've posted the below code in case anyone else like me is starting out
> and notice some of the indicators installed by AB are a little lacking.
> Being used to Metatrader and now starting to use AB for a particular
> divergence strategy, I noticed I didn't readily have MA types with
> period shift. (Special thanks to Ara Kaloustian for his divergence
> indicator - powerful stuff)
>
> [1] I quickly coded the below and wondered if I could make improvements
> and/or cut down any on the repetition
>
> [2] Does AB have an equivalent of a SWITCH / CASE function which might
> cut down on the IF / ELSE statements as well as speed up the code ?
>
> ====code start====
> P = ParamField("Price field",-1);
> Periods = Param("Periods", 15, 2, 400, 1, 10 );
> MAType = ParamList("MA Type", "Simple MA|Exponential MA|Weighted
> MA|Wilder's Smoothing|Double EMA|Triple EMA" ,1);
> MAshift = Param( "Shift", 0, -25, 0, 1 );
>
> if (MAType == "Simple MA")
> {
> Plot( Ref(MA( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> else
> if (MAtype == "Exponential MA")
> {
> Plot( Ref(EMA( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> else
> if (MAType == "Weighted MA")
> {
> Plot( Ref(WMA( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> else
> if (MAType == "Wilder's Smoothing")
> {
> Plot( Ref(Wilders( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> else
> if (MAType == "Double EMA")
> {
> Plot( Ref(DEMA( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> else
> if (MAType == "Triple EMA")
> {
> Plot( Ref(TEMA( P, Periods ), MAshift), _DEFAULT_NAME(), ParamColor(
> "Color", colorCycle ), ParamStyle("Style") );
> }
> ====code end====
>
> Cheers
> Martin
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 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/
<*> 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/
|