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

[amibroker] Re: Help with formula- again...



PureBytes Links

Trading Reference Links

Hi, Harvey!
Thanks for your help!
I took this as an exercise, too, BTW you're pretty tough for 
somebody "learning" AFL!!
I had to replace median price by Avg, as I get a syntax error, 
otherwise it works...I just don't see any interest in this 
curve...but that's another story!
Thanks again!
Friendly,
Gilles

--- In amibroker@xxxxxxxxxxxxxxx, "harvey_1929" <Hhp@xxxx> wrote:
> Gilles,
> I'm learning AFL so I took a crack at it your code an exercise.  Re 
> your second message,'Prev' refers to the immediately previous value 
> of whatever comes before the equals sign - Bot or RMTA.  Because 
the 
> M'stk Prev function is very slow, AB works around it - seems to 
> accept Ref(xxx,-1) as long as it is initialized first, but I had to 
> guess at what values to use.  If I guessed wrong it should only 
> affect the very beginning of your data.  This code plots a line, 
but 
> it's not very pretty.  Changing the parameter Ty had no effect, 
> which worries me.  We'll see what the power users say.
> 
>  /*   ***   Recursive Moving Trend Average   ***   */
> 
> 
> Lb = Param("Look-Back Period?",21,3,100,1);
> Ty = Param("1=C 2=H 3=L 4=Median Price",1,1,4,1);
> 
> Bot = 0;//Initialize Bot
> RMTA = 0;//Initialize RMTA
> 
> MP = (H+L)/2;
> Tv = IIf(Ty=1,C,
> 		IIf(Ty=2,H,
> 			IIf(Ty=3,L,
> 				MP)));
> Alpha = 2/(Lb+1);
> Bot = (1-Alpha)*(IIf(Cum(1)<Lb,Tv,Ref(Bot,-1)))+Tv;
> RMTA = (1-Alpha)*(IIf(Cum(1)<Lb,Tv,Ref(RMTA,-1)))+(Alpha*(Tv+Bot-Ref
> (Bot,-1)));
> Plot(RMTA,"",colorRed,styleLine|styleNoLabel); GraphXSpace = 2;
> 
> Title = EncodeColor(colorBlack) + FullName() + "   [" + Name() 
> + "]    " + 
> WriteVal(DateTime(),formatDateTime) + 
> "\n" + EncodeColor(colorBrown) + "Recursive Moving Trend Average: " 
> + WriteVal(RMTA,1.2);
> //=====================================
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "gillesdeprez" 
<gillesdeprez@xxxx> 
> wrote:
> > Hello,
> > After fighting for hours, I give up after the fifth line, before 
I 
> > jump trhu the window, screaming! I know I jump often- I live on 
> the 
> > ground level.
> > If one of you knows MS and is kind enough to give me a hand...
> > "Recursive moving trend average"
> > Lb:=Input("Look-Back Period?",3,100,21);
> > Ty:=Input("1=C 2=H 3=L 4= Median Price",1,4,1);
> > Tv:=If(Ty=1,C,If(Ty=2,H,If(Ty=3,L,MP())));
> > Alpha:=2/(LB+1);
> > Bot:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+Tv;
> > RMTA:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+
> > (Alpha*(Tv+Bot-Ref(Bot,-1)));
> > RMTA
> > 
> > TIA!
> > Gilles


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

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