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

RE: [amibroker] Best Ways to Read in Individualized Parameters



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ken Close
Sent: Sunday, November 02, 2008 9:10 AM
To: amibroker@xxxxxxxxxxxxxxx
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
 
 
__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___