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

[amibroker] Plot of MA Loop



PureBytes Links

Trading Reference Links

The following was supplied to another user in answer to a previous 
post. I have limited knowledge of loops etc so need help. The aim is 
to have the afl calculate a Moving Average that "sits" just below 12 
months (say 252 days) price action without the Close crossing below 
the computer calculated MA period. Only interested in strong 
uptrending stocks.    
I can't work out how to Plot the result or use the Explore feature 
to print out the result. 

function CheckMACross( period, Lookback ) 
 { 
   result = False; 
 
   Cma = MA( C, period ); 
 
   bar = BarCount - 1 - Lookback; //Max bars less Lookback.
 
   if( Close[ bar  ] < Cma[ bar ] ) 
   { 
     while( bar < BarCount ) 
     { 
        if( Close[ bar ] > Cma[ bar ] ) 
       { 
          result = True; 
     } 
 
       bar++;
     } 
   } 
 
   return result;
 

 } 
 
 function WCBelowMALine() 
 { 
  found = False; 
 
  for ( period = 1; period <= 252 AND NOT found; period++) 
  { 
     found = CheckMACross( period, 252 );    
  } 
  return period; 


What AA column headings do I use to get an  "Exploration" of the 
Close and the calculated MA?
How can I amend the above to get a Candlestick plot of the Close as 
well as a plot of the calculated MA?

Any help would be appreciated.
Peter 







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/