[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

I had the dates swapped for the Zoomout trigger, below the corrected 
code. I tested on EOD data and the code works fine, but it does not 
work on RT minute datat. 

best regards,
herman
SetBarsRequired(1000000,1000000);
BI 			= BarIndex();
DT 			= DateTime();
CursorBar	= SelectedValue(BI);
Lastbar 	= Min(CursorBar + 5, BarCount-1);	// use Ref()
FirstBar 	= Max(CursorBar - 5,0);
LDT 		= LastValue(ValueWhen( Lastbar ==BI, DT ));
FDT 		= LastValue(ValueWhen( FirstBar ==BI, DT ));
LDTstr 	= DateTimeToStr( LDT );
FDTstr 	= DateTimeToStr( FDT ); 

FDT1 		= LastValue(ValueWhen( BI==0, DT ));
LDT1		= LastValue(ValueWhen( BarCount-1==BI, DT ));
LDTstr1 	= DateTimeToStr( LDT1 );
FDTstr1 	= DateTimeToStr( FDT1 );

AB = CreateObject("Broker.Application");
AW = AB.ActiveWindow;
ZoomIn = ParamTrigger("Click to Zoom in","ZOOM");
ZoomOut = ParamTrigger("Click to Zoom out","ZOOM");
if( ZoomIn )
	{
	if( AW.ZoomToRange( FDTstr, LDTstr ) )
		{
		Msg="Zoom In successfull";
		}
	}
if( ZoomOut )
	{
	if( AW.ZoomToRange( FDTstr1, LDTstr1 ) )
		{
		Msg="Zoom Out successfull";
		}
	}
else Msg = "";

Plot(C,"",1,128);
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 +"\n"+
"DataStart: "+ FDTstr1 + "\n"+
" Lastdate: "+ LDTstr1;


--- In amibroker@xxxxxxxxxxxxxxx, "psytek2" <psytek@xxx> wrote:
>
> Boy, why does it work for you and not for me? Nothing happens when 
i 
> click the paramtriggers. Is there a setting that can prevent this?
> 
> Below the code what i "expect" should zoom you back to max range 
> again however that doesn't work for me either.
> 
> The whole execrise is to get to know this function so that I can 
step 
> from signal to signal to inspect backtester trades; without tedious 
> scrolling. 
> 
> I think the code can be simplified a bit using Ref()...but i want 
it 
> working first. If anyone has an idea why it might not work for me 
let 
> me know...
> 
> best regards,
> herman
> 
> SetBarsRequired(1000000,1000000);
> BI 			= BarIndex();
> DT 			= DateTime();
> CursorBar	= SelectedValue(BI);
> Lastbar 	= Min(CursorBar + 10, BarCount-1);	// use Ref()
> FirstBar 	= Max(CursorBar - 10,0);
> LDT 		= LastValue(ValueWhen( Lastbar ==BI, DT ));
> FDT 		= LastValue(ValueWhen( FirstBar ==BI, DT ));
> LDTstr 	= DateTimeToStr( LDT );
> FDTstr 	= DateTimeToStr( FDT ); 
> 
> LDT1 		= LastValue(ValueWhen( BI==0, DT ));
> FDT1 		= LastValue(ValueWhen( BarCount-1==BI, DT ));
> LDTstr1 	= DateTimeToStr( LDT1 );
> FDTstr1 	= DateTimeToStr( FDT1 );
> 
> AB = CreateObject("Broker.Application");
> AW = AB.ActiveWindow;
> ZoomIn = ParamTrigger("Click to Zoom in","ZOOM");
> ZoomOut = ParamTrigger("Click to Zoom out","ZOOM");
> if( ZoomIn )
> 	{
> 	if( AW.ZoomToRange( FDTstr, LDTstr ) )
> 		{
> 		Msg="Zoom In successfull";
> 		}
> 	}
> if( ZoomOut )
> 	{
> 	if( AW.ZoomToRange( FDTstr1, LDTstr1 ) )
> 		{
> 		Msg="Zoom Out successfull";
> 		}
> 	}
> else Msg = "";
> 
> Plot(C,"",1,128);
> 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, "Anthony Faragasso" <ajf1111@> 
> wrote:
> >
> > 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@> 
> >   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.
> >
>