Explore to find Split and Bonus

SetBarsRequired( sbrAll, 0 );
if ( Status( "actionex" ) != actionExEditVerifyFormula   ) 
{

Ytimeframe = Interval()==inDaily ; 
if( Ytimeframe==False  ) 
 { 
   Error("Timeframe Must be Daily"); 
 } 
}

function Filter_Watchlist(WLName, Filter_Condition)
{

Date_Get = Status( "rangetodate");
Get_Current_Week_Day = Date_Get % 100;
Get_Current_Week_Month1 = Date_Get - Get_Current_Week_Day;
Get_Current_Week_Month = ( Get_Current_Week_Month1 % 10000 ) / 100;
Get_Current_Week_Year = ( ( Get_Current_Week_Month1 - Get_Current_Week_Month * 100 ) / 10000 ) + 1900; 
Get_Current_Week_Day = WriteIf(Get_Current_Week_Day < 10, "0"+Get_Current_Week_Day, ""+Get_Current_Week_Day);
Get_Current_Week_Month = WriteIf(Get_Current_Week_Month< 10, "0"+Get_Current_Week_Month, ""+Get_Current_Week_Month);
Get_Current_Week_Year = ""+Get_Current_Week_Year;  

Explore_To_Date_Scan = "_"+Get_Current_Week_Year +"_"+Get_Current_Week_Month+ "_"+Get_Current_Week_Day; 

Explore_From_Date = Status( "rangefromdate");
Explore_To_Date = Status( "rangetodate");

In_Explore_Date = DateNum() >= Explore_From_Date AND DateNum() <= Explore_To_Date;

Explore_Run = Status( "action") == actionExplore OR Status( "action") == actionScan;
		Create_Watchlist = CategoryCreate(WLName+""+Explore_To_Date_Scan , categoryWatchlist ); 
		listnum = CategoryFind(WLName+""+Explore_To_Date_Scan, categoryWatchlist);
	//	if ( Status( "stocknum" ) == 0 )
	//{
	//	oldlist = CategoryGetSymbols( categoryWatchlist, listnum );
	//	for ( i = 0; ( sym = StrExtract( oldlist, i ) ) != ""; i++ )
	//	{
	//		CategoryRemoveSymbol( sym, categoryWatchlist, listnum );
	//	}
	//}
	
	for( i = 0; i < BarCount; i++ )
{
if ( Filter_Condition[i] AND Explore_Run AND In_Explore_Date[i])
	{
		CategoryAddSymbol( "", categoryWatchlist, listnum );
		}
}
	
	
}

Gap_Percent =round(((O - Ref(C, -1))/Ref(C, -1))*100);

PadnadAlign =Ref(Close, -1) > Close OR    Ref(Close, -1) < Close  OR Ref(High, -1) > High OR    Ref(High, -1) < High  OR Ref(Low, -1) > Low OR    Ref(Low, -1) < Low OR Ref(Open, -1) > Open OR    Ref(Open, -1) < Open;

Split_Adjustment =   Ref(Close, -1) > 10 AND Gap_Percent < -25 AND PadnadAlign;



Marketcap = Marketcap = (Close*GetFnData("SharesOut"))/10^7;

Filter =Split_Adjustment;
SetOption("Nodefaultcolumns", True ); // No defalut column 
AddTextColumn( Name(), "TICKER", 1); 
Filter_Watchlist("Split Adjustment",Filter);
AddColumn( DateTime(), "Date", formatDateTime); // Date and time column
AddColumn(Close, "Close", 1.2);
AddColumn(Gap_Percent ,"Gap_Percent", 1);
AddColumn(BarIndex() ,"Trading Days", 1);



What it is worth this functionality is built in, so you don’t need to write any code to detect unadjusted splits and other data issues.
Tools->Database purify menu

1 Like