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

[amibroker] Re: JScript Help



PureBytes Links

Trading Reference Links

Ok. Upon a bit closer look, I think your problem might
be in following line then -

denom=period*MA(Close,period); /* sum of prices over period */

You can't use "MA()" function inside JScript... Calculate
it before you enter the JScript code, and get the array
using the same technique you used for Close.

Jitu

--- In amibroker@xxxxxxxxxxxxxxx, "jwilsonp2a" <jimnwilson@xxxx> 
wrote:
> Thanks, Jitu, but it didn't help, I got the same error message
> 
> Jim
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "jtelang" <jtelang@xxxx> wrote:
> > Instead of -
> > 
> > Close=VBArray(AFL("close")).toArray();
> > 
> > try -
> > 
> > Close=AFL("close").toArray();
> > 
> > See if that helps.
> > 
> > Jitu
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "jwilsonp2a" <jimnwilson@xxxx> 
> > wrote:
> > > I am trying out looping for the first time, trying to implement 
> > > Ehlers Center of Gravity indicator from May 2002 TASC.
> > > 
> > > Here is the chunk of code giving problems; I get "object 
> expected" 
> > > errors when running it. Thanks for the help, I am confused on 
> this.
> > > ======================================
> > > Source: Microsoft JScript runtime error
> > > Line:   19   Char:   1
> > > Error:  0  - Object expected
> > > ======================================
> > > The code:
> > > ----------------------------------------------
> > > SetBarsRequired(50);
> > > EnableScript("jscript");
> > > 
> > > <%
> > > Close=VBArray(AFL("close")).toArray();
> > > 
> > > array=new Array();
> > > 
> > > numerator=0; period=10;
> > > 
> > > for(i=0;i<period;i++)
> > > {
> > > numerator=numerator+((i+1)*array[i]);
> > > }
> > > 
> > > denom=period*MA(Close,period); /* sum of prices over period */
> > > 
> > > cog=IIf(denom!=0,numerator/denom,0); cogdelay=Ref(cog,-1);
> > > %>


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