Does COMMONSTART flag work?

Posted By: ganimedes

Does COMMONSTART flag work? - 05/01/20 08:30

I have a large list of US stocks.

I would need the date of the first day being publicly listed for each of them (example PTON: 2019-09-26) so I coded a simple script that prints the date of the first bar of each symbol.

I set off the flag COMMONSTART but it doesnt work, all symbols are processed after the "youngest" stock starts.

Here is the script:

var date_ini = 20180101;
var date_end = 20200422;

function check_bar() {
int second_day_listed_and_later = AssetInt[0];

if(second_day_listed_and_later==0){
print(TO_CSV,"\n%d;%s",year() *10000 + month() * 100 + day(),Asset);
}
AssetInt[0] = 1;
}


function run()
{
StartDate = date_ini;
EndDate = date_end;
string name;

if(is(INITRUN)) {
set(COMMONSTART|OFF);

assetList("Assets_screening_mix.csv");
printf("\nNumAssetsListed: %d", NumAssetsListed);
}
while(asset(loop(Assets))) {
check_bar();
}

}

Any idea?

This also affect to training. I need to list the youngest stocks at the end of the assets list CSV in order to get coherent results.
Posted By: AndrewAMD

Re: Does COMMONSTART flag work? - 05/01/20 11:57

Quote
I set off the flag COMMONSTART but it doesnt work, all symbols are processed after the "youngest" stock starts.

Did you mean "oldest" (first stock to exist)? If you meant "youngest" (stock did not exist until recently), COMMONSTART is behaving exactly as described in the manual. After all, in order to have a "common start", all stocks must exist.
© 2024 lite-C Forums