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

[amibroker] how to convert from bar value to pixel if the chart is in log schale



PureBytes Links

Trading Reference Links

If the underlying chart is in log scale, then the chart and the calculated Y values do not match. Does anybody know how to convert from bar value to pixel if the chart is in log schale? 
Thanks.


http://www.amibroker.com/kb/2009/03/30/how-to-convert-from-bar-value-to-pixel-co-ordinates/


--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> //functions for Converting Chart prices to pixels
> 
> function GfxConvertBarToPixelX( bar )
> 
> {
> 
> lvb = Status( "lastvisiblebar" );
> 
> fvb = Status( "firstvisiblebar" );
> 
> pxchartleft = Status( "pxchartleft" );
> 
> pxchartwidth = Status( "pxchartwidth" );
> 
> //
> 
> if ( diag )
> 
> {
> 
> //_TRACE("FP&T-xx " + " lvb " + WriteVal(Lvb,1.0) + " fvb " + 
> WriteVal(fvb,1.0) + "pxw " + WriteVal(pxchartwidth,1.0)
> 
> // + "pxleft " + WriteVal(pxchartleft,1.0));
> 
> }
> 
> return pxchartleft + ( bar - fvb ) * pxchartwidth / ( Lvb - fvb + 1 );
> 
> }
> 
> function GfxConvertValueToPixelY( Value )
> 
> {
> 
> local Miny, Maxy, pxchartbottom, pxchartheight;
> 
> Miny = Status( "axisminy" );
> 
> Maxy = Status( "axismaxy" );
> 
> pxchartbottom = Status( "pxchartbottom" );
> 
> pxchartheight = Status( "pxchartheight" );
> 
> return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight / ( 
> Maxy - Miny ) );
> 
> }
> 
> ----- Original Message ----- 
> From: "wooziwog" <xcitemint@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, July 09, 2009 8:12 PM
> Subject: [amibroker] GFX x y position conversion question
> 
> 
> > Does anyone know if there is a way to convert the X and Y coordinates from 
> > the price chart directly to X and Y pixel coordinates?
> > I simply want to draw polygon shapes of chart patterns.  Since I already 
> > have the pivots and lines on my current chart I simply want to  do a color 
> > fill.  I don't want to have to do loops to recreate everything that I 
> > already have.
> >
> > Any help is appreciated.
> >
> > I will post the completed project if I can find a way of doing this.
> >
> > David K.
> >
> >
> >
> > ------------------------------------
> >
> > **** IMPORTANT PLEASE READ ****
> > This group is for the discussion between users only.
> > This is *NOT* technical support channel.
> >
> > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> > http://www.amibroker.com/feedback/
> > (submissions sent via other channels won't be considered)
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>




------------------------------------

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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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