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

[amibroker] Momentum Divergence - Help Needed



PureBytes Links

Trading Reference Links

I am trying to find the momentum divergence, Please help me to fine 
tune the system

//Bullish Divergence
A1= LLVBars(C,28); //find when it reached 28 period trough
B1 = MA(Close - Ref(Close,-28),1); //get the momentum
C1=LLV(B1,28); //get the trough in momentum???
MML1= LLVBars(B1,28); //Number of bars it reached trough
D1= Ref(C,MML1 * -1); //Get the price for momentum trough bar
DD=IIf(A1=1 AND C < D1 AND B1 > C1 ,B1,0); 
/*if Price 28 period low is today and today price is less than 
momontum trogh bar price and todays momentum is greater than momentum 
trough*/

//Bearish Divergence
PH1= HHVBars(C,28);
MH1 =HHV(B1,28);
MMH1= HHVBars(B1,28);
PH2= Ref(C,MMH1 * -1);
DD2=IIf(PH1=1 AND C > PH2 AND B1 < MH1 ,C,0);

Buy=DD ;
Sell=DD2 ;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy); 
//It is assumed that transactions are made the next day after a 
buy/sell signal.
BuyPrice=ValueWhen(Ref(Buy,-1),Open,0);
SellPrice=ValueWhen(Ref(Sell,-1),Open,0);



------------------------ 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/