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

[amibroker] Re: Plotting Horizontal Grid Lines



PureBytes Links

Trading Reference Links

> You might take a look at the plotgrid() function
> 
>       SYNTAX  PlotGrid( level, color = colorDefault )
>       RETURNS NOTHING
>       FUNCTION  Plots hotizontal grid line using built-in dotted 
>                style atgiven level and color.
> Jayson


I would like horizontal grid lines to cover the full range of the 
visible price bars (ie. from the highest high to the lowest low of 
visible bars).  As the chart is scrolled or zoomed, the grid lines 
would automatically extend upwards or downwards accordingly.  The 
spacing between gridlines is fixed and user selectable. 

I used the PlotGrid function and wrote some code (below) which I 
think accomplishes this.  It determines the price range needed to be 
covered by gridlines and then plots the gridlines individually by 
stepping through the price range.  The size of the step is user 
selectable with the Param function.

1) Does anyone know of a more efficient way to accomplish this?  This 
seems to be somewhat brute force since there are many PlotGrid 
statements needed to cover an entire y axis price range (dependent on 
step size).

2) I wanted gridlines to appear above and below the highest and 
lowest price so I used "H+unit" and "L-unit" with "stylenoDraw" to 
fix the scale of the yaxis.  Unfortunately, the prices for "H+unit" 
and "L-unit" appear in the title bar.  They also appear in the small 
data window which appears when you position the cursor on a data bar. 
Is there a way to mask these prices from not appearing?

All feedback appreciated,
thank you,
kris

***************************************************
/*Plotting horizontal grid lines*/
/*Choose y axis unit size*/
Unit=Param("y axis unit",1,.1,10,.1);

/*Determine y axis range of visible bars*/
Visible=Status("barvisible");
HH=LastValue(Highest(IIf(Visible,H,-1000000)));
LL=LastValue(Lowest(IIf(Visible,L,1000000)));
Minimum=floor(LL/unit)*unit;
Maximum=ceil(HH/unit)*unit;

/*Set y axis scale*/
Plot(H+unit,"",1,styleNoDraw);
Plot(L-unit,"",1,styleNoDraw);

/*Plot bar*/
Plot(O,"Open",1,styleNoDraw);
Plot(H,"High",1,styleNoDraw);
Plot(L,"Low",1,styleNoDraw);
Plot(C,"Close",1,styleBar);

/*Plot horizontal grid*/
Count=0;
PlotGrid(LastValue(Minimum+Count*Unit),colorBlack);
/*Repeat the next two statements many times*/
Count=Count+1;
PlotGrid(LastValue(Minimum+Count*Unit),colorBlack);
Count=Count+1;
...
...
PlotGrid(LastValue(Minimum+Count*Unit),colorBlack);
Count=Count+1;
PlotGrid(LastValue(Minimum+Count*Unit),colorBlack);


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

--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> You might take a look at the plotgrid() function
> 
>       SYNTAX  PlotGrid( level, color = colorDefault )
>       RETURNS NOTHING
>       FUNCTION  Plots hotizontal grid line using built-in dotted 
style at
> given level and color.
> 
> 
> Jayson
> -----Original Message-----
> From: kristaura [mailto:camplevel@x...]
> Sent: Tuesday, April 08, 2003 4:03 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Plotting Horizontal Grid Lines
> 
> 
> I am looking for a method/formula to plot horizontal grid lines 
along
> the y-axis.  I would like to be able to adjust the grid spacing
> manually.  As I scroll the chart, I would choose fixed or auto
> scaling, but the grid spacing would remain unchanged.  Can someone
> point me in the right direction (message, help file, formula,
> tutorial, etc.).
> thank you
> kris
> 
> 
>       Yahoo! Groups Sponsor
>             ADVERTISEMENT
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/