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

[amibroker] Re: Formula question for Ichimoku Chart



PureBytes Links

Trading Reference Links

Glenn,

Try this in Indicator builder....and let me know
//Function

//% of stocks Advancing

Wlist=Param("WatchListNum",0,0,63,1);

function CreatePercentofStocksAdvancing( listnum )

{

// retrive comma-separated list of symbols in watch list

list = GetCategorySymbols( categoryWatchlist, listnum );

Advancers = 0; // just in case there are no watch list members

for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )

{

f = Foreign( sym, "c" ) > Ref(Foreign( sym, "c" ),-1) ;

if( i == 0 ) Advancers = f;

else Advancers = Advancers + f;

}

return (Advancers / i)*100; // divide by number of components

}

/////////////////////////////////////////////////////////

//Function

//% of stocks Declining

function CreatePercentofStocksdeclining( listnum )

{

// retrive comma-separated list of symbols in watch list

list = GetCategorySymbols( categoryWatchlist, listnum );

decliners = 0;

for( j = 0; ( sym = StrExtract( list, j ) ) != ""; j++ )

{

g = Foreign( sym, "c" ) < Ref(Foreign( sym, "c" ),-1) ;

if( j == 0 ) decliners = g;

else decliners = decliners + g;

}

return (decliners / j)*100; // divide by number of components

}

Plot( CreatePercentofStocksAdvancing( Wlist ), "\n"+"% of Stocks
Advancing",colorGreen );

Plot( CreatePercentofStocksdeclining( Wlist ), "\n"+"% of Stocks
declining",colorGreen );


----- Original Message -----
From: "Glenn" <glennokb@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, January 21, 2004 1:45 AM
Subject: [amibroker] Re: Percentage Advancers?


> Hi Anthony ,
>
> > Run the two scans separately....to create the composites..
> > Does this seem correct ?
>
> Yes, spot on, thanks for your help.
>
> In regards to your other code (below)  that doesn't need composites,
> would it be possible to add within the code the decliners or would I
> need to mofify the code for decliners and run it as separate chart?
>
> BTW it works great!
>
> Cheers Glenn
>
> ----------------------8<--------------------
> //Function
>
> //% of stocks Advancing
>
> Wlist=Param("WatchListNum",0,0,63,1);
>
> function CreatePercentofStocksAdvancing( listnum )
>
> {
>
> // retrive comma-separated list of symbols in watch list
>
> list = GetCategorySymbols( categoryWatchlist, listnum );
>
> Advancers = 0; // just in case there are no watch list members
>
> for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
>
> {
>
> f = Foreign( sym, "c" ) > Ref(Foreign( sym, "c" ),-1) ;
>
> if( i == 0 ) Advancers = f;
>
> else Advancers = Advancers + f;
>
> }
>
> return (Advancers / i)*100; // divide by number of components
>
> }
>
> Plot( CreatePercentofStocksAdvancing( Wlist ), "% of Stocks
> Advancing",colorGreen );
> ----------------------8<--------------------
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/