searched for. I shall now try to do an Exploration.
Thanks again for your help.
Peter
--- In [email protected], "Steve Dugas" <[EMAIL PROTECTED]> wrote:
>
> Hi Peter,
>
> Sorry about that, I thought your question was about how to plot. I
looked at
> your code and it looks like what you are trying to do is find and
plot the
> shortest-period MA that remains below the price for the last year -
is this
> correct? If so, you could try something like this (untested):
>
> found = 0;
> For( pd = 2; pd < 253 AND NOT found, pd++ )
> {
> CurrentMA = MA( Close, pd );
> PriceBelowMA = Close < CurrentMA;
> BarsBelowMA = Sum( PriceBelowMA, 252 );
> If ( BarsBelowMA[BarCount-1] == 0 )
> Found = True; // break out of loop
> }
> If ( Found )
> Plot( CurrentMA, NumToStr( pd, 1.0 ) + " pd MA", colorBlue,
styleLine );
> Else
> Plot( 0, "No MA Meets Criteria", 0, styleNoLine|styleNoLabel );
>
> Steve
>
> ----- Original Message -----
> From: "peterjldyke" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, May 12, 2006 2:29 AM
> Subject: [amibroker] Re: Plot of MA Loop
>
>
> > Thanks Steve for your response. I am reasonably familiar with the
> > normal Plot() and AddColumn features. Evidently, what I want to
> > achieve is not possible unless a loop is used. I have no
experience
> > with loops and find the available Amibroker (and elsewhere)
> > explanations very confusing. I have asked Support but I don't
think
> > I have been able to explain my problems properly as their
response
> > has only confused me more.
> >
> > My difficulty is with Loops and plotting information from within
the
> > loop,in this case,e.g. the "Cma". I have tried numerous
variations
> > without success, such as;
> > Plot(Cma,"Cma",colorYellow);
> > I think the problem is the actual wording of the Plot() statement
> > and the AB Help files,that I have studied, don't show how to
access
> > the information.Could you please put me on the right track?
> > Peter
> >
> > --- In [email protected], "Steve Dugas" <sjdugas@> wrote:
> >>
> >> To be able to plot a chart, you need to use the Plot() function
at
> > the end
> >> of your code. See the help file for details on Plot(). When that
> > is done,
> >> plot a built-in price chart by finding it under the charts tab
on
> > the left
> >> and double-clicking on it. Then find your code for MA under the
> > charts tab,
> >> drag it and drop it on the price chart.
> >>
> >> To show a column in the exploration results, you need to use
> > either
> >> AddColumn or AddTextColumn functions in your code. Again, see
the
> > help file
> >> for details. Also, read the tutorials in the help file.
> >>
> >> Steve
> >>
> >> ----- Original Message -----
> >> From: "peterjldyke" <peterjldyke@>
> >> To: <[email protected]>
> >> Sent: Thursday, May 11, 2006 12:27 AM
> >> Subject: [amibroker] Plot of MA Loop
> >>
> >>
> >> > 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
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 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
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
>
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
SPONSORED LINKS
| Investment management software | Real estate investment software | Investment property software |
| Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
