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

[amibroker] Re: Sort by columns



PureBytes Links

Trading Reference Links

Tony,

My preference for scripting is in vbscript so I don't have a .js 
solution for you.

This will work when saved with a file type of .vbs

Set oAB = CreateObject("Broker.Application")
Set oAA = oAB.Analysis
Result = oAA.SortByColumn(1, False, False)
Result = oAA.SortByColumn(2, False, True)

This can be done from inside an AFL as well but I wouldn't recommend 
it as it appears the sort will occur for each issue the AFL sees i.e. 
for a watchlist of 100 items it sorts 100 times.

--- In amibroker@xxxxxxxxxxxxxxx, "Tony Lei" <yiupang91@xxx> wrote:
>
> Forgot to add before running the .js file, I sort the columns using 
the
> shift key.
> 
> 
> On 4/19/06, Tony Lei <yiupang91@xxx> wrote:
> >
> > 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@xxx> 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 <yiupang91@xxx>
> > >  *To:* amibroker@xxxxxxxxxxxxxxx
> > >  *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@xxx> 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 <yiupang91@xxx>
> > > > *To:* amibroker@xxxxxxxxxxxxxxx
> > > >  *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@xxx> 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@xxx> 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<http://groups.yahoo.com/gads?
t=ms&k=Investment+management+software&w1=Investment+management+softwar
e&w2=Real+estate+investment+software&w3=Investment+property+software&w
4=Software+support&w5=Real+estate+investment+analysis+software&w6=Inve
stment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcMu4KNQ> Real estate 
investment software<http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+software&w1=Investment+management+softwa
re&w2=Real+estate+investment+software&w3=Investment+property+software&
w4=Software+support&w5=Real+estate+investment+analysis+software&w6=Inv
estment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ9tFSJA> Investment 
property software<http://groups.yahoo.com/gads?
t=ms&k=Investment+property+software&w1=Investment+management+software&
w2=Real+estate+investment+software&w3=Investment+property+software&w4=
Software+support&w5=Real+estate+investment+analysis+software&w6=Invest
ment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5WZw>  Software
> > > > support<http://groups.yahoo.com/gads?
t=ms&k=Software+support&w1=Investment+management+software&w2=Real+esta
te+investment+software&w3=Investment+property+software&w4=Software+sup
port&w5=Real+estate+investment+analysis+software&w6=Investment+softwar
e&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w> Real estate investment 
analysis software<http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+analysis+software&w1=Investment+manageme
nt+software&w2=Real+estate+investment+software&w3=Investment+property+
software&w4=Software+support&w5=Real+estate+investment+analysis+softwa
re&w6=Investment+software&c=6&s=200&.sig=GmF8PlAJASx0wrSaX5-Zlw> 
Investment software<http://groups.yahoo.com/gads?
t=ms&k=Investment+software&w1=Investment+management+software&w2=Real+e
state+investment+software&w3=Investment+property+software&w4=Software+
support&w5=Real+estate+investment+analysis+software&w6=Investment+soft
ware&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg>
> > > >  ------------------------------
> > > >  YAHOO! GROUPS LINKS
> > > >
> > > >
> > > >    -  Visit your 
group "amibroker<http://groups.yahoo.com/group/amibroker>"
> > > >    on the web.
> > > >
> > > >    -  To unsubscribe from this group, send an email to:
> > > >      amibroker-unsubscribe@xxxxxxxxxxxxxxx<amibroker-
unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > > >
> > > >    -  Your use of Yahoo! Groups is subject to the Yahoo! 
Terms of
> > > >    Service <http://docs.yahoo.com/info/terms/>.
> > > >
> > > >
> > > >  ------------------------------
> > > >
> > >
> > >
> > >
> > >  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
> > >
> > >
> > >    -  Visit your 
group "amibroker<http://groups.yahoo.com/group/amibroker>"
> > >    on the web.
> > >
> > >    -  To unsubscribe from this group, send an email to:
> > >      amibroker-unsubscribe@xxxxxxxxxxxxxxx<amibroker-
unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > >
> > >    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of
> > >    Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> > >  ------------------------------
> > >
> >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/