Can I invalidate a chart and force a refresh without the timer?

Is there a way to force a redraw from code without using RequestTimedRefresh?
Thanks in advance,
Jay

What do you exactly mean by this ?

Read more here about the when-and-how:
http://www.amibroker.com/kb/2015/02/03/when-and-how-often-afl-code-is-executed/

Non timed Programming then becomes event driven, so if you want to "force" a redraw from the code, what event do you think you will be able to trigger ?

RequestMouseMoveRefresh() this is one such example.

Even OLE can be used to trigger an event from code like zoom or select range etc, but these are all events so what is your code going to do?

Edit: When you post such questions, always explain the complete scenario or why you want to do it, there are many experts who can lead better instead of keeping everyone in the dark.

1 Like

@BuyHighSellLow I agree with @travick - when asking for advice, you definitely need do provide more details. Without them - it's a guessing game. You shouldn't expect replies 10 or 20 times longer than your initial post. In AmiBroker everything can be done in many different ways...

In general you can't invalidate or freeze a visible chart and expect that it won't be refreshed, because it will be for many different reasons (enumerated in the article provided by @travick ) But I suggest a different approach. Make your AFL work properly no matter how often the chart is refreshed. You can easily divide one AFL into parts using conditional statements (if ...). The core part of your code (executed every time the code is refreshed) should be as light as possible. Other - selected parts of the code can be executed for instance once a minute, twice an hour, only when a new bar appears, at the beginning or at the end of session, when the price reaches some level or when the code receives a trigger (via static variables) from another chart. There are countless possiblities in such approach ...


Additionlly read about Status(redrawaction) - you can execute some parts of the code depending on the type of refresh:

"redrawaction" - returns 0 (zero) for regular refreshes, and 1 for refreshes triggered via RequestTimedRefresh().

https://www.amibroker.com/guide/afl/status.html

2 Likes

Sorry. I could have worded my question better.
Thanks guys for the link. That pretty much answered my question.
Jay