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

Re: [amibroker] Function / VBScript



PureBytes Links

Trading Reference Links

hello,

> I am getting a syntax error for EnableScript("vbscript") in:
>  
> Function DataLog(FileName,Date_Time,TradeType,Price)
> {  
> EnableScript("vbscript");
> etc
> }

> Looks like can not do scripts inside function?
> Anyone experienced this?

I don't know if this will help, but here is an example just to show the 
mechanism. maybe there is some other solution. it also uses WSH and 
creates a new file in AB directory "fTrial.txt". but I haven't 
experimented with this kind of scripting very much, and I don't know if 
there are no traps.


EnableScript("jscript");

function fTrial() {
   local arrAFL;
<%
   function GetArray( Name ) { return VBArray( AFL( Name ) ).toArray(); }
   var arrJS = GetArray("Close");
   AFL.Var("arrAFL") = arrJS;

   var objFSO  = new ActiveXObject("Scripting.FileSystemObject");
   var intFile = objFSO.OpenTextFile("fTrial.txt", 2, 1);
       intFile.WriteLine("$SEPARATOR ,");
       intFile.WriteLine("$FORMAT");
       intFile.WriteLine(arrJS[0] + " " + arrJS[1]);
       intFile.Close();
%>
   return arrAFL;
}

Plot(1.05*fTrial(), "", colorRed);

cheers,
BM


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/