Why the nLastVaild = -1

hello , i try to write a real time data plugin ,
at first , my status not goto set CONNECTED , and the AmiBroker send a GetQuoteEX
and the argument nLastVaild = -1

how to know the nLastValid mean

You really need to dig into ADK docs and example codes a little longer. Especially the sample code. It is already there. The code is heavily commented. Read the examples. GetQuotesEx passes you with already PREFILLED array of EXISTING quotes (if any). nLastValid is the index of LAST VALID (i.e. already existing) bar. nLastValid = -1 means that there are NO already existing data and you need to fill entire array.

BTW: Questions about plugin programming belongs to “Plugins” category not “Data sources”. I changed it already to correct one.