A little help for my formula

#1
I made a formula to put in a file a list of symbols (some blenk and other appending ",*".

-------------------------------------------------------
WatchListNo = Param("WatchListNo", 0, 0, 63, 1);

fh = fopen( "D:\\Resource\\a\\myfile.txt", "w");

list = CategoryGetSymbols( categoryWatchlist, 50 );
list2 = CategoryGetSymbols( categoryWatchlist, 51 );

for( i = 0; ( symbol = StrExtract( list, i ) ) != ""; i++ )
{
fputs( symbol + "" + "\n", fh );
}

for( i = 0; ( symbol = StrExtract( list2, i ) ) != ""; i++ )
{
fputs( symbol + ",*" + "\n", fh );
}

fclose( fh );

-------------------------------------------------------

Example, now (with the formula above) the list in a file appaer:

AAPL
MSFT
AQN
ARC
ORCL,*
INTC,*
...

Question:
If I want to add a prerfix (linked At the name of GROUP plus ":")

the list sholud be:

NASDAQ:AAPL
NASDAQ:MSFT
NYSE:AQN
NYSE:ARC
NASDAQ:ORCL,*
NASDAQ:INTC,*
....


Can anyone help me to modify the formula (above)
Thanks in advance
Kiss
 
#2
---------------------
WatchListNo = Param("WatchListNo", 0, 0, 63, 1);

fh = fopen( "D:\\Resource\\a\\myfile.txt", "w");

list = CategoryGetSymbols( categoryWatchlist, 50 );
list2 = CategoryGetSymbols( categoryWatchlist, 51 );


for( i = 0; ( symbol = StrExtract( list, i ) ) != ""; i++ )
{
fputs( GroupID(50) + ":" + symbol + "" + "\n", fh );
}

for( i = 0; ( symbol = StrExtract( list2, i ) ) != ""; i++ )
{
fputs( GroupID(51) + ":" + symbol + ",*" + "\n", fh );
}


fclose( fh );

------------------------


Partially resolved with the formula above... but...

I have some Group with 2 word (ex: NASDAQ CM) and I want to exclude CM (or other) holding only NASDAQ:

Now (with the new formula) the result is :

NASDAQ NM:MSFT


but I want :
NASDAQ:MSFT


Thanks in advance for an help.
 

travi

Well-Known Member
#3
Since u haven't mentioned which list is NASDAQ, I'll assume 51

so u modify the formula like this

fputs( strleft(GroupID(51), 6) + ":" + symbol + ",*" + "\n", fh );

strleft will return 6 chars from the left.
For NASDAQ use 6, if NYSE has same issue, put 4 in that for loop.
 
#4
Since u haven't mentioned which list is NASDAQ, I'll assume 51

so u modify the formula like this

fputs( strleft(GroupID(51), 6) + ":" + symbol + ",*" + "\n", fh );

strleft will return 6 chars from the left.
For NASDAQ use 6, if NYSE has same issue, put 4 in that for loop.
Work partially...

I have as Groups:

NASDAQ NM
NASDAQ GM
NASDAQ CM
NYSEMKT
NYSE
ETF
OTCBB
OTCMKTS

in a Watchlist n.... the symbol are mixed (Containing all name in the groups above).
the result (based of your formula, report only NASDAQ stocks)
 

travi

Well-Known Member
#5
Work partially...

I have as Groups:

NASDAQ NM
NASDAQ GM
NASDAQ CM
NYSEMKT
NYSE
ETF
OTCBB
OTCMKTS

in a Watchlist n.... the symbol are mixed (Containing all name in the groups above).
the result (based of your formula, report only NASDAQ stocks)
1. Your formula has a Param definition but it is not in use. Why?

2. In your AFL, you have two FOR Loops each specifying a hardcoded group id, 50 and 51.
so u have to put my coded line in each FOR Loop and modify group id.

Are u familiar with AFL Coding?
 
#6
1. Your formula has a Param definition but it is not in use. Why?

2. In your AFL, you have two FOR Loops each specifying a hardcoded group id, 50 and 51.
so u have to put my coded line in each FOR Loop and modify group id.

Are u familiar with AFL Coding?

I was looking for a way to fix my problem and I had some formulas on my own and I saw that this was my case. Then I adjusted it one while maintaining the origin.

Do not program, but good or bad I can get to understand some things if anyone helps me.

originally was only one wl (50), after that I add the 51 because a want one list in a file with symbols (of multiple definite WL).

(if you see 50 and 51 differentiate by ",* " because ONLY in WL 51 there are stock to must be in the myfile.txt)
 

Similar threads