Formulas are executed a number of times:
Indicator = 1, Scan = 1, Explore = 1 , Backtest = 1
provided that :
a) no equity chart is displayed (equity plot of course need one additional pass)
b) no interpretation window is open (interpretation needs one add pass)
c) no chart data tooltip is displayed (data chart tooltip needs one add pass)
When you Apply a formula a Backtest is performed to check for AFL errors.
You can use Status("Action") == 1 to limit executions to those in the indicator window. However you can still get multiple executions if you use Tooltips, interpretation or Equity curves.
On the other hand, if you want to write when Applying a new formula, you might be able to check for status==5. Be cautious when you use the same formula in the AA...
Other Status() values are (see help):
"action" - gives information in what context given formula is run: 1 - INDICATOR, 2 - COMMENTARY, 3 - SCAN, 4 - EXPLORATION, 5 - BACKTEST / OPTIMIZE
Formula executions are generally unpredictable and you may be better to trigger file-writes by some other criteria; a mouse-click, trade signal, date/time change, new bar, system-time, etc. Such other events are predictable.
Hope i got that all right...I know what you are going through, it takes some experimenting to get it all working right.
herman
Tuesday, September 4, 2007, 11:23:19 AM, you wrote:
>
|
Hello,
I have been writing some AFL that reads and writes files into folders
that are tagged with the ChartID() in the name of each. I have
noticed that whenever I apply an edit to the AFL of my chart, the AFL
runs through one pass (for error checking and "compilation") with the
ChartID() returning zero. Then the normal ChartID() is returned
after that. I have gone through some pains to reduce the side
effects of this which is creating extra folders and files and reading
bad information into my chart static variables on this first pass. I
check for ChartID()==0 and disable writing critical information and
dummy up other critical file read information during that pass.
I am curious if others have run into this and how you handled it. I
am also curious if this is the "designed in" behavior or an
unexpected behavior.
PS. My charts are running live in indicator mode while I am editing
my AFLs.
Thanks for you insights,
Dennis
|
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|
|