It works for me .... (i.e. it zooms to +- 10 bars around selected bar (provided that there are 10 bars before and after selected one))
Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: "psytek2" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Sunday, August 13, 2006 11:59 AM Subject: [amibroker] Re: Do i need to install ActiveX? > Thank you Tomasz, I am getting closer but my test code still doesn't > want to do what i want. I want the code, when I click a ParamTrigger > to zoom automatically +/- n bars around the cursor position. > > Can anybody tell my why this code doesn't work? > > Many thanks! > herman > > SetBarsRequired(1000000,1000000); > BI = BarIndex(); > DT = DateTime(); > CursorBar = SelectedValue(BI); > Lastbar = Min(CursorBar + 10, BarCount-1); > FirstBar = Max(CursorBar - 10,0); > LDT = LastValue(ValueWhen( Lastbar ==BI, DT )); > FDT = LastValue(ValueWhen( FirstBar ==BI, DT )); > LDTstr = DateTimeToStr( LDT ); > FDTstr = DateTimeToStr( FDT ); > > AB = CreateObject("Broker.Application"); > AW = AB.ActiveWindow; > ZoomIn = ParamTrigger("Click to Zoom in","ZOOM"); > if( ZoomIn ) > { > if( AW.ZoomToRange( FDTstr, LDTstr ) ) > { > Msg="Zoom successfull"; > } > } > else Msg = ""; > Title = "\n"+Msg+"\n"+ > " BI: "+NumToStr(BI,1.0,False)+"\n"+ > " DT: "+NumToStr(DT,1.0,False)+"\n"+ > " FBAR: "+NumToStr(Firstbar ,1.0,False)+"\n"+ > " CBAR: "+NumToStr(CursorBar,1.0,False)+"\n"+ > " LBAR: "+NumToStr(Lastbar ,1.0,False)+"\n"+ > "FirstDate: "+ FDTstr + "\n"+ > "Last Date: "+ LDTstr; > > > --- In [email protected], "Tomasz Janeczko" <[EMAIL PROTECTED]> > wrote: >> >> BlankHerman, >> >> "new ActiveXObject" is a JScript-only syntax (so it can be used in > EXTERNAL .JS file). >> >> >> If you want to use it from AFL use CreateObject. >> >> AB = CreateObject("Broker.Application"); >> >> >> Best regards, >> Tomasz Janeczko >> amibroker.com >> ----- Original Message ----- >> From: Herman >> To: _AmiBroker >> Sent: Saturday, August 12, 2006 3:23 PM >> Subject: [amibroker] Do i need to install ActiveX? >> >> >> I am trying to run this code: >> >> AB = new ActiveXObject("Broker.Application"); >> AW = AB.ActiveWindow; >> if( AW.ZoomToRange( FDTstr, LDTstr ) ) >> { >> WScript.Echo("Zoom successfull" ); >> } >> >> and get a syntax error on the first line, >> I change computers recently, how do i know ActiveX is installed? > How do I install it if it is not there? >> TIA, >> herman >> > > > > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For other support material please check also: > http://www.amibroker.com/support.html > > > Yahoo! Groups Links > > > > > > > > > Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
