Followup to my own message, asking this:
I found a "case" statement in some code written in 2002, which has the
convenient feature of naming the symbol name and having the ability to
assign various parameters within one line. My reading of the current
"Switch-Case" statement construction suggests that the old VBscript way is
more compact and more versatile. Perhaps only TJ can comment on this, but I
am still looking for a way to assign parameter values individualized for
many symbols.
sample from 2002:
ticker = Name(); BuyLine = 0;
BSSC = 0; SL = 0;
/* VBSCRIPT for values specific to each stock */
EnableScript("vbscript");
<%
'BSSC Codes: 1 = Buy/Sell 2 = Short/Cover 3 = Both / SL = Stop Loss
percentage
Stock = AFL("ticker") : CMO = 0 : STO = 0 : BSSC = 0
Select Case Stock
Case "ACDO" STO = 32 : CMO = 27 : BSSC = 3 : SL = 13
Case "ADBE" STO = 24 : CMO = 43 : BSSC = 3 : SL = 13
Case "ADI" STO = 25 : CMO = 67 : BSSC = 3 : SL = 13
Case "AFL" STO = 22 : CMO = 58 : BSSC = 3 : SL = 13
. . . . .
'Case Else STO = 23 : CMO = 50: BSSC = 3
End Select
AFL("StoBuyLine") = STO
AFL("CMOBuyLine") = CMO * -1
AFL("BSSC") = BSSC
AFL("SL") = SL
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Ken Close
Sent: Sunday, November 02, 2008 9:10 AM
To: [email protected]
Subject: [amibroker] Best Ways to Read in Individualized Parameters
The subject line is not well stated but I couldn't find a more concise way
to ask what ways are available to use a different parameter for each symbol
on which a code file is used.
Say I have a value, any value, but each symbol has a different value for it
to perform the best. Thus, as a watchlist is run through an Explore, or a
Backtest, I want the individual value to be used for each symbol. The value
would not change bar by bar but would be true for the symbol and all of its
data.
I have used the CASE statement in the past (in Jscript) but is this the best
way given today's more advanced Amibroker program?
What about opening and reading an outside file? (not sure how I would
program that anyway).
Can a CASE statement have more than 300 lines? ...more than 500? What
upper limit?
What are your suggestions?
Thanks,
Ken