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

[amibroker] Re: How to Draw a Chart Just Once?


  • Date: Thu, 10 Dec 2009 11:08:17 -0000
  • From: "progster01" <progster@xxxxxxxxxxxxxxxxxx>
  • Subject: [amibroker] Re: How to Draw a Chart Just Once?

PureBytes Links

Trading Reference Links

Aron,

That's a fine, to the point, example.  

Simple as it is, it nicely illustrates the key idea that the Plot() or PlotOHLC() statements must be in the execution path during every refresh event (else your "refreshed" chart remains a blank canvas).

Thanks for posting it.  


--- In amibroker@xxxxxxxxxxxxxxx, Aron <aron.groups@xxx> wrote:
>
> |RequestTimedRefresh( 20, onlyvisible = *True* ) ;
> 
> RAS = Status( "redrawaction" ) ;
> *if*( RAS == 1 ){
> 
> StaticVarSet("price", *C*);
> }
> price = StaticVarGet("price");
> Plot(price,"", *colorRed*);|
> 
> // You may notice that you can switch ticker but the chart still shows 
> the old graph for 20 sec.
> 
> 
> On 12/9/2009 7:33 PM, Aron wrote:
> > I think it works if you take out the plot statements form:
> >
> > if( RAS == 1 ){
> > <Complex code here>
> > }
> >
> >
> >
> > On 12/9/2009 2:43 PM, progster01 wrote:
> >> Hi.
> >>
> >> I'm working a new-to-me corner of the AB universe lately, and I'm 
> >> having an issue that I don't yet know a solution for.  Perhaps 
> >> someone else has been here before and can point me in the right 
> >> direction.
> >>
> >> I've created a complex chart that requires alot of CPU to calculate 
> >> and draw.
> >>
> >> Using _TRACE() I can see that the chart code is executing 
> >> approximately once per second.  The effect of this is to tie up the CPU.
> >>
> >> The nature of this chart is such that I only need to draw it once and 
> >> I am not interested in updating it a) on every tick, or b) every second.
> >>
> >> IOW, I'd basically be satisfied to draw this chart once when I apply 
> >> the AFL to the pane.  (Secondarily, I might want to add a manual 
> >> refresh button, but that's beside the point at the moment.)
> >>
> >> I have tried to put the entire code in a Status() condition like so:
> >>
> >> RequestTimedRefresh( 20, onlyvisible = True ) ;        //    trying 
> >> to reduce CPU load, but this does not stop the "regular" refresh
> >>
> >> RAS = Status( "redrawaction" ) ; // 1 if a timed refresh, else 0
> >> if( RAS == 1 ){
> >> <Complex code here>
> >> }
> >>
> >> The goal here is to prevent any "automatic" refreshes, and allow me 
> >> to specify a (much less frequent) TimedRefresh.
> >>
> >> What I observe to happen in this case is that the chart paints 
> >> (quickly) at the TimedRefresh frequency, then disappears (goes blank, 
> >> to the background color) until the next TimedRefresh.
> >>
> >> So, I'm currently stuck at either seeing the chart and paying the 
> >> price for constant refreshes, or having a flashing/disappearing chart 
> >> which is useless (but cheap!).
> >>
> >> Thus the question, in a nutshell:
> >>
> >>     How to Draw a Chart Just Once?
> >>
> >> (and not have it disappear on you).
> >>
> >> Thanks to anyone who can shed some light on this for me!
> >>
> >>
> >>
> >>
> >>
> >>
> >> ------------------------------------
> >>
> >> **** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/