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

Re: [amibroker] Re: How do you find the number of padded bars that are visible?



PureBytes Links

Trading Reference Links

Hello,
 
See also the very last sample in the User's Guide:
 
It shows how to find out what visible bars are and how to align
lowlevel gfx with normal chart.
 
See also the following sample from ReleaseNotes.html document
 
function GetVisibleBarCount()
{
 lvb =
Status("lastvisiblebar"
);
 fvb =
Status("firstvisiblebar"
);

 return Min( Lvb - fvb, BarCount
- fvb );
}

function
GfxConvertBarToPixelX( bar )
{
 lvb =
Status("lastvisiblebar"
);
 fvb =
Status("firstvisiblebar"
);
 pxchartleft =
Status("pxchartleft"
);
 pxchartwidth =
Status("pxchartwidth"
);

 return pxchartleft + bar  * 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 ) );
}



Plot(C, "Price", colorBlack, styleHistogram
);

GfxSetOverlayMode(0
);
GfxSelectSolidBrush( colorRed
);
GfxSelectPen( colorRed
);

AllVisibleBars = GetVisibleBarCount();
fvb =
Status("firstvisiblebar"
);

for( i = 0
; i < AllVisibleBars ; i++ )
{
   x = GfxConvertBarToPixelX( i );
   y = GfxConvertValueToPixelY(
C
[ i + fvb ] );

  
GfxRectangle( x-1, y-1, x + 2, y+1
);
}

//SetChartBkGradientFill( ColorRGB(200,200,200), ColorRGB( 255,255,255) );

_SECTION_END();
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Tomasz Janeczko" <groups@xxxxxxxxxxxxx>
Sent: Monday, March 30, 2009 11:18 AM
Subject: Re: [amibroker] Re: How do you find the number of padded bars that are visible?

> It is described in detail in the Knowledge Base:
>
http://www.amibroker.com/kb/2008/07/03/quickafl/
>
> (pay special attention to the PICTURE embedded in the article)
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "sidhartha70" <
sidhartha70@xxxxxxxxx>
> To: <
amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, March 30, 2009 12:13 AM
> Subject: [amibroker] Re: How do you find the number of padded bars that are visible?
>
>
>> If your talking about built in AFL functions like PlotOHLC() etc then they have built in abilities to plot beyond the end of the
>> last bar... so wondering about how much space in there is not something you have to worry about.
>>
>> If it's low level gfx, then I'm not sure I can help. I do use low level gfx quite a bit but it is either 'on or off' my chart... I
>> tend to use it for display buttons & grids etc..etc...
>>
>> There may well be a way to get back the info you want... maybe someone else can point you in the right direction...?
>>
>> As a point of note Conrad, I wouldn't worry so much about code speed right now... my advice is to get down what you want, then
>> worry about removing any superfluous calculation afterwards...
>>
>> --- In
amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@xxx> wrote:
>>>
>>> Just to be clear Conrad, you are talking about low level gfx drawing operations....? Rather than those in any way related to the
>>> AFL Plot() PlotOHLC() etc..etc...?
>>>
>>> --- In
amibroker@xxxxxxxxxxxxxxx, "Conrad Joach" <consolejoker@> wrote:
>>> >
>>> > I'll ask this question in a totaly different way. Depending on a user's settings, there is a certain amount of padding on the
>>> > right side of the chart when the chart is scrolled all the way to the right.
>>> >
>>> > It could be none, but default is more than none. Mine is set to 15 bars.
>>> >
>>> > My script would like to know how many bars of padding are visible on the chart. For instance if the default is 15, and the user
>>> > hasn't moved the scroll bar, then there are 15 bars of space that I would like to plot some data in.
>>> >
>>> > But if the user has scrolled just a bit, there may be only 7 blank bars left on the right, and I want to plot here just those 7
>>> > bars. If I plot more than 7, I am going to draw into the right hand price axis, plus waste resources.
>>> >
>>> > It may be that when the user scrolls back in time, they see 0 bars. I would like to know not to plot anything beyond the bars
>>> > that are visible.
>>> >
>>> > So how can one find this out?
>>> >
>>>
>>
>>
>>
>>
>> ------------------------------------
>>
>> **** 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/
>

__._,_.___


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





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

__,_._,___