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

[amibroker] Re: Need help to convert MS code to AFL



PureBytes Links

Trading Reference Links

Here is the code adapted to Amibroker, please note that i did not
verified the result. The code for Metastock is a example of what a
skilled guy can do with Metastock (Jose Silva), however this is the
limit of metastock, with amibroker however you can do much more and
things like this much more easier. I dont have installed metastock
anymore so i could not check to see if the plot matches but it should
because the functions result is the same. 

prm=Param("Plot",1,1,2,1);
start=TroughBars(C,5,1)==0;
end=PeakBars(C,5,1)==0;
value=V;
init=Cum(IsTrue(start+end))==1;
flag=ValueWhen(start-end!=0 OR init,start,1);
start=flag*(Hold(flag==0,2) OR start*Cum(start)==1);
end=(flag==0)*(Hold(flag==1,2) OR end*Cum(end)==1);
acc=Cum(flag*value);
accVal=acc-ValueWhen(end,acc,1);

Plot(IIf(prm==1,accVal,start-end),WriteIf(prm==1,"accVal","start-end"),colorRed);

--- In amibroker@xxxxxxxxxxxxxxx, sAThya� <prassathya@xxx> wrote:
>
> hi,,, it seem no one has reponded my requested
> or pls advise how to to write this syntax in AFL AB platform
> init:=Cum(IsDefined(start+end))=1;
> flag:=ValueWhen(1,start-end<>0 OR init,start);
> start:=flag*(Alert(flag=0,2) OR end*Cum(end)=1);
> end� :=(flag=0)*(Alert(flag,2)�� OR start*Cum(start)=1);
> value:=V;
> acc:=Cum(flag*value);
> accVal:=acc-ValueWhen(1,end,acc);
> 
> Rgdz
> SAT
> �
> �
> { Signal/Value accumulator code in Metastock}
> Hi... Senior AFL Programer ,
> can anyone help me to convert this MS code to AB-AFL code.
> i ve tried but still found error.
> 
> ------------------------------------------------
> { Start count signal }
> start:=TroughBars(1,C,5)=0;
> { End count signal }
> end:=PeakBars(1,C,5)=0;
> { Value to accumulate - Volume }
> value:=V;
> { Indicator output choice }
> plot:=Input("plot:   [1]Accumulation,   [2]Signals",1,2,1);
> { Remove redundant interim start/end signals }
> init:=Cum(IsDefined(start+end))=1;
> flag:=ValueWhen(1,start-end<>0 OR init,start);
> start:=flag*(Alert(flag=0,2)
>   OR start*Cum(start)=1);
> end:=(flag=0)*(Alert(flag,2)
>   OR end*Cum(end)=1);
> { Accumulate values }
> acc:=Cum(flag*value);
> accVal:=acc-ValueWhen(1,end,acc);
> { Plot in own window }
> If(plot=1,accVal,start-end)
> -------------------------------------------------
> 
> Rgdz
> Sat
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/