Create Index by using AddToComposite() function?

I created new Index by using AddToComposite() function with Periodicity = 15-minutes like this:

CodeTop5  = "ABC1,ABC2,ABC3,ABC4,ABC5";
VolTop5   = "500000227,1274344300,371620440,465259819,270805971";
TA_Top5   = 214014863186.0;

if (StrFind(CodeTop5, Name()) > 0)
{
	for(i = 0; i <= StrCount(CodeTop5, ","); i++)	
	{
		if (Name() == StrTrim(StrExtract(CodeTop5, i), " "))
		{
			Vol = StrToNum(StrExtract(VolTop5, i));
			idx = "~ABC";
			AddToComposite(O * Vol / TA_Top5 * 100, idx, "O", 19);
			AddToComposite(H * Vol / TA_Top5 * 100, idx, "H", 19);
			AddToComposite(L * Vol / TA_Top5 * 100, idx, "L", 19);
			AddToComposite(C * Vol / TA_Top5 * 100, idx, "C", 19);
			AddToComposite(V, idx, "V", 19);
			break;
		}
	}
}

And below is the result:
Ad

Sometimes the bar at 11:44:59 or 14:44:59 is not correct because trading hours (09:00:00 ~ 11:30:00 and 13:00:00 ~ 14:45:00) but TimeNum() of Ticker in CodeTop5 out of trading hours.

Please help me how to resovle. Or the way to change O,H,L,C of new Index after created?

Thank you so much!

Check the data thoroughly in quote editor for the base tickers.
Since you say sometimes, one of them may have bad tick data.
Such stray ticks are most likely from there rather then the code or addtocomposite fn.

Trading hours (09:00:00 ~ 11:30 :00 and 13:00:00 ~ 14:45 :00) but sometime one or two or three or four (not All) ticker have data out off trading hours (Example at 11:30:05 or 14:45:05)
Ad
Two bars not correct above have value about 20 (16.8, 22.4) it mean have one Ticker in CodeTop5 have bad tick data.

I dont know how to:

  1. Remove tick data out off trading hours before using AddToComposite() function.
  2. Or the way to change (revise) O,H,L,C of new Index after created.

See this thread

One of the ways else you just have to manually delete bad ticks.

How to manually delete bad ticks? I try to this way: Symbol\Quote Editor..
ad2
In Quotations editor form I selected the row not correct then clicked Delete but can not Delete.

What do you mean cannot delete ?
Any errors, pop ups etc ?

Delete this symbol, and fix errors in Base Symbols. Then create composite again.

Thank you!

I tried deleting in ~ABC symbol. I will try to delete in Base Symbols.