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

[amibroker] Re: Basic line plot referencing earlier Bar - not working



PureBytes Links

Trading Reference Links

Hey Chris,

Thanks for naming the line after me. ;-)

I tried out your code, with a parameter of 5 and for some reason the Ozzy Lines are not plotting, even when the Close is clearly lower than the Low of 5 bars ago. This is what I pasted directly into a new AFL indicator:

SetChartOptions(0, chartShowArrows|chartShowDates);
  
_N(Title = StrFormat("{{INTERVAL}} {{DATE}} \n{{VALUES}}",
                      
O, H, L, C, V, SelectedValue(ROC(C, 1)) ));
  
Plot(C, "Close", colorBlack, styleThick|styleDots);
Plot(H, "High", colorBlue, styleLine);
Plot(L, "Low", colorRed, styleLine);

_SECTION_BEGIN("Ozzy's line");
Lastbarr =
LastValue(Cum(1) );//counts the number of bars.
startr =
Param("bars back", 5, 10, 100, 1);;//
endr =
1;// last bar is the barcount -1 because linearray works off barindex
// these points defining the line must be NUMBERS, not arrays.
x0 = Lastbarr - startr;
y0 =
L [ x0] ;//sets the numerical value of the low at x0.
x1 = Lastbarr - endr;
y1 =
C[x1];
Line =
LineArray(x0,y0,x1,y1, 0,1);
//Plot(Line,"",colorBlue,1);
if(y1 < y0)
{
Plot(Line,"", colorBlue,1);
}
Plot( IIf(C < Ref(L,-5), Line,Null),"",colorRed,1);
//Plot(C,"",colorBlack, 64);
_SECTION_END();


--- In amibroker@xxxxxxxxxxxxxxx, ChrisB <kris45mar@xxx> wrote:
>
> Hi there Ozzy
>
> This is something I have seems to work:
>
> See how you go:
>
> |_SECTION_BEGIN("Ozzy's line");
> Lastbarr = LastValue(Cum(1) );//counts the number of bars.
> startr = Param("bars back", 5, 10, 100, 1);;//
> endr = 1;// last bar is the barcount -1 because linearray works off
> barindex
> // these points defining the line must be NUMBERS, not arrays.
> x0 = Lastbarr - startr;
> y0 = *L* [ x0] ;//sets the numerical value of the low at x0.
> x1 = Lastbarr - endr;
> y1 = *C*[x1];
> Line = LineArray(x0,y0,x1,y1, 0,1);
> //Plot(Line,"",colorBlue,1);
> *if*(y1 < y0)
> {
> Plot(Line,"", *colorBlue*,1);
> }
> //Plot( IIf(C < Ref(L,-5), Line,Null),"",colorRed,1);
> Plot(*C*,"",*colorBlack*, 64);
> _SECTION_END();|
>
> Regards
>
> ChrisB
>
>
>
>
>
>
> ozzyapeman wrote:
> >
> > Hi, hoping someone can chime in on this basic line plot question. I
> > seem to be having a lot of basic plotting problems lately, on stuff
> > that I am sure should work.
> >
> > In this case, all I want to do is draw a line between the current
> > Close and the Low of 5 bars ago, if the current Close is lower than
> > that Low.
> >
> > This is what I have, but the lines do not plot. I'm also wondering if
> > I even need to use looping for this or if I can do it without loops.
> > Any input appreciated:
> >
> >
> > | SetChartOptions ( 0 , *chartShowArrows* | *chartShowDates* );
> > _N ( *Title* = StrFormat ( "{{INTERVAL} } {{DATE}} \n{{VALUES}} " ,
> > *O* , *H* , *L* , *C* , *V* , SelectedValue (
> > ROC ( *C* , 1 )) ));
> >
> > Plot ( *C* , "Close" , *colorBlack* , *styleThick* | *styleDots* );
> > Plot ( *H* , "High" , *colorBlue* , *styleLine* );
> > Plot ( *L* , "Low" , *colorRed* , *styleLine* );
> >
> >
> > // Any time that the current Close is lower than the *Low* of 5 bars
> > ago, then plot a
> > // red dashed line between those two prices.
> >
> > fb = Max ( Status ( "firstVisibleBar" ), 5 );
> > lb = Status ( "lastVisibleBar" );
> >
> > Low5 = Ref ( *L* , - 5 );
> > LineLow = *Null* ;
> >
> > *for* ( i = fb; i < lb; i++ )
> > {
> > *if* ( *C* [i] < Low5[i] )
> > {
> > LLow = LineArray (i, *C* [i], i- 5 , Low5[i] );
> > LineLow = IIf (! IsNull (LLow), LLow, LineLow);
> > }
> > }
> >
> > Plot (LineLow, "LineLow" , *colorRed* , *styleDashed* );
> > |
> >
> >
>
__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___