I would like to know if there is a way to build a confidence interval, for a random variable which has a Bernoulli distribution, based on its history. I mean if the order of its states is 11100 (i.e. lets consider its 5 last states), the confidence interval should be different from the one with history 00111, because in the 2nd case "on" states are the latest ones, and the center of the interval must be closer to 1, than in the first case. I'm sorry if the therms I used are not correct, but I'm not a mathematician.
Strictly speaking, confidence intervals are not constructed for outcomes of random variables. They are constructed for some unknown parameter (or function thereof) of a distribution.
In your case, I would presume that the parameter of interest is the Bernoulli trial success probability $p$. Therefore the confidence interval would provide an interval estimate of the true value of $p$ based on the data that was collected.
However, because you do not specify the way in which sequential observations of the Bernoulli trials are correlated (i.e., how future results depend on past results), it is not possible to answer your question. Not enough information is supplied. You say these trials are dependent, but you don't say how.