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

RE: [amibroker] Re: Plotting Horizontal Grid Lines



PureBytes Links

Trading Reference Links

I have no problems with this, the grid lines automatically appear and
disappear with the price levels. With the example I posted. Here are a few
more lines to before
PlotGrid( nb01, COL01 );
PlotGrid( nb02, COL02 );
PlotGrid( nb03, COL03 );
PlotGrid( nb04, COL04 );
PlotGrid( nb05, COL05 );
PlotGrid( nb06, COL06 );
PlotGrid( nb07, COL07 );
PlotGrid( nb08, COL08 );
PlotGrid( nb09, COL09 );
PlotGrid( nb10, COL10 );
PlotGrid( nb11, COL11 );

COLgrid = colorWhite;
PlotGrid(nb01*0.2,COLgrid);
PlotGrid(nb01*0.4,COLgrid);
PlotGrid(nb01*0.6,COLgrid);
PlotGrid(nb01*0.8,COLgrid);

I use them on a P&F chart that has different box size values for price
ranges. The nb01 etc are preset for these ranges.
If you want to set it for the range on screen I also use this to place some
price values at the major grid lines
Here are a few lines for this
barvisible = Status("barvisible");
firstvisiblebar = barvisible AND NOT Ref( barvisible, -1 );
period=BarsSince(firstvisiblebar==1);
scnH = HHV(H,-period);
scnL = LLV(L,-period);
gap = 0;
gap1 = gap;
gap2 = gap+2;
gap3 = gap+4;
gap4 = gap+6;
End = BarIndex() == LastValue( BarIndex() ); 
//5
PlotShapes( IIf(Cum(1)==LastValue(Cum(1)-gap1) AND nb01>=scnL AND
nb01<=scnH, shapeDigit5+shapePositionAbove, shapeNone), col01, 0, nb01 );
//10
PlotShapes( IIf(Cum(1)==LastValue(Cum(1))-gap2 AND  nb02>=scnL AND
nb02<=scnH, shapeDigit1+shapePositionAbove, shapeNone), col02, 0, nb02 );

Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia

-----Original Message-----
From: kristaura [mailto:camplevel@xxxxxxxxxxxx] 
Sent: Wednesday, 9 April 2003 6:44 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Plotting Horizontal Grid Lines

> 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.



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/ 


------------------------ 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/