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

RE: [amibroker] URGENT Help Needed



PureBytes Links

Trading Reference Links

Hello,

I am an AFL neophyte and have been working for some time learning 
AFL and how to use it in Amibroker.  I generally try to learn by 
following code which gives interesting results that seem to fit my 
trading style.  I appreciate the code for monthly swing highs and 
lows that I have attached. Unfortunately I lost the original message 
and cannot go back to the author with this question.  So I will post 
to the board and hope someone can either help with the problem or 
steer me to the author.

I am trying to look for stocks which have not moved much over the 
last several months.  So I want to explore for monthly highs and 
lows which are within $1 of the previous time period.  The code is 
as follows:

 //Swing Hi/Lo - use monthly for day charts

//Swing Hi: High with lower high on both sides

//Swing Low: Low with higher Low on both sides

PlotOHLC(Open,High,Low,Close,"",colorBlack,styleCandle); 

TimeFrameSet(inMonthly);

Res = High < Ref(High,-1) AND Ref(High,-1) > Ref(High,-2);

Sup = Low > Ref(Low,-1) AND Ref(Low,-1) < Ref(Low,-2);

MonthDate = ValueWhen(res,Month(),1)-1; // Month when Swing Hi 
occurs - provides correct value.

YearDate = ValueWhen(res,Year(),1);

MonBars = ValueWhen(res,BarIndex(),1);

MonthlyHigh = TimeFrameExpand(High,inMonthly,expandFirst); 

MonthlyLow = TimeFrameExpand(Low,inMonthly,expandFirst);

//Plot monthly High and Low values - OK

Plot(MonthlyHigh,"",colorAqua,1);

Plot(MonthlyLow,"",colorAqua,1);

TimeFrameRestore();

// The 2 lines below work OK. I have used numeric value (9) instead 
of Monthdate.

SW_High = ValueWhen(Month()==9/*Monthdate*/,Monthlyhigh,1);

SW_BarInx = ValueWhen(Month()==9/*Monthdate*/ AND 
High==SW_High,BarIndex(),1);

// These 2 lines below use the variable "Monthdate" that has the 
correct value (9) as printed in interpretation window, but does not 
provide correct value for SW_High

SW_High = ValueWhen(Month()==Monthdate,Monthlyhigh,1);

SW_BarInx = ValueWhen(Month()==Monthdate AND High==SW_High,BarIndex
(),1);

"Mon high " + WriteVal(Monthlyhigh,1.2);

"Mon Date " + WriteVal(MonthDate,1.0);

"Sel Date " +WriteVal(Month(),1.0);

"SW_High " + WriteVal(SW_High,1.2);

"SW_BarInx " + WriteVal(SW_BarInx,1.0);

"Bar Index " + WriteVal(BarIndex(),1.0);


What would the explore statement look like that would allow me to 
find stocks which have not moved much in the past n time periods ( 1 
to 3 months)

Thanks in advance for the help!!!

Michael Harrison



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 

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/