PureBytes Links
Trading Reference Links
|
Herman,
I just tried your formula and it zooms at the cursor position 10 bars + / - both ways on my computer.....could you add UnZoom also :)
Thanks
Anthony
----- Original Message -----
From: psytek2
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, August 13, 2006 5: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 amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx>
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
>
----------------------------------------------------------------------------
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 0632-2, 08/10/2006
Tested on: 8/13/2006 6:17:00 AM
avast! - copyright (c) 1988-2006 ALWIL Software.
|