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

[amibroker] Vbscript in AFL worked in 2002, not now


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: [amibroker] Vbscript in AFL worked in 2002, not now
  • From: "Ken Close" <ken45140@xxxxxxxxx>
  • Date: Fri, 7 Nov 2008 14:12:05 -0500
  • Authentication-results: gwout1 smtp.user=ksclose; auth=pass (LOGIN)

PureBytes Links

Trading Reference Links

I used this code in 2002 successfully (on whatever version of AB was running then).
 
Today I stuck it in some code and while it did not produce an error, it seems not to recognize the change in symbols.
 
An explore after these lines shows that all symbols have the same BuyLevel = 174 and SellLevel = 80 saying that the Select command "fell through" to the "else" part even thou the watchlist contained only the five ETF symbols listed in the case statements.
 
Can anyone spot what might be wrong or missing?
 
What is the modern day way of doing this?  I tried IF statements (not IIF) and only the last IF statement was operative, ie, only the last IF corresponding to the last symbol in the watchlist was operative.  The modern way will be more complex loops, yes?  The Case statements below seem pretty simple if I could get them to work.
 
Thanks.
 
 
EnableScript("_vbscript_");
<%
'BSSC Codes: 1 = Buy/Sell 2 = Short/Cover 3 = Both / SL = Stop Loss percentage
Stock = AFL("ticker") : BuyLevel = 0 : SellLevel = 0
Select case Stock
    case "DIA" BuyLevel = 194 : SellLevel = 130
    case "SPY" BuyLevel = 190 : SellLevel = 130
    case "IWM" BuyLevel = 176 : SellLevel = 73
    case "QQQQ" BuyLevel = 192 : SellLevel = 146
    case "XLE" BuyLevel = 189 : SellLevel = 117
    case else BuyLevel = 174: SellLevel = 80
End Select
 
AFL("BuyLevel") = BuyLevel
AFL("SellLevel") = SellLevel
 
%>
 
__._,_.___

**** 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

__,_._,___