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

RE: [amibroker] Data from TC2000 Problem ??



PureBytes Links

Trading Reference Links




<SPAN 
class=033575702-05022004>Hi Albert, here's an untested 
sketch:
<SPAN 
class=033575702-05022004> 
<SPAN 
class=033575702-05022004>MAPeriod = 21;
<SPAN 
class=033575702-05022004>M = MA(C, MAPeriod);
<SPAN 
class=033575702-05022004>BarsAboveMA = BarsSince(Cross(C, 
M));
<SPAN 
class=033575702-05022004>Color =
<SPAN 
class=033575702-05022004>    IIf(C <= M, 
colorDefault,
<SPAN 
class=033575702-05022004>    IIf(<SPAN 
class=033575702-05022004>BarsAboveMA >= 20, 
colorRed,
<SPAN 
class=033575702-05022004>    
IIf(BarsAboveMA >= 10, 
colorYellow,
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>    IIf(<SPAN 
class=033575702-05022004>BarsAboveMA >= 5, 
colorGreen,
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>    <SPAN 
class=033575702-05022004>colorBlue<FONT 
face="Courier New" color=#0000ff size=2><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>))));
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>Plot(C, "Close", Color, 
styleBar);
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004> 
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>Make sense? Anything like what you're after? If you 
like, you could use Param statements to make the MA period and each threshold 
adjustable without changing the 
code.
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004> 
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>One key thing to get as you're starting out w AFL is 
that many operations work on entire arrays at once. This means that in many 
cases, you don't need any looping or other bar-by-bar constructs. For example, 
BarsAboveMA is an array, where each bar's data is the number of bars since Close 
was above the MA, and that entire array was built without looping, in one 
line of code.
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004> 
<SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004><SPAN 
class=033575702-05022004>Dave
<BLOCKQUOTE 
>Can 
  someone point me in the right direction on developing an indicator that 
  can highlight sections of a chart that's above an MA?I'm also hoping 
  to be able to set criteria of highlighting secitions of the chart that are 
  X number of days above the MA, and that X number can vary or even be 
  different numbers with different numbers being highlighted as different 
  colours. eg. 10days=yellow, 8days=purple, etc.I'm looking into 
  AFL, and it looks like I would need to do it by using a starting reference 
  time which crossed MA and then looping forwards or backwards in time until 
  the next time it crosses. This would be the obvious solution of doing 
  this.Any assistance would be greatly 
appreciated.Albert


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 the Yahoo! Terms of Service.