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

[amibroker] Re: Do i need to install ActiveX?



PureBytes Links

Trading Reference Links

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
>