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

Re: [amibroker] Sort by columns



PureBytes Links

Trading Reference Links

Tomasz,

Here is what I wrote in .js but it still doesn't work.

AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;

AA.SortByColumn( 1, False, False );
AA.SortByColumn( 2, False, True );

I first open up AA, then run Explore (auto update every 2 minutes).  Then I run .js file and get the same error message.

False is undefined

Hope you can help with the coding

Thanks

Tony
On 4/19/06, Tomasz Janeczko <amibroker@xxxxxx> wrote:
See the other sentence: it should be used from external script AFTER execution of AFL. If you use it inside the formula
that is being currently executed - there is nothign to sort yet (as it FIRST needs to execute the formula
for all symbols and generate results and THEN sort, not vice-versa).

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Tony Lei
Sent: Wednesday, April 19, 2006 2:17 PM
Subject: Re: [amibroker] Sort by columns

I'm using 4.80.1 Build Apr 14 2006

On 4/19/06, Tomasz Janeczko <amibroker@xxxxxx> wrote:
Hello,
 
Probably you are using old version. Please upgrade to latest.
Also AA object is intended to be used outside AFL formula (from external script)

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Tony Lei
Sent: Wednesday, April 19, 2006 7:20 AM
Subject: Re: [amibroker] Sort by columns

After doing some reading and searching on the board for examples, I came across the following formula.  But I receive this error message:

False is undefined source: MS runtime error

//I added below to my AFL code from previous messages

EnableScript("jscript");
<%
AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;

AA.ClearFilters();
AA.ApplyTo = 0; // use filters
AA.Filter(0, "watchlist") = 2;
AA.SortByColumn( 1, False, False );
AA.SortByColumn( 2, False, True );
%>

Any help is appreciated

Tony

On 4/19/06, Tony Lei < yiupang91@xxxxxxxxx> wrote:
Graham

Thanks for the code but I'm not familiar with implementing a _javascript_ and running my code at the same time.

Tony


On 4/18/06, Tony Lei < yiupang91@xxxxxxxxx> wrote:
I'm a little lost and don't know where to start.  This is what I wrote and I would like someone to guide me through the process.  This OLE looks more complicated than anything I have done.  Basically, I need to sort by Timenum (most current) first then my buy signals.

Truly appreciate your help

Tony

//
MarketOpen = 093259 ;

TimeFrameSet (in1Minute*15) ;

MA15_1 = Ref ( MA ( C, 3),-3) ;

TimeFrameRestore () ;

MA15 = TimeFrameExpand ( MA15_1, in1Minute*15) ;

TimeFrameSet (in1Minute*30) ;

MA30_1 = Ref ( MA ( C, 3),-3) ;

TimeFrameRestore () ;

MA30 = TimeFrameExpand ( MA30_1, in1Minute*30) ;

TimeFrameSet (in1Minute*60) ;

MA60_1 = Ref ( MA ( C,3),-3) ;

TimeFrameRestore () ;

MA60 = TimeFrameExpand ( MA60_1, in1Minute*60 ) ;

TimeFrameSet (in1Minute*120) ;

MA120_1 = Ref ( MA ( C,3),-3) ;

TimeFrameRestore () ;

MA120 = TimeFrameExpand ( MA120_1, in1Minute*120 ) ;

TimeFrameSet (in1Minute*240) ;

MA240_1 = Ref ( MA ( C,3),-3) ;

TimeFrameRestore () ;

MA240 = TimeFrameExpand ( MA240_1, in1Minute*240 ) ;

Above30 = Close > MA30 ;
Below30 = Close < MA30 ;
Above60 = Close > MA60 ;
Below60 = Close < MA60 ;
Above120 = Close > MA120 ;
Below120 = Close < MA120 ;
Above240 = Close > MA240 ;
Below240 = Close < MA240 ;

Buy = TimeNum() >= MarketOpen AND Cross ( Close, MA15) ;
Short = TimeNum() >= MarketOpen AND Cross ( MA15, Close ) ;

Filter = Buy OR Short ;

SetOption("NoDefaultColumns",True);
AddTextColumn(Name(), "SYMBOL",1,width=60);
AddColumn ( TimeNum(), "TIME", 6, width=200 );

AddColumn ( Buy, "BUY", 1, colorDefault, IIf ( Buy == 1, colorGreen, Null ),width=60 );
AddColumn ( Short, "SHORT", 1, colorDefault, IIf ( Short == 1, colorRed, Null ),width=60 );
AddColumn ( MA30, "30 Minute", 1, colorDefault, IIf ( Above30 == 1, colorGreen, colorRed ),width=60 ) ;
AddColumn ( MA60, "60 Minute", 1, colorDefault, IIf ( Above60 == 1, colorGreen, colorRed ),width=60 );
AddColumn ( MA120, "120 Minute", 1, colorDefault, IIf ( Above120 == 1, colorGreen, colorRed ),width=60 ) ;
AddColumn ( MA240, "240 Minute", 1, colorDefault, IIf ( Above240 == 1, colorGreen, colorRed ) ,width=60) ;

//







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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


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






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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS