I tried posting this twice already with the complete thread intact. But it would not post. Therefore, I have removed all of thread with exception of most recent post that I am replying to.

Mike --
You've been a great help on this.
First:
|AB = CreateObject("Broker.Application");|
|ADoc = AB.ActiveDocument;|
|ADoc.Name = "SPY";|

does indeed make SPY the current ticker, assuming the previous ticker contains some data already. For the time being I will (manually) insure that the previous ticker does contain data, before starting the function (via paramtrigger()).

When I first received your suggestion with the jscript example, I tried this:
|AB = CreateObject("Broker.Application");|
|AB.ActiveDocument||.Name = "SPY";|
which produces a Syntax error with the cursor just before .Name. I obviously do not understand the required structure, since the two snippets of code are equivalent in my mind. Though they are obviously not to the AFL checker.

Second:
In answer to your question:
"What would you expect the result to be if you had something like this:

_TRACE("Close is: " + Close);
<swap out symbol>
_TRACE("Close is: " + Close);"

I would expect that the first _Trace would display the close of the previous symbol and the second one would display the new symbol.

My expectation was wrong! After the swap, the first close was displayed 3 more times (within the same 10msec period, from 3 separate _Trace statements in the code). Then after 20msec, and two more 20msec periods, the new close was displayed for a total of 3 times.

BTW, my intention is to use this ONLY when collecting symbols and prices from a file for trading the following day (using paramtrigger()). It is done only once a day. And is not done at all while trading.

Thanks again.
-- Keith

On 3/16/2010 14:31, Mike wrote:

Kieth,

My example was for an external javascript (e.g. .js file).

Trying to change the active symbol from within a running AFL is probably not a good idea (if at all possible) since you would effectively be executing AFL code that would be cutting your feet out from under yourself (i.e. running script over a symbol that changed the symbol before the script was finished running).

What would you expect the result to be if you had something like this:

_TRACE("Close is: " + Close);
<swap out symbol>
_TRACE("Close is: " + Close);

I'm not sure exactly what scenario you are trying to capture. But, what I was suggesting was to run an external javascript to drive AmiBroker, not driving AmiBroker from within AmiBroker.

However, to answer your question; Your problem is that you are mixing javascript and AFL incorrectly. You would just need to use AFL.

e.g.
AB = CreateObject(...);
Doc = AB.ActiveDocument;
Doc.Name = ...

Mike

Reply via email to