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

[amibroker] CAPP metastock conversion



PureBytes Links

Trading Reference Links



I am trying to change the following Metastock Close Above  Prev Peak 
formula to Amibroker

STUT := H > Ref(H, -1) AND 
Ref(H, -1) > Ref(H, -2); 

STDT := L < Ref(L, -1) AND 
Ref(L, -1) < Ref(L, -2); 

PPeak := If(STDT = 1, 
HighestSince(1, STUT, H), PREV); 

PPeak; 

CAPP := If( C > PPeak, 1, 0);

I have got part of it as below but need help with some of it. I have 
had a look at  Cross( Close,Peak(High,3,1)) but I want to define the 
peak as the highest point between a short term uptrend and a short 
term down trend. A short term uptrend occurs if the price breaks the 
previous days high on 2 consecutive days (ie 2 consec' days of higher 
highs). A short term downtrend is where the price breaks the previous 
days low on 2 consecutive days (ie 2 consec days of lower lows).
 Once the 2 consec HH or LL occur the price and  the trend continues 
to rise or fall  until a change of trend occurs. 
   Thanks in advance   Phill.



STUT=  High > Ref(High,-1) AND Ref(High,-1) > Ref(High,-2);
STDT = Low < Ref(Low,-1) AND Ref(Low,-1) < Ref(Low,2);
Ppeak =IIf(STDT = 1,HighestSince(STUT,High,1),Ref(STDT,-1));
Cross(Close,Ref(Ppeak,-1));






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/